mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-24 03:57:06 -04:00
Add support of saving authors and authorship
This commit is contained in:
parent
44fd0a617b
commit
2f117a22cd
6 changed files with 240 additions and 3 deletions
|
@ -10,7 +10,7 @@ var util = require('util');
|
|||
var LZString = require('lz-string');
|
||||
var logger = require('../logger');
|
||||
|
||||
function EditorSocketIOServer(document, operations, docId, mayWrite) {
|
||||
function EditorSocketIOServer(document, operations, docId, mayWrite, operationCallback) {
|
||||
EventEmitter.call(this);
|
||||
Server.call(this, document, operations);
|
||||
this.users = {};
|
||||
|
@ -18,6 +18,7 @@ function EditorSocketIOServer(document, operations, docId, mayWrite) {
|
|||
this.mayWrite = mayWrite || function (_, cb) {
|
||||
cb(true);
|
||||
};
|
||||
this.operationCallback = operationCallback;
|
||||
}
|
||||
|
||||
util.inherits(EditorSocketIOServer, Server);
|
||||
|
@ -51,6 +52,8 @@ EditorSocketIOServer.prototype.addClient = function (socket) {
|
|||
}
|
||||
try {
|
||||
self.onOperation(socket, revision, operation, selection);
|
||||
if (typeof self.operationCallback === 'function')
|
||||
self.operationCallback(socket, operation);
|
||||
} catch (err) {
|
||||
socket.disconnect(true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue