2012-08-14 02:03:06 +00:00
|
|
|
# Client-side hooks
|
2021-01-22 02:35:53 +00:00
|
|
|
|
|
|
|
Most of these hooks are called during or in order to set up the formatting
|
|
|
|
process.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## documentReady
|
2012-08-12 19:29:21 +00:00
|
|
|
Called from: src/templates/pad.html
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
nothing
|
|
|
|
|
|
|
|
This hook proxies the functionality of jQuery's `$(document).ready` event.
|
|
|
|
|
2014-03-05 21:44:22 +00:00
|
|
|
## aceDomLinePreProcessLineAttributes
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2014-03-05 21:44:22 +00:00
|
|
|
Called from: src/static/js/domline.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. domline - The current DOM line being processed
|
|
|
|
2. cls - The class of the current block element (useful for styling)
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is called for elements in the DOM that have the "lineMarkerAttribute"
|
|
|
|
set. You can add elements into this category with the aceRegisterBlockElements
|
|
|
|
hook above. This hook is run BEFORE the numbered and ordered lists logic is
|
|
|
|
applied.
|
2014-03-05 21:44:22 +00:00
|
|
|
|
|
|
|
The return value of this hook should have the following structure:
|
|
|
|
|
|
|
|
`{ preHtml: String, postHtml: String, processedMarker: Boolean }`
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
The preHtml and postHtml values will be added to the HTML display of the
|
|
|
|
element, and if processedMarker is true, the engine won't try to process it any
|
|
|
|
more.
|
2014-03-05 21:44:22 +00:00
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## aceDomLineProcessLineAttributes
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/domline.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. domline - The current DOM line being processed
|
|
|
|
2. cls - The class of the current block element (useful for styling)
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is called for elements in the DOM that have the "lineMarkerAttribute"
|
|
|
|
set. You can add elements into this category with the aceRegisterBlockElements
|
|
|
|
hook above. This hook is run AFTER the ordered and numbered lists logic is
|
|
|
|
applied.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
|
|
|
The return value of this hook should have the following structure:
|
|
|
|
|
|
|
|
`{ preHtml: String, postHtml: String, processedMarker: Boolean }`
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
The preHtml and postHtml values will be added to the HTML display of the
|
|
|
|
element, and if processedMarker is true, the engine won't try to process it any
|
|
|
|
more.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## aceCreateDomLine
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/domline.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. domline - the current DOM line being processed
|
|
|
|
2. cls - The class of the current element (useful for styling)
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is called for any line being processed by the formatting engine,
|
|
|
|
unless the aceDomLineProcessLineAttributes hook from above returned true, in
|
|
|
|
which case this hook is skipped.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
|
|
|
The return value of this hook should have the following structure:
|
|
|
|
|
|
|
|
`{ extraOpenTags: String, extraCloseTags: String, cls: String }`
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
extraOpenTags and extraCloseTags will be added before and after the element in
|
|
|
|
question, and cls will be the new class of the element going forward.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## acePostWriteDomLineHTML
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/domline.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. node - the DOM node that just got written to the page
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is for right after a node has been fully formatted and written to the
|
|
|
|
page.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## aceAttribsToClasses
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/linestylefilter.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
1. linestylefilter - the JavaScript object that's currently processing the ace
|
|
|
|
attributes
|
2012-08-03 20:04:06 +00:00
|
|
|
2. key - the current attribute being processed
|
|
|
|
3. value - the value of the attribute being processed
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is called during the attribute processing procedure, and should be
|
|
|
|
used to translate key, value pairs into valid HTML classes that can be inserted
|
|
|
|
into the DOM.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
The return value for this function should be a list of classes, which will then
|
|
|
|
be parsed into a valid class string.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2014-12-09 01:35:59 +00:00
|
|
|
## aceAttribClasses
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2014-12-09 01:35:59 +00:00
|
|
|
Called from: src/static/js/linestylefilter.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
1. Attributes - Object of Attributes
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is called when attributes are investigated on a line. It is useful if
|
|
|
|
you want to add another attribute type or property type to a pad.
|
2014-12-09 01:35:59 +00:00
|
|
|
|
|
|
|
Example:
|
|
|
|
```
|
|
|
|
exports.aceAttribClasses = function(hook_name, attr, cb){
|
|
|
|
attr.sub = 'tag:sub';
|
|
|
|
cb(attr);
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## aceGetFilterStack
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/linestylefilter.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
1. linestylefilter - the JavaScript object that's currently processing the ace
|
|
|
|
attributes
|
2012-08-03 20:04:06 +00:00
|
|
|
2. browser - an object indicating which browser is accessing the page
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is called to apply custom regular expression filters to a set of
|
|
|
|
styles. The one example available is the ep_linkify plugin, which adds internal
|
|
|
|
links. They use it to find the telltale `[[ ]]` syntax that signifies internal
|
|
|
|
links, and finding that syntax, they add in the internalHref attribute to be
|
|
|
|
later used by the aceCreateDomLine hook (documented above).
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## aceEditorCSS
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/ace.js
|
|
|
|
|
|
|
|
Things in context: None
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is provided to allow custom CSS files to be loaded. The return value
|
|
|
|
should be an array of resource urls or paths relative to the plugins directory.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## aceInitInnerdocbodyHead
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/ace.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. iframeHTML - the HTML of the editor iframe up to this point, in array format
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is called during the creation of the editor HTML. The array should
|
|
|
|
have lines of HTML added to it, giving the plugin author a chance to add in
|
|
|
|
meta, script, link, and other tags that go into the `<head>` element of the
|
|
|
|
editor HTML document.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## aceEditEvent
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/ace2_inner.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. callstack - a bunch of information about the current action
|
|
|
|
2. editorInfo - information about the user who is making the change
|
|
|
|
3. rep - information about where the change is being made
|
2021-01-22 02:35:53 +00:00
|
|
|
4. documentAttributeManager - information about attributes in the document (this
|
|
|
|
is a mystery to me)
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is made available to edit the edit events that might occur when
|
|
|
|
changes are made. Currently you can change the editor information, some of the
|
|
|
|
meanings of the edit, and so on. You can also make internal changes (internal to
|
|
|
|
your plugin) that use the information provided by the edit event.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2016-03-30 14:51:18 +00:00
|
|
|
## aceRegisterNonScrollableEditEvents
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2016-03-30 14:51:18 +00:00
|
|
|
Called from: src/static/js/ace2_inner.js
|
|
|
|
|
|
|
|
Things in context: None
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
When aceEditEvent (documented above) finishes processing the event, it scrolls
|
|
|
|
the viewport to make caret visible to the user, but if you don't want that
|
|
|
|
behavior to happen you can use this hook to register which edit events should
|
|
|
|
not scroll viewport. The return value of this hook should be a list of event
|
|
|
|
names.
|
2016-03-30 14:51:18 +00:00
|
|
|
|
2016-06-20 09:31:11 +00:00
|
|
|
Example:
|
|
|
|
```
|
|
|
|
exports.aceRegisterNonScrollableEditEvents = function(){
|
|
|
|
return [ 'repaginate', 'updatePageCount' ];
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## aceRegisterBlockElements
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/ace2_inner.js
|
|
|
|
|
|
|
|
Things in context: None
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
The return value of this hook will add elements into the "lineMarkerAttribute"
|
|
|
|
category, making the aceDomLineProcessLineAttributes hook (documented below)
|
|
|
|
call for those elements.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## aceInitialized
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/ace2_inner.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
1. editorInfo - information about the user who will be making changes through
|
|
|
|
the interface, and a way to insert functions into the main ace object (see
|
|
|
|
ep_headings)
|
2012-08-03 20:04:06 +00:00
|
|
|
2. rep - information about where the user's cursor is
|
|
|
|
3. documentAttributeManager - some kind of magic
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is for inserting further information into the ace engine, for later
|
|
|
|
use in formatting hooks.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## postAceInit
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/pad.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. ace - the ace object that is applied to this editor.
|
2021-08-25 18:54:07 +00:00
|
|
|
2. clientVars - Object containing client-side configuration such as author ID
|
|
|
|
and plugin settings. Your plugin can manipulate this object via the
|
|
|
|
`clientVars` server-side hook.
|
|
|
|
3. pad - the pad object of the current pad.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2015-12-18 11:33:49 +00:00
|
|
|
## postToolbarInit
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2015-12-18 11:33:49 +00:00
|
|
|
Called from: src/static/js/pad_editbar.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. ace - the ace object that is applied to this editor.
|
2016-03-30 14:51:18 +00:00
|
|
|
2. toolbar - Editbar instance. See below for the Editbar documentation.
|
2015-12-18 11:33:49 +00:00
|
|
|
|
|
|
|
Can be used to register custom actions to the toolbar.
|
|
|
|
|
2016-03-30 14:51:18 +00:00
|
|
|
Usage examples:
|
2015-12-18 11:33:49 +00:00
|
|
|
|
|
|
|
* [https://github.com/tiblu/ep_authorship_toggle]()
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2013-02-27 15:17:22 +00:00
|
|
|
## postTimesliderInit
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2013-02-27 15:17:22 +00:00
|
|
|
Called from: src/static/js/timeslider.js
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
There doesn't appear to be any example available of this particular hook being
|
|
|
|
used, but it gets fired after the timeslider is all set up.
|
2013-02-27 15:17:22 +00:00
|
|
|
|
2020-03-24 14:53:12 +00:00
|
|
|
## goToRevisionEvent
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2020-03-24 14:53:12 +00:00
|
|
|
Called from: src/static/js/broadcast.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. rev - The newRevision
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook gets fired both on timeslider load (as timeslider shows a new
|
|
|
|
revision) and when the new revision is showed to a user. There doesn't appear to
|
|
|
|
be any example available of this particular hook being used.
|
2020-03-24 14:53:12 +00:00
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## userJoinOrUpdate
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/pad_userlist.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. info - the user information
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is called on the client side whenever a user joins or changes. This
|
|
|
|
can be used to create notifications or an alternate user list.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2021-10-27 01:56:53 +00:00
|
|
|
## `chatNewMessage`
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2021-10-27 01:56:53 +00:00
|
|
|
Called from: `src/static/js/chat.js`
|
2013-03-19 03:43:38 +00:00
|
|
|
|
2021-10-27 01:56:53 +00:00
|
|
|
This hook runs on the client side whenever a chat message is received from the
|
|
|
|
server. It can be used to create different notifications for chat messages. Hook
|
2021-10-26 00:44:35 +00:00
|
|
|
functions can modify the `author`, `authorName`, `duration`, `rendered`,
|
|
|
|
`sticky`, `text`, and `timeStr` context properties to change how the message is
|
|
|
|
processed. The `text` and `timeStr` properties may contain HTML and come
|
|
|
|
pre-sanitized; plugins should be careful to sanitize any added user input to
|
|
|
|
avoid introducing an XSS vulnerability.
|
2013-03-19 03:43:38 +00:00
|
|
|
|
2021-10-27 01:56:53 +00:00
|
|
|
Context properties:
|
|
|
|
|
|
|
|
* `authorName`: The display name of the user that wrote the message.
|
|
|
|
* `author`: The author ID of the user that wrote the message.
|
|
|
|
* `text`: Sanitized message HTML, with URLs wrapped like `<a
|
2021-10-27 01:58:34 +00:00
|
|
|
href="url">url</a>`. (Note that `message.text` is not sanitized or processed
|
|
|
|
in any way.)
|
|
|
|
* `message`: The raw message object as received from the server, except with
|
|
|
|
time correction and a default `userId` property if missing. Plugins must not
|
|
|
|
modify this object. Warning: Unlike `text`, `message.text` is not
|
|
|
|
pre-sanitized or processed in any way.
|
2021-10-26 00:44:35 +00:00
|
|
|
* `rendered` - Used to override the default message rendering. Initially set to
|
|
|
|
`null`. If the hook function sets this to a DOM element object or a jQuery
|
|
|
|
object, then that object will be used as the rendered message UI. Otherwise,
|
|
|
|
if this is set to `null`, then Etherpad will render a default UI for the
|
|
|
|
message using the other context properties.
|
2021-10-27 01:56:53 +00:00
|
|
|
* `sticky` (boolean): Whether the gritter notification should fade out on its
|
|
|
|
own or just sit there until manually closed.
|
|
|
|
* `timestamp`: When the chat message was sent (milliseconds since epoch),
|
|
|
|
corrected using the difference between the local clock and the server's clock.
|
|
|
|
* `timeStr`: The message timestamp as a formatted string.
|
|
|
|
* `duration`: How long (in milliseconds) to display the gritter notification (0
|
|
|
|
to disable).
|
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## collectContentPre
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/contentcollector.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. cc - the contentcollector object
|
|
|
|
2. state - the current state of the change being made
|
|
|
|
3. tname - the tag name of this node currently being processed
|
2015-04-23 16:27:54 +00:00
|
|
|
4. styl - the style applied to the node (probably CSS) -- Note the typo
|
2012-08-03 20:04:06 +00:00
|
|
|
5. cls - the HTML class string of the node
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is called before the content of a node is collected by the usual
|
|
|
|
methods. The cc object can be used to do a bunch of things that modify the
|
|
|
|
content of the pad. See, for example, the heading1 plugin for etherpad original.
|
2012-08-03 20:04:06 +00:00
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
E.g. if you need to apply an attribute to newly inserted characters, call
|
|
|
|
cc.doAttrib(state, "attributeName") which results in an attribute
|
|
|
|
attributeName=true.
|
2015-03-31 08:50:20 +00:00
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
If you want to specify also a value, call cc.doAttrib(state,
|
|
|
|
"attributeName::value") which results in an attribute attributeName=value.
|
2015-03-31 08:50:20 +00:00
|
|
|
|
|
|
|
|
2015-01-26 02:42:48 +00:00
|
|
|
## collectContentImage
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2015-01-26 02:42:48 +00:00
|
|
|
Called from: src/static/js/contentcollector.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. cc - the contentcollector object
|
|
|
|
2. state - the current state of the change being made
|
|
|
|
3. tname - the tag name of this node currently being processed
|
|
|
|
4. style - the style applied to the node (probably CSS)
|
|
|
|
5. cls - the HTML class string of the node
|
2015-01-26 16:07:46 +00:00
|
|
|
6. node - the node being modified
|
2015-01-26 02:42:48 +00:00
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is called before the content of an image node is collected by the
|
|
|
|
usual methods. The cc object can be used to do a bunch of things that modify the
|
|
|
|
content of the pad.
|
2015-01-26 02:42:48 +00:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
```
|
|
|
|
exports.collectContentImage = function(name, context){
|
|
|
|
context.state.lineAttributes.img = context.node.outerHTML;
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## collectContentPost
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-03 20:04:06 +00:00
|
|
|
Called from: src/static/js/contentcollector.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. cc - the contentcollector object
|
|
|
|
2. state - the current state of the change being made
|
|
|
|
3. tname - the tag name of this node currently being processed
|
|
|
|
4. style - the style applied to the node (probably CSS)
|
|
|
|
5. cls - the HTML class string of the node
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is called after the content of a node is collected by the usual
|
|
|
|
methods. The cc object can be used to do a bunch of things that modify the
|
|
|
|
content of the pad. See, for example, the heading1 plugin for etherpad original.
|
2012-08-08 17:42:16 +00:00
|
|
|
|
2012-08-14 02:03:06 +00:00
|
|
|
## handleClientMessage_`name`
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2012-08-08 17:42:16 +00:00
|
|
|
Called from: `src/static/js/collab_client.js`
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
1. payload - the data that got sent with the message (use it for custom message
|
|
|
|
content)
|
2012-08-08 17:42:16 +00:00
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook gets called every time the client receives a message of type `name`.
|
|
|
|
This can most notably be used with the new HTTP API call, "sendClientsMessage",
|
|
|
|
which sends a custom message type to all clients connected to a pad. You can
|
|
|
|
also use this to handle existing types.
|
2012-08-08 17:42:16 +00:00
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
`collab_client.js` has a pretty extensive list of message types, if you want to
|
|
|
|
take a look.
|
|
|
|
|
|
|
|
## aceStartLineAndCharForPoint-aceEndLineAndCharForPoint
|
2012-09-30 22:13:14 +00:00
|
|
|
|
|
|
|
Called from: src/static/js/ace2_inner.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. callstack - a bunch of information about the current action
|
|
|
|
2. editorInfo - information about the user who is making the change
|
|
|
|
3. rep - information about where the change is being made
|
|
|
|
4. root - the span element of the current line
|
|
|
|
5. point - the starting/ending element where the cursor highlights
|
|
|
|
6. documentAttributeManager - information about attributes in the document
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is provided to allow a plugin to turn DOM node selection into
|
|
|
|
[line,char] selection. The return value should be an array of [line,char]
|
|
|
|
|
|
|
|
## aceKeyEvent
|
2012-09-30 22:13:14 +00:00
|
|
|
|
|
|
|
Called from: src/static/js/ace2_inner.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. callstack - a bunch of information about the current action
|
|
|
|
2. editorInfo - information about the user who is making the change
|
|
|
|
3. rep - information about where the change is being made
|
|
|
|
4. documentAttributeManager - information about attributes in the document
|
|
|
|
5. evt - the fired event
|
|
|
|
|
|
|
|
This hook is provided to allow a plugin to handle key events.
|
|
|
|
The return value should be true if you have handled the event.
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
## collectContentLineText
|
|
|
|
|
2012-09-30 22:13:14 +00:00
|
|
|
Called from: src/static/js/contentcollector.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. cc - the contentcollector object
|
|
|
|
2. state - the current state of the change being made
|
|
|
|
3. tname - the tag name of this node currently being processed
|
|
|
|
4. text - the text for that line
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook allows you to validate/manipulate the text before it's sent to the
|
2021-01-22 07:06:06 +00:00
|
|
|
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);
|
|
|
|
};
|
|
|
|
```
|
2021-01-22 02:35:53 +00:00
|
|
|
|
|
|
|
## collectContentLineBreak
|
2012-09-30 22:13:14 +00:00
|
|
|
|
|
|
|
Called from: src/static/js/contentcollector.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. cc - the contentcollector object
|
|
|
|
2. state - the current state of the change being made
|
|
|
|
3. tname - the tag name of this node currently being processed
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is provided to allow whether the br tag should induce a new magic
|
|
|
|
domline or not. The return value should be either true(break the line) or false.
|
|
|
|
|
|
|
|
## disableAuthorColorsForThisLine
|
2012-09-30 22:13:14 +00:00
|
|
|
|
|
|
|
Called from: src/static/js/linestylefilter.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
1. linestylefilter - the JavaScript object that's currently processing the ace
|
|
|
|
attributes
|
2012-09-30 22:13:14 +00:00
|
|
|
2. text - the line text
|
|
|
|
3. class - line class
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is provided to allow whether a given line should be deliniated with
|
|
|
|
multiple authors. Multiple authors in one line cause the creation of magic span
|
|
|
|
lines. This might not suit you and now you can disable it and handle your own
|
|
|
|
deliniation. The return value should be either true(disable) or false.
|
2013-06-15 03:07:13 +00:00
|
|
|
|
|
|
|
## aceSetAuthorStyle
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2013-06-15 03:07:13 +00:00
|
|
|
Called from: src/static/js/ace2_inner.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
2019-01-12 18:38:49 +00:00
|
|
|
1. dynamicCSS - css manager for inner ace
|
2013-06-15 03:07:13 +00:00
|
|
|
2. outerDynamicCSS - css manager for outer ace
|
|
|
|
3. parentDynamicCSS - css manager for parent document
|
|
|
|
4. info - author style info
|
|
|
|
5. author - author info
|
|
|
|
6. authorSelector - css selector for author span in inner ace
|
|
|
|
|
2021-01-22 02:35:53 +00:00
|
|
|
This hook is provided to allow author highlight style to be modified. Registered
|
|
|
|
hooks should return 1 if the plugin handles highlighting. If no plugin returns
|
|
|
|
1, the core will use the default background-based highlighting.
|
2015-07-11 15:32:19 +00:00
|
|
|
|
|
|
|
## aceSelectionChanged
|
2021-01-22 02:35:53 +00:00
|
|
|
|
2015-07-11 15:32:19 +00:00
|
|
|
Called from: src/static/js/ace2_inner.js
|
|
|
|
|
|
|
|
Things in context:
|
|
|
|
|
|
|
|
1. rep - information about where the user's cursor is
|
|
|
|
2. documentAttributeManager - information about attributes in the document
|
|
|
|
|
|
|
|
This hook allows a plugin to react to a cursor or selection change,
|
|
|
|
perhaps to update a UI element based on the style at the cursor location.
|