mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-26 02:16:16 -04:00
collab_client: Pass raw message to handleClientMessage_*
hooks
This commit is contained in:
parent
9b7108d730
commit
5fe5a87c85
3 changed files with 10 additions and 7 deletions
|
@ -55,6 +55,8 @@
|
||||||
* New APIs for processing attributes: `ep_etherpad-lite/static/js/attributes`
|
* New APIs for processing attributes: `ep_etherpad-lite/static/js/attributes`
|
||||||
(low-level API) and `ep_etherpad-lite/static/js/AttributeMap` (high-level
|
(low-level API) and `ep_etherpad-lite/static/js/AttributeMap` (high-level
|
||||||
API).
|
API).
|
||||||
|
* The `handleClientMessage_${name}` client-side hooks are now passed the raw
|
||||||
|
message object in the new `msg` context property.
|
||||||
* The `import` server-side hook has a new `ImportError` context property.
|
* The `import` server-side hook has a new `ImportError` context property.
|
||||||
* New `exportEtherpad` and `importEtherpad` server-side hooks.
|
* New `exportEtherpad` and `importEtherpad` server-side hooks.
|
||||||
* The `handleMessageSecurity` and `handleMessage` server-side hooks have a new
|
* The `handleMessageSecurity` and `handleMessage` server-side hooks have a new
|
||||||
|
|
|
@ -393,15 +393,10 @@ 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
|
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.
|
content of the pad. See, for example, the heading1 plugin for etherpad original.
|
||||||
|
|
||||||
## handleClientMessage_`name`
|
## `handleClientMessage_${name}`
|
||||||
|
|
||||||
Called from: `src/static/js/collab_client.js`
|
Called from: `src/static/js/collab_client.js`
|
||||||
|
|
||||||
Things in context:
|
|
||||||
|
|
||||||
1. payload - the data that got sent with the message (use it for custom message
|
|
||||||
content)
|
|
||||||
|
|
||||||
This hook gets called every time the client receives a message of type `name`.
|
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",
|
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
|
which sends a custom message type to all clients connected to a pad. You can
|
||||||
|
@ -410,6 +405,12 @@ also use this to handle existing types.
|
||||||
`collab_client.js` has a pretty extensive list of message types, if you want to
|
`collab_client.js` has a pretty extensive list of message types, if you want to
|
||||||
take a look.
|
take a look.
|
||||||
|
|
||||||
|
Context properties:
|
||||||
|
|
||||||
|
* `msg`: The raw message object.
|
||||||
|
* `payload`: The data that got sent with the message. Usually this is
|
||||||
|
`msg.payload`.
|
||||||
|
|
||||||
## aceStartLineAndCharForPoint-aceEndLineAndCharForPoint
|
## aceStartLineAndCharForPoint-aceEndLineAndCharForPoint
|
||||||
|
|
||||||
Called from: src/static/js/ace2_inner.js
|
Called from: src/static/js/ace2_inner.js
|
||||||
|
|
|
@ -300,7 +300,7 @@ const getCollabClient = (ace2editor, serverVars, initialUserInfo, options, _pad)
|
||||||
// Similar for NEW_CHANGES
|
// Similar for NEW_CHANGES
|
||||||
if (msg.type === 'NEW_CHANGES') msg.payload = msg;
|
if (msg.type === 'NEW_CHANGES') msg.payload = msg;
|
||||||
|
|
||||||
hooks.callAll(`handleClientMessage_${msg.type}`, {payload: msg.payload});
|
hooks.callAll(`handleClientMessage_${msg.type}`, {msg, payload: msg.payload});
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateUserInfo = (userInfo) => {
|
const updateUserInfo = (userInfo) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue