mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-25 09:56:15 -04:00
contentcollector: Fix collectContentLineText hook
Before, the hook always ignored the return values provided by the hook functions. Now the hook functions can change the text by either returning a string or setting `context.text` to the desired value. Also drop the `styl` and `cls` context properties. They were never documented and they were always null.
This commit is contained in:
parent
4e220538a1
commit
e3a47e48f9
2 changed files with 21 additions and 18 deletions
|
@ -421,7 +421,20 @@ Things in context:
|
|||
4. text - the text for that line
|
||||
|
||||
This hook allows you to validate/manipulate the text before it's sent to the
|
||||
server side. The return value should be the validated/manipulated text.
|
||||
server side. To change the text, either:
|
||||
|
||||
* Set the `text` context property to the desired value and return `undefined`.
|
||||
* (Deprecated) Return a string. If a hook function changes the `text` context
|
||||
property, the return value is ignored. If no hook function changes `text` but
|
||||
multiple hook functions return a string, the first one wins.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
exports.collectContentLineText = (hookName, context) => {
|
||||
context.text = tweakText(context.text);
|
||||
};
|
||||
```
|
||||
|
||||
## collectContentLineBreak
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue