|
| 1 | +# Migrating from WoltLab Suite 6.1 – Quotes |
| 2 | + |
| 3 | +In the upcoming version of WoltLab Suite, the handling of quotes has been revamped to enhance user experience. |
| 4 | +Quotes are now stored client-side in the browser's local storage, allowing synchronization across browser tabs. |
| 5 | + |
| 6 | +## Using the New Quote System |
| 7 | + |
| 8 | +The interfaces `wcf\data\IMessageQuoteAction` and `wcf\system\message\quote\IMessageQuoteHandler` are no longer required to generate the quotes, and the implemented classes or functions can be completely removed. |
| 9 | + |
| 10 | +The object that can be quoted: |
| 11 | + |
| 12 | +- **must** have implemented the interface `wcf\data\IMessage`. |
| 13 | +- should have implemented the interface `wcf\data\IEmbeddedMessageObject`. |
| 14 | + |
| 15 | +Using of `WoltLabSuite/Core/Ui/Message/Quote` is no longer required and only `WoltLabSuite/Core/Component/Quote/Message::registerContainer()` should be used so that a message can be quoted |
| 16 | + |
| 17 | +```smarty |
| 18 | +<!-- Previous --> |
| 19 | +<script data-relocate="true"> |
| 20 | + $(function() { |
| 21 | + require(["WoltLabSuite/Core/Ui/Message/Quote"], ({ UiMessageQuote }) => { |
| 22 | + {include file='shared_messageQuoteManager' wysiwygSelector='text' supportPaste=true} |
| 23 | + |
| 24 | + new UiMessageQuote($quoteManager, "wcf\\data\\foo\\Foo", "com.woltlab.foo", ".message", ".messageBody", ".messageBody > .messageText", true); |
| 25 | + }); |
| 26 | + }); |
| 27 | +</script> |
| 28 | +
|
| 29 | +<!-- Use instead --> |
| 30 | +<script data-relocate="true"> |
| 31 | + require(["WoltLabSuite/Core/Component/Quote/Message"], ({ registerContainer }) => { |
| 32 | + registerContainer(".message", ".messageBody", "wcf\\data\\foo\\Foo", "com.woltlab.foo"); |
| 33 | + }); |
| 34 | +</script> |
| 35 | +``` |
| 36 | + |
| 37 | +## Adjustments to the forms |
| 38 | + |
| 39 | +The functions `MessageQuoteManager::readFormParameters()` and `MessageQuoteManager::saved()` must be called both in the form for creating and editing the entry. |
| 40 | +This is necessary if the text input does support quotes. Regardless of whether the entry itself can be quoted later or not. |
| 41 | + |
| 42 | +```PHP |
| 43 | +use wcf\system\message\quote\MessageQuoteManager; |
| 44 | + |
| 45 | +class FooAddForm extends \wcf\form\MessageForm { |
| 46 | + |
| 47 | + #[\Override] |
| 48 | + protected function readFormParameters() |
| 49 | + { |
| 50 | + parent::readFormParameters(); |
| 51 | + |
| 52 | + // … |
| 53 | + |
| 54 | + // Read the quotes that are to be deleted after the message has been successfully saved |
| 55 | + MessageQuoteManager::getInstance()->readFormParameters(); |
| 56 | + } |
| 57 | + |
| 58 | + #[\Override] |
| 59 | + protected function saved() |
| 60 | + { |
| 61 | + parent::saved(); |
| 62 | + |
| 63 | + // … |
| 64 | + |
| 65 | + // Save the used quotes so that they're deleted on the client with the next request |
| 66 | + MessageQuoteManager::getInstance()->saved(); |
| 67 | + } |
| 68 | +} |
| 69 | +``` |
| 70 | + |
| 71 | +### Pre-filling of text |
| 72 | + |
| 73 | +The automatic pre-filling of text when creating a new entry with previously marked quotes is no longer supported and has been removed in the new version. |
| 74 | + |
| 75 | +### Changes to the FormBuilder |
| 76 | + |
| 77 | +The functions `WysiwygFormContainer::quoteData()` and `WysiwygFormField::quoteData()` are no longer required, it is sufficient to use the function `supportQuotes()`. |
| 78 | +The functions `MessageQuoteManager::readFormParameters()` and `MessageQuoteManager::saved()` are called by `WysiwygFormField` and don't need to be called separately. |
0 commit comments