mirror of
https://github.com/ether/etherpad-lite.git
synced 2026-07-18 00:57:55 +00:00
Add docs for aceRegisterLineAttributes hook (#7512)
* Add docs for aceRegisterLineAttributes hook Documents the new hook in both .md and .adoc client-side hook references. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix: correct source file path from .js to .ts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5e0602c5ee
commit
649f960341
2 changed files with 55 additions and 0 deletions
|
|
@ -211,6 +211,34 @@ The return value of this hook will add elements into the "lineMarkerAttribute"
|
|||
category, making the aceDomLineProcessLineAttributes hook (documented below)
|
||||
call for those elements.
|
||||
|
||||
=== aceRegisterLineAttributes
|
||||
|
||||
Called from: `src/static/js/ace2_inner.ts`
|
||||
|
||||
Things in context: None
|
||||
|
||||
Tells Etherpad which line attributes should be preserved when a user presses
|
||||
Enter to split a line. Without this hook, custom line attributes (such as
|
||||
headings or alignment) are lost when a line is split.
|
||||
|
||||
The return value should be an array of attribute names:
|
||||
|
||||
[source,javascript]
|
||||
----
|
||||
exports.aceRegisterLineAttributes = function(){
|
||||
return [ 'heading' ];
|
||||
}
|
||||
----
|
||||
|
||||
When Enter is pressed on a line that has a registered attribute:
|
||||
|
||||
* **Middle or end of line:** the attribute is copied to the new line below.
|
||||
* **Start of line (column 0):** the attribute moves down with the text content,
|
||||
and the now-empty line above is cleared.
|
||||
|
||||
This is backwards compatible — on Etherpad versions that do not have this hook,
|
||||
the registration is silently ignored.
|
||||
|
||||
=== aceInitialized
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
|
|
|
|||
|
|
@ -207,6 +207,33 @@ The return value of this hook will add elements into the "lineMarkerAttribute"
|
|||
category, making the aceDomLineProcessLineAttributes hook (documented below)
|
||||
call for those elements.
|
||||
|
||||
## aceRegisterLineAttributes
|
||||
|
||||
Called from: `src/static/js/ace2_inner.ts`
|
||||
|
||||
Things in context: None
|
||||
|
||||
Tells Etherpad which line attributes should be preserved when a user presses
|
||||
Enter to split a line. Without this hook, custom line attributes (such as
|
||||
headings or alignment) are lost when a line is split.
|
||||
|
||||
The return value should be an array of attribute names:
|
||||
|
||||
```
|
||||
exports.aceRegisterLineAttributes = function(){
|
||||
return [ 'heading' ];
|
||||
}
|
||||
```
|
||||
|
||||
When Enter is pressed on a line that has a registered attribute:
|
||||
|
||||
* **Middle or end of line:** the attribute is copied to the new line below.
|
||||
* **Start of line (column 0):** the attribute moves down with the text content,
|
||||
and the now-empty line above is cleared.
|
||||
|
||||
This is backwards compatible — on Etherpad versions that do not have this hook,
|
||||
the registration is silently ignored.
|
||||
|
||||
## aceInitialized
|
||||
|
||||
Called from: `src/static/js/ace2_inner.js`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue