@seafile/comment-editor 0.0.1-alpha.3 → 0.0.1-alpha.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/basic-sdk/assets/css/layout.css +1 -45
  2. package/dist/basic-sdk/comment/utils.js +39 -0
  3. package/dist/basic-sdk/context.js +8 -14
  4. package/dist/basic-sdk/editor/comment-editor.css +138 -0
  5. package/dist/basic-sdk/{comment/components → editor}/comment-editor.js +41 -43
  6. package/dist/basic-sdk/extension/plugins/image/helpers.js +1 -1
  7. package/dist/basic-sdk/extension/plugins/image/use-copy-image.js +1 -1
  8. package/dist/basic-sdk/extension/plugins/image/use-upload-image.js +1 -1
  9. package/dist/basic-sdk/extension/toolbar/comment-editor-toolbar/index.js +7 -3
  10. package/dist/basic-sdk/hooks/use-comment.js +19 -182
  11. package/dist/basic-sdk/index.js +3 -10
  12. package/dist/index.js +0 -12
  13. package/dist/pages/seafile-comment-editor.js +37 -13
  14. package/package.json +1 -1
  15. package/dist/assets/css/plugin-editor.css +0 -7
  16. package/dist/assets/css/simple-viewer.css +0 -6
  17. package/dist/basic-sdk/comment/components/comment-all-participants/index.css +0 -83
  18. package/dist/basic-sdk/comment/components/comment-all-participants/index.js +0 -67
  19. package/dist/basic-sdk/comment/components/comment-all-participants/participant-avatar.js +0 -43
  20. package/dist/basic-sdk/comment/components/comment-delete-popover.js +0 -80
  21. package/dist/basic-sdk/comment/components/comment-item-collapse-wrapper.js +0 -160
  22. package/dist/basic-sdk/comment/components/comment-item-content.js +0 -154
  23. package/dist/basic-sdk/comment/components/comment-item-reply.js +0 -124
  24. package/dist/basic-sdk/comment/components/comment-item-resolved-reply.js +0 -38
  25. package/dist/basic-sdk/comment/components/comment-item-wrapper.js +0 -364
  26. package/dist/basic-sdk/comment/components/comment-list.css +0 -422
  27. package/dist/basic-sdk/comment/components/comment-list.js +0 -216
  28. package/dist/basic-sdk/comment/components/comment-participants-editor/index.css +0 -132
  29. package/dist/basic-sdk/comment/components/comment-participants-editor/index.js +0 -69
  30. package/dist/basic-sdk/comment/components/comment-participants-editor/searched-collaborators.js +0 -62
  31. package/dist/basic-sdk/comment/components/comment-participants-editor/selected-participants.js +0 -48
  32. package/dist/basic-sdk/comment/components/editor-comment.js +0 -183
  33. package/dist/basic-sdk/comment/components/elements-comment-count/element-comment-count.js +0 -64
  34. package/dist/basic-sdk/comment/components/elements-comment-count/index.css +0 -29
  35. package/dist/basic-sdk/comment/components/elements-comment-count/index.js +0 -49
  36. package/dist/basic-sdk/comment/components/global-comment/global-comment-body-header.js +0 -88
  37. package/dist/basic-sdk/comment/components/global-comment/global-comment-header.js +0 -90
  38. package/dist/basic-sdk/comment/components/global-comment/index.css +0 -328
  39. package/dist/basic-sdk/comment/components/global-comment/index.js +0 -217
  40. package/dist/basic-sdk/comment/components/index.js +0 -21
  41. package/dist/basic-sdk/comment/components/style.css +0 -40
  42. package/dist/basic-sdk/comment/helper.js +0 -184
  43. package/dist/basic-sdk/comment/hooks/comment-hooks/use-comment-context.js +0 -20
  44. package/dist/basic-sdk/comment/hooks/comment-hooks/use-comment-list.js +0 -45
  45. package/dist/basic-sdk/comment/hooks/comment-hooks/use-comment-mount.js +0 -57
  46. package/dist/basic-sdk/comment/hooks/notification-hooks/index.js +0 -25
  47. package/dist/basic-sdk/comment/hooks/notification-hooks/use-notification-context.js +0 -20
  48. package/dist/basic-sdk/comment/hooks/notification-hooks/use-notification-mount.js +0 -70
  49. package/dist/basic-sdk/comment/hooks/use-participants.js +0 -26
  50. package/dist/basic-sdk/comment/index.js +0 -21
  51. package/dist/basic-sdk/comment/reducer/comment-reducer.js +0 -353
  52. package/dist/basic-sdk/comment/reducer/notification-reducer.js +0 -89
  53. package/dist/basic-sdk/comment/utils/get-event-transfer.js +0 -77
  54. package/dist/basic-sdk/comment/utils/index.js +0 -281
  55. package/dist/basic-sdk/comment/utils/notification-utils.js +0 -62
  56. package/dist/basic-sdk/layout/comment-layout/index.css +0 -15
  57. package/dist/basic-sdk/layout/comment-layout/index.js +0 -87
  58. package/dist/basic-sdk/layout/comment-layout/resize-width/index.css +0 -38
  59. package/dist/basic-sdk/layout/comment-layout/resize-width/index.js +0 -132
  60. package/dist/basic-sdk/layout/editor-container.js +0 -32
  61. package/dist/basic-sdk/layout/index.js +0 -13
  62. package/dist/basic-sdk/socket/helpers.js +0 -299
  63. package/dist/basic-sdk/socket/index.js +0 -20
  64. package/dist/basic-sdk/socket/socket-client.js +0 -211
  65. package/dist/basic-sdk/socket/socket-manager.js +0 -386
  66. package/dist/basic-sdk/socket/with-socket-io.js +0 -73
  67. /package/dist/basic-sdk/comment/{constants/index.js → constants.js} +0 -0
@@ -1,386 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
9
- var _constants = require("../constants");
10
- var _helper = require("../cursor/helper");
11
- var _debug = require("../utils/debug");
12
- var _eventBus = _interopRequireDefault(require("../utils/event-bus"));
13
- var _helpers = require("./helpers");
14
- var _socketClient = _interopRequireDefault(require("./socket-client"));
15
- var _SocketManager;
16
- // idle --> sending --> conflict --> idle
17
- // --> conflict --> idle
18
- // --> disconnect --> conflict --> idle
19
- // --> idle
20
- const STATE = {
21
- IDLE: 'idle',
22
- SENDING: 'sending',
23
- CONFLICT: 'conflict',
24
- DISCONNECT: 'disconnect',
25
- NEED_RELOAD: 'need_reload'
26
- };
27
- class SocketManager {
28
- constructor(editor, _document, config) {
29
- (0, _defineProperty2.default)(this, "getDocumentVersion", () => {
30
- const {
31
- version
32
- } = this.document;
33
- return version;
34
- });
35
- (0, _defineProperty2.default)(this, "updateDocumentVersion", document => {
36
- this.document['version'] = document.version;
37
- });
38
- (0, _defineProperty2.default)(this, "receivePublishDocument", () => {
39
- this.eventBus.dispatch(_constants.INTERNAL_EVENT.PUBLISH_DOCUMENT);
40
- });
41
- (0, _defineProperty2.default)(this, "receivePublishDocumentError", () => {
42
- this.eventBus.dispatch(_constants.INTERNAL_EVENT.PUBLISH_DOCUMENT_ERROR);
43
- });
44
- (0, _defineProperty2.default)(this, "receiveRemoveDocument", () => {
45
- this.eventBus.dispatch(_constants.INTERNAL_EVENT.REMOVE_DOCUMENT);
46
- });
47
- (0, _defineProperty2.default)(this, "receiveRemoveDocumentError", () => {
48
- this.eventBus.dispatch(_constants.INTERNAL_EVENT.REMOVE_DOCUMENT_ERROR);
49
- });
50
- (0, _defineProperty2.default)(this, "receiveDocumentReplaced", () => {
51
- this.eventBus.dispatch(_constants.INTERNAL_EVENT.DOCUMENT_REPLACED);
52
- });
53
- (0, _defineProperty2.default)(this, "receiveDocumentReplacedError", () => {
54
- this.eventBus.dispatch(_constants.INTERNAL_EVENT.DOCUMENT_REPLACED_ERROR);
55
- });
56
- (0, _defineProperty2.default)(this, "receiveNewNotification", notification => {
57
- this.eventBus.dispatch(_constants.INTERNAL_EVENT.NEW_NOTIFICATION, notification);
58
- });
59
- (0, _defineProperty2.default)(this, "onReceiveLocalOperations", operations => {
60
- if (this.editor.readonly) return;
61
- this.pendingOperationList.push(operations);
62
- const lastOpBeginTime = new Date().getTime();
63
- this.pendingOperationBeginTimeList.push(lastOpBeginTime);
64
- const firstOpBeginTime = this.pendingOperationBeginTimeList[0];
65
- const isExceedExecuteTime = (lastOpBeginTime - firstOpBeginTime) / 1000 > 30 ? true : false;
66
- if (isExceedExecuteTime || this.pendingOperationList.length > 50) {
67
- this.dispatchConnectState('pending_operations_exceed_limit');
68
- }
69
- this.sendOperations();
70
- });
71
- (0, _defineProperty2.default)(this, "sendOperations", () => {
72
- if (this.editor.readonly) return;
73
- if (this.state !== STATE.IDLE) return;
74
- (0, _debug.stateDebug)(`State changed: ${this.state} -> ${STATE.SENDING}`);
75
- this.state = STATE.SENDING;
76
- this.sendNextOperations();
77
- });
78
- (0, _defineProperty2.default)(this, "sendNextOperations", () => {
79
- if (this.state !== STATE.SENDING) return;
80
- if (this.pendingOperationList.length === 0) {
81
- (0, _debug.stateDebug)(`State Changed: ${this.state} -> ${STATE.IDLE}`);
82
- this.state = STATE.IDLE;
83
- return;
84
- }
85
- this.dispatchConnectState('is-saving');
86
- const version = this.document.version;
87
- const operations = this.pendingOperationList.shift();
88
- const selection = this.editor.selection;
89
- this._sendingOperations = operations;
90
- this.socketClient.sendOperations(operations, version, selection, this.sendOperationsCallback);
91
- });
92
- (0, _defineProperty2.default)(this, "sendOperationsCallback", result => {
93
- if (result && result.success) {
94
- const {
95
- version: serverVersion
96
- } = result;
97
- this.document['version'] = serverVersion;
98
- const lastSavedAt = new Date().getTime();
99
- this.dispatchConnectState('saved', lastSavedAt);
100
-
101
- // send next operations
102
- this.pendingOperationBeginTimeList.shift(); // remove current operation's begin time
103
- this._sendingOperations = null;
104
- this.sendNextOperations();
105
- return;
106
- }
107
-
108
- // Operations are execute failure
109
- const {
110
- error_type
111
- } = result;
112
- if (error_type === 'load_document_content_error' || error_type === 'save_operations_to_database_error' || error_type === 'token_expired') {
113
- // load_document_content_error: After a short-term reconnection, the content of the document fails to load
114
- // save_operation_to_database_error: Save operation to database error
115
- this.dispatchConnectState(error_type);
116
-
117
- // reset sending control
118
- (0, _debug.stateDebug)(`State Changed: ${this.state} -> ${STATE.NEED_RELOAD}`);
119
- this.state = STATE.NEED_RELOAD;
120
- this._sendingOperations = null;
121
- } else if (error_type === 'version_behind_server') {
122
- // Put the failed operation into the pending list and re-execute it
123
- this.pendingOperationList.unshift([...this._sendingOperations]);
124
- (0, _debug.stateDebug)(`State Changed: ${this.state} -> ${STATE.CONFLICT}`);
125
- this.state = STATE.CONFLICT;
126
- const {
127
- lose_operations
128
- } = result;
129
- this.resolveConflicting(lose_operations);
130
- } else if (error_type === 'execute_client_operations_error') {
131
- this.editor.isRemote = true;
132
- const dupSendingOperations = [...this._sendingOperations];
133
- (0, _helpers.revertOperationList)(this.editor, [dupSendingOperations]);
134
-
135
- // Update the save time after revert
136
- const lastSavedAt = new Date().getTime();
137
- this.dispatchConnectState('saved', lastSavedAt);
138
-
139
- // Set isRemote to false must be in Promise.resolve function, make sure the modification of isRemote is later than the onChange event
140
- Promise.resolve().then(_ => {
141
- this.editor.isRemote = false;
142
- this.dispatchConnectState(error_type);
143
-
144
- // send next operations
145
- this._sendingOperations = null;
146
- this.sendNextOperations();
147
- });
148
- }
149
- });
150
- (0, _defineProperty2.default)(this, "onReceiveRemoteOperations", params => {
151
- // if this.disconnect is true, Then the message sent by the remote end cannot be received
152
- if (this.state !== STATE.IDLE) return;
153
- if (this.editor.readonly) return;
154
- const {
155
- version: serverVersion
156
- } = params;
157
- const {
158
- version: clientVersion
159
- } = this.document;
160
- if (serverVersion === clientVersion + 1) {
161
- // update execute remote operations flag
162
- this.editor.isRemote = true;
163
- const {
164
- operations
165
- } = params;
166
- // Update content & version
167
- (0, _debug.serverDebug)('execute remote operations: %O', operations);
168
- try {
169
- (0, _helpers.syncRemoteOperations)(this.editor, operations);
170
- } catch (error) {
171
- (0, _debug.stateDebug)(`State Changed: ${this.state} -> ${STATE.CONFLICT}`);
172
- this.state = STATE.CONFLICT;
173
- this.dispatchConnectState('sync_server_operations_error');
174
- return;
175
- }
176
-
177
- // Update document
178
- this.document.version = serverVersion;
179
- this.document.children = this.editor.children;
180
- Promise.resolve().then(() => {
181
- this.editor.isRemote = false;
182
- this.revertOperationList = [];
183
- });
184
- } else {
185
- // isConflict
186
- this.onConflictHappen();
187
- }
188
- });
189
- (0, _defineProperty2.default)(this, "onReconnect", result => {
190
- const {
191
- version: serverVersion
192
- } = result;
193
- const clientVersion = this.getDocumentVersion();
194
- // The client version is inconsistent with the server version, and the latest operations performed by the server need to be loaded
195
- if (serverVersion !== clientVersion) {
196
- this.onConflictHappen();
197
- return;
198
- }
199
-
200
- // The version consistency indicates that there is no conflict and no processing is required
201
- (0, _debug.stateDebug)(`State Changed: ${this.state} -> ${STATE.IDLE}`);
202
- this.state = STATE.IDLE;
203
- if (this.pendingOperationList.length > 0) {
204
- (0, _debug.clientDebug)('After reconnection, manually trigger the execution of ops.');
205
- (0, _debug.stateDebug)(`State Changed: ${this.state} -> ${STATE.SENDING}`);
206
- this.state = STATE.SENDING;
207
- this.sendNextOperations();
208
- }
209
- });
210
- (0, _defineProperty2.default)(this, "onConflictHappen", () => {
211
- (0, _debug.stateDebug)(`State Changed: ${this.state} -> ${STATE.CONFLICT}`);
212
- this.state = STATE.CONFLICT;
213
- this.socketClient.getRecentOperations();
214
- });
215
- (0, _defineProperty2.default)(this, "onGetRecentOperations", result => {
216
- if (this.editor.readonly) return;
217
- const {
218
- mode,
219
- content
220
- } = result;
221
- (0, _debug.conflictDebug)('Start conflict resolution');
222
- // sync document
223
- if (mode === 'document') {
224
- const {
225
- version,
226
- children
227
- } = content;
228
- // 1. update document
229
- (0, _debug.conflictDebug)('Update local document to remote document');
230
- this.document.children = children;
231
- this.document.version = version;
232
- this.editor.children = children;
233
- this.editor.isRemote = true;
234
- this.editor.onChange();
235
- (0, _debug.stateDebug)(`State Changed: ${this.state} -> ${STATE.IDLE}`);
236
- this.editor.isRemote = false;
237
- this.state = STATE.IDLE;
238
- this._sendingOperations = null;
239
-
240
- // 2. exec client operationList
241
- const pendingOperationList = this.pendingOperationList.slice();
242
- this.pendingOperationList = [];
243
-
244
- // need resend this operations to server
245
- (0, _debug.conflictDebug)('Re-execute local unsynchronized operations: %o', pendingOperationList);
246
- (0, _helpers.reExecRevertOperationList)(this.editor, pendingOperationList);
247
- return;
248
- }
249
-
250
- // mode os operations: sync operations
251
- // content is [{version, operations}, {version, operations}, ...]
252
- const loseOperations = content;
253
- this.resolveConflicting(loseOperations);
254
- });
255
- (0, _defineProperty2.default)(this, "resolveConflicting", loseOperations => {
256
- if (this.editor.readonly) return;
257
- (0, _debug.conflictDebug)('resolve conflicts');
258
- this.editor.isRemote = true;
259
- if (this.pendingOperationList.length !== 0) {
260
- // 1. Revert operations
261
- // 1.1 record reverted operationList & clear pendingOperationList
262
- this.revertOperationList = this.pendingOperationList.slice();
263
- this.pendingOperationList = [];
264
-
265
- // 1.2 Revert operationList
266
- (0, _debug.conflictDebug)('revert locale operations: %O', this.revertOperationList);
267
- (0, _helpers.revertOperationList)(this.editor, this.revertOperationList);
268
- }
269
- loseOperations = loseOperations.sort((prev, next) => prev.version - next.version);
270
- (0, _debug.conflictDebug)('lose operations length: %s', loseOperations.length);
271
- while (loseOperations.length > 0) {
272
- const operationParams = loseOperations.shift();
273
- // 2. execute operations
274
- const {
275
- operations,
276
- version: serverVersion
277
- } = operationParams;
278
- // 2.1 Update content & version
279
- (0, _debug.conflictDebug)('execute lose operations: %O', operations);
280
- try {
281
- (0, _helpers.syncRemoteOperations)(this.editor, operations);
282
- } catch (error) {
283
- (0, _debug.stateDebug)(`State Changed: ${this.state} -> ${STATE.CONFLICT}`);
284
- this.state = STATE.CONFLICT;
285
- this.dispatchConnectState('sync_server_operations_error');
286
- return;
287
- }
288
-
289
- // 2.2 Update document
290
- this.document.version = serverVersion;
291
- this.document.children = this.editor.children;
292
- }
293
- if (this.revertOperationList.length === 0) {
294
- Promise.resolve().then(() => {
295
- this.editor.isRemote = false;
296
- (0, _debug.stateDebug)(`State Changed: ${this.state} -> ${STATE.IDLE}`);
297
- this.state = STATE.IDLE;
298
- this._sendingOperations = null;
299
- this.revertOperationList = [];
300
- });
301
- return;
302
- }
303
-
304
- // Set isRemote to false must be in Promise.resolve function, make sure the modification of isRemote is later than the onChange event
305
- Promise.resolve().then(() => {
306
- // reset execute remote operations flag
307
- this.editor.isRemote = false;
308
- (0, _debug.stateDebug)(`State Changed: ${this.state} -> ${STATE.IDLE}`);
309
- this.state = STATE.IDLE;
310
- this._sendingOperations = null;
311
-
312
- // 3. Execute pending operations
313
- // 3.1 Re-execute operations
314
- (0, _debug.conflictDebug)('Editor isRemote is false: %s', this.editor.isRemote);
315
- (0, _debug.conflictDebug)('Re-execute pending operations, %O', this.revertOperationList);
316
- (0, _helpers.reExecRevertOperationList)(this.editor, this.revertOperationList);
317
-
318
- // 3.2 Clear revert operationList
319
- this.revertOperationList = [];
320
- (0, _debug.conflictDebug)('Complete conflict resolution');
321
- });
322
- });
323
- (0, _defineProperty2.default)(this, "sendCursorLocation", location => {
324
- this.socketClient.sendCursorLocation(location);
325
- });
326
- (0, _defineProperty2.default)(this, "receiveCursorLocation", params => {
327
- if (this.editor.readonly) return;
328
- const {
329
- user,
330
- location,
331
- cursor_data: cursorData
332
- } = params;
333
- (0, _helpers.syncRemoteCursorLocation)(this.editor, user, location, cursorData);
334
- return;
335
- });
336
- (0, _defineProperty2.default)(this, "dispatchConnectState", (type, message) => {
337
- if (type === 'leave-room') {
338
- (0, _helper.deleteCursor)(this.editor, message);
339
- this.editor.onCursor && this.editor.onCursor(this.editor.cursors);
340
- }
341
- if (type === 'disconnect') {
342
- // current state is sending
343
- if (this._sendingOperations) {
344
- this.pendingOperationList.unshift(this._sendingOperations.slice());
345
- this._sendingOperations = null;
346
- }
347
- (0, _debug.stateDebug)(`State Changed: ${this.state} -> ${STATE.DISCONNECT}`);
348
- this.state = STATE.DISCONNECT;
349
- }
350
- this.eventBus.dispatch(type, message);
351
- });
352
- (0, _defineProperty2.default)(this, "closeSocketConnect", () => {
353
- this.socketClient.disconnectWithServer();
354
- });
355
- (0, _defineProperty2.default)(this, "receiveParticipantAdded", uses => {
356
- this.eventBus.dispatch(_constants.INTERNAL_EVENT.PARTICIPANT_ADDED, uses);
357
- });
358
- (0, _defineProperty2.default)(this, "receiveParticipantRemoved", email => {
359
- this.eventBus.dispatch(_constants.INTERNAL_EVENT.PARTICIPANT_REMOVED, email);
360
- });
361
- this.editor = editor;
362
- this.document = _document;
363
- this.socketClient = new _socketClient.default(config);
364
- this.pendingOperationList = []; // Two-dimensional arrays: [operations, operations, ...]
365
- this.pendingOperationBeginTimeList = [];
366
- this.remoteOperationsList = []; // Same with pending operations
367
- this.revertOperationList = [];
368
- this.eventBus = _eventBus.default.getInstance();
369
- this.state = STATE.IDLE;
370
- }
371
- }
372
- _SocketManager = SocketManager;
373
- (0, _defineProperty2.default)(SocketManager, "getInstance", (editor, document, socketConfig) => {
374
- if (_SocketManager.instance) {
375
- return _SocketManager.instance;
376
- }
377
- if (!document || !socketConfig) {
378
- throw new Error('SocketManager init params is invalid. Place check your code to fix it.');
379
- }
380
- _SocketManager.instance = new _SocketManager(editor, document, socketConfig);
381
- return _SocketManager.instance;
382
- });
383
- (0, _defineProperty2.default)(SocketManager, "destroy", () => {
384
- _SocketManager.instance = null;
385
- });
386
- var _default = exports.default = SocketManager;
@@ -1,73 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _helper = require("../cursor/helper");
9
- var _eventBus = _interopRequireDefault(require("../utils/event-bus"));
10
- var _socketManager = _interopRequireDefault(require("./socket-manager"));
11
- const withSocketIO = (editor, options) => {
12
- const {
13
- onChange
14
- } = editor;
15
- const newEditor = editor;
16
- let socketManager = null;
17
- const {
18
- user
19
- } = options.config;
20
- newEditor.user = user;
21
- newEditor.openConnection = () => {
22
- const {
23
- document,
24
- config
25
- } = options;
26
- const cursorData = (0, _helper.generateCursorData)(options.config);
27
- config['cursorData'] = cursorData;
28
- socketManager = _socketManager.default.getInstance(newEditor, document, config);
29
- };
30
- newEditor.closeConnection = () => {
31
- socketManager && socketManager.closeSocketConnect();
32
- _socketManager.default.destroy();
33
- };
34
- newEditor.onChange = () => {
35
- if (newEditor.readonly) return;
36
- const {
37
- document,
38
- config
39
- } = options;
40
- let operations = newEditor.operations;
41
- if (!newEditor.isRemote && operations.length > 0) {
42
- const isAllSetSelection = operations.every(operation => operation.type === 'set_selection');
43
- const socketManager = _socketManager.default.getInstance(newEditor, document, config);
44
- if (!isAllSetSelection) {
45
- // get update content value operations
46
- const updateOperations = operations.filter(operation => operation.type !== 'set_selection');
47
- socketManager.onReceiveLocalOperations(updateOperations);
48
- }
49
- socketManager.sendCursorLocation(editor.selection);
50
- }
51
-
52
- // dispatch editor change event
53
- const eventBus = _eventBus.default.getInstance(newEditor, document, config);
54
- eventBus.dispatch('change');
55
- onChange();
56
- };
57
- newEditor.rebaseContent = (document, originFileVersion) => {
58
- const {
59
- config
60
- } = options;
61
- const socketManager = _socketManager.default.getInstance(newEditor, document, config);
62
- socketManager.sendRebaseContent(document, originFileVersion);
63
- };
64
- newEditor.updateDocumentVersion = document => {
65
- const {
66
- config
67
- } = options;
68
- const socketManager = _socketManager.default.getInstance(newEditor, document, config);
69
- socketManager.updateDocumentVersion(document);
70
- };
71
- return newEditor;
72
- };
73
- var _default = exports.default = withSocketIO;