Add content mutation norm editor socket endpoint
This commit is contained in:
parent
93d192d69c
commit
2c105fe350
@ -93,6 +93,15 @@ class NormEditorGroup {
|
||||
}
|
||||
}
|
||||
|
||||
blast_content_mutation(mutation, exclude_conn_id) {
|
||||
const conns = Object.values(this.connections)
|
||||
|
||||
for ( const conn of conns ) {
|
||||
if ( conn.id === exclude_conn_id ) continue;
|
||||
conn._request('applyRemoteContentMutation', { mutation })
|
||||
}
|
||||
}
|
||||
|
||||
set_member_selection(conn, selection) {
|
||||
const session = this.session(conn)
|
||||
if ( session ) {
|
||||
@ -198,6 +207,20 @@ class NormEditorController extends SocketController {
|
||||
)
|
||||
}
|
||||
|
||||
broadcast_content_mutation(transaction, socket) {
|
||||
const editor_group = this._get_editor_group_or_fail(transaction)
|
||||
if ( !editor_group ) return;
|
||||
|
||||
if ( transaction.incoming.data.path.toLowerCase().startsWith('body@') ) {
|
||||
return transaction.status(200).send()
|
||||
}
|
||||
|
||||
console.log('mutation', transaction.incoming.data)
|
||||
editor_group.blast_content_mutation(transaction.incoming.data, transaction.cm.id)
|
||||
|
||||
transaction.status(200).send()
|
||||
}
|
||||
|
||||
async join_editor_group(transaction, socket) {
|
||||
// FIXME support versioning
|
||||
const Page = this.models.get('api:Page')
|
||||
|
Loading…
Reference in New Issue
Block a user