collab_client: Pass raw message to handleClientMessage_* hooks

This commit is contained in:
Richard Hansen 2021-12-05 22:32:27 -05:00
parent 9b7108d730
commit 5fe5a87c85
3 changed files with 10 additions and 7 deletions

View file

@ -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
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`
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 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
@ -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
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
Called from: src/static/js/ace2_inner.js