@seafile/sdoc-editor 0.1.157 → 0.1.159-beta10
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.
- package/dist/api/seafile-api.js +28 -9
- package/dist/basic-sdk/constants/index.js +25 -1
- package/dist/basic-sdk/editor/common-editor.js +50 -0
- package/dist/basic-sdk/editor/index.css +29 -0
- package/dist/basic-sdk/editor/index.js +132 -0
- package/dist/basic-sdk/{slate-editor.js → editor/slate-editor.js} +21 -16
- package/dist/basic-sdk/extension/constants/element-type.js +14 -9
- package/dist/basic-sdk/extension/constants/menus-config.js +27 -16
- package/dist/basic-sdk/extension/core/transforms/replace-node-children.js +26 -0
- package/dist/basic-sdk/extension/plugins/file-link/render-elem.css +4 -0
- package/dist/basic-sdk/extension/plugins/file-link/render-elem.js +1 -4
- package/dist/basic-sdk/extension/plugins/font/helpers.js +16 -12
- package/dist/basic-sdk/extension/plugins/html/rules/text.js +5 -5
- package/dist/basic-sdk/extension/plugins/markdown/plugin.js +4 -4
- package/dist/basic-sdk/extension/plugins/table/constants/index.js +5 -2
- package/dist/basic-sdk/extension/plugins/table/helpers.js +13 -8
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/cell-bg-color-menu.js +1 -1
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/cell-text-align-menu.js +3 -3
- package/dist/basic-sdk/extension/plugins/table/render/render-cell.js +2 -2
- package/dist/basic-sdk/extension/plugins/table/render/render-row.js +7 -9
- package/dist/basic-sdk/extension/plugins/table/render/table-header/rows-header/row-header.js +3 -3
- package/dist/basic-sdk/extension/plugins/text-style/plugin.js +3 -2
- package/dist/basic-sdk/extension/plugins/text-style/render-elem.js +20 -19
- package/dist/basic-sdk/extension/render/render-element.js +221 -1
- package/dist/basic-sdk/socket/helpers.js +2 -0
- package/dist/basic-sdk/socket/socket-client.js +58 -0
- package/dist/basic-sdk/socket/socket-manager.js +34 -2
- package/dist/basic-sdk/socket/with-socket-io.js +40 -12
- package/dist/basic-sdk/utils/diff.js +20 -19
- package/dist/basic-sdk/utils/rebase.js +193 -0
- package/dist/basic-sdk/views/diff-viewer.js +3 -1
- package/dist/basic-sdk/views/viewer.js +9 -12
- package/dist/components/doc-operations/index.js +4 -2
- package/dist/components/doc-operations/revision-operations/index.js +5 -2
- package/dist/components/doc-operations/revision-operations/publish-button.js +6 -13
- package/dist/components/tip-dialog/index.js +48 -0
- package/dist/components/tip-dialog/tip-content.js +47 -0
- package/dist/constants/index.js +26 -2
- package/dist/context.js +43 -9
- package/dist/pages/simple-editor.js +245 -88
- package/package.json +1 -1
- package/public/locales/en/sdoc-editor.json +12 -1
- package/public/locales/fr/sdoc-editor.json +154 -152
- package/public/locales/ru/sdoc-editor.json +50 -48
- package/public/locales/zh_CN/sdoc-editor.json +11 -1
- package/dist/basic-sdk/editor.js +0 -105
- package/dist/basic-sdk/extension/plugins/text-style/model.js +0 -11
|
@@ -119,6 +119,52 @@ var SocketClient = /*#__PURE__*/_createClass(function SocketClient(config) {
|
|
|
119
119
|
this.disconnectWithServer = function () {
|
|
120
120
|
_this.socket.disconnect();
|
|
121
121
|
};
|
|
122
|
+
this.sendPublishDocument = function (originDocUuid, originDocName, callback) {
|
|
123
|
+
_this.socket.emit('publish-document', _this.getParams({
|
|
124
|
+
origin_doc_uuid: originDocUuid,
|
|
125
|
+
origin_doc_name: originDocName
|
|
126
|
+
}), function (success) {
|
|
127
|
+
callback && callback(success);
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
this.receivePublishDocument = function () {
|
|
131
|
+
var socketManager = SocketManager.getInstance();
|
|
132
|
+
socketManager.receivePublishDocument();
|
|
133
|
+
};
|
|
134
|
+
this.receivePublishDocumentError = function () {
|
|
135
|
+
var socketManager = SocketManager.getInstance();
|
|
136
|
+
socketManager.receivePublishDocumentError();
|
|
137
|
+
};
|
|
138
|
+
this.sendReplaceDocument = function (document, callback) {
|
|
139
|
+
_this.socket.emit('replace-document', _this.getParams({
|
|
140
|
+
document: document
|
|
141
|
+
}), function (result) {
|
|
142
|
+
callback && callback(result);
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
this.receiveDocumentReplaced = function () {
|
|
146
|
+
var socketManager = SocketManager.getInstance();
|
|
147
|
+
socketManager.receiveDocumentReplaced();
|
|
148
|
+
};
|
|
149
|
+
this.receiveDocumentReplacedError = function () {
|
|
150
|
+
var socketManager = SocketManager.getInstance();
|
|
151
|
+
socketManager.receiveDocumentReplacedError();
|
|
152
|
+
};
|
|
153
|
+
this.sendSaveDocument = function (callback) {
|
|
154
|
+
_this.socket.emit('save-document', _this.getParams({
|
|
155
|
+
document: document
|
|
156
|
+
}), function (saveFlag) {
|
|
157
|
+
callback && callback(saveFlag);
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
this.receiveRemoveDocument = function () {
|
|
161
|
+
var socketManager = SocketManager.getInstance();
|
|
162
|
+
socketManager.receiveRemoveDocument();
|
|
163
|
+
};
|
|
164
|
+
this.receiveRemoveDocumentError = function () {
|
|
165
|
+
var socketManager = SocketManager.getInstance();
|
|
166
|
+
socketManager.receiveRemoveDocumentError();
|
|
167
|
+
};
|
|
122
168
|
this.config = config;
|
|
123
169
|
this.isReconnect = false;
|
|
124
170
|
this.socket = io(config.sdocServer, {
|
|
@@ -133,6 +179,18 @@ var SocketClient = /*#__PURE__*/_createClass(function SocketClient(config) {
|
|
|
133
179
|
this.socket.on('join-room', this.onJoinRoom);
|
|
134
180
|
this.socket.on('leave-room', this.onLeaveRoom);
|
|
135
181
|
this.socket.on('update-document', this.onReceiveRemoteOperations);
|
|
182
|
+
|
|
183
|
+
// doc replaced
|
|
184
|
+
this.socket.on('doc-replaced', this.receiveDocumentReplaced);
|
|
185
|
+
this.socket.on('doc-replaced-error', this.receiveDocumentReplacedError);
|
|
186
|
+
|
|
187
|
+
// doc published
|
|
188
|
+
this.socket.on('doc-published', this.receivePublishDocument);
|
|
189
|
+
this.socket.on('doc-published-error', this.receivePublishDocumentError);
|
|
190
|
+
|
|
191
|
+
// doc removed
|
|
192
|
+
this.socket.on('doc-removed', this.receiveRemoveDocument);
|
|
193
|
+
this.socket.on('doc-removed-error', this.receiveRemoveDocumentError);
|
|
136
194
|
this.socket.on('update-cursor', this.receiveCursorLocation);
|
|
137
195
|
this.socket.io.on('reconnect', this.onReconnect);
|
|
138
196
|
this.socket.io.on('reconnect_attempt', this.onReconnectAttempt);
|
|
@@ -7,6 +7,7 @@ import { syncRemoteOperations, reExecRevertOperationList, revertOperationList, s
|
|
|
7
7
|
import SocketClient from './socket-client';
|
|
8
8
|
import { clientDebug, conflictDebug, serverDebug, stateDebug } from '../utils/debug';
|
|
9
9
|
import { deleteCursor } from '../cursor/helper';
|
|
10
|
+
import { EXTERNAL_EVENT, MODE } from '../../constants';
|
|
10
11
|
|
|
11
12
|
// idle --> sending --> conflict --> idle
|
|
12
13
|
// --> conflict --> idle
|
|
@@ -19,13 +20,43 @@ var STATE = {
|
|
|
19
20
|
DISCONNECT: 'disconnect',
|
|
20
21
|
NEED_RELOAD: 'need_reload'
|
|
21
22
|
};
|
|
22
|
-
var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor,
|
|
23
|
+
var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, _document, config) {
|
|
23
24
|
var _this = this;
|
|
24
25
|
_classCallCheck(this, SocketManager);
|
|
25
26
|
this.getDocumentVersion = function () {
|
|
26
27
|
var version = _this.document.version;
|
|
27
28
|
return version;
|
|
28
29
|
};
|
|
30
|
+
this.sendPublishDocument = function (originDocUuid, originDocName, callback) {
|
|
31
|
+
_this.socketClient.sendPublishDocument(originDocUuid, originDocName, callback);
|
|
32
|
+
};
|
|
33
|
+
this.receivePublishDocument = function () {
|
|
34
|
+
_this.eventBus.dispatch(EXTERNAL_EVENT.PUBLISH_DOCUMENT);
|
|
35
|
+
};
|
|
36
|
+
this.receivePublishDocumentError = function () {
|
|
37
|
+
_this.eventBus.dispatch(EXTERNAL_EVENT.PUBLISH_DOCUMENT_ERROR);
|
|
38
|
+
};
|
|
39
|
+
this.receiveRemoveDocument = function () {
|
|
40
|
+
_this.eventBus.dispatch(EXTERNAL_EVENT.REMOVE_DOCUMENT);
|
|
41
|
+
};
|
|
42
|
+
this.receiveRemoveDocumentError = function () {
|
|
43
|
+
_this.eventBus.dispatch(EXTERNAL_EVENT.REMOVE_DOCUMENT_ERROR);
|
|
44
|
+
};
|
|
45
|
+
this.sendReplaceDocument = function (document) {
|
|
46
|
+
_this.socketClient.sendReplaceDocument(document, function (result) {
|
|
47
|
+
var serverVersion = result.version;
|
|
48
|
+
_this.document['version'] = serverVersion;
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
this.receiveDocumentReplaced = function () {
|
|
52
|
+
_this.eventBus.dispatch(EXTERNAL_EVENT.DOCUMENT_REPLACED);
|
|
53
|
+
};
|
|
54
|
+
this.receiveDocumentReplacedError = function () {
|
|
55
|
+
_this.eventBus.dispatch(EXTERNAL_EVENT.DOCUMENT_REPLACED_ERROR);
|
|
56
|
+
};
|
|
57
|
+
this.sendSaveDocument = function (callback) {
|
|
58
|
+
_this.socketClient.sendSaveDocument(callback);
|
|
59
|
+
};
|
|
29
60
|
this.onReceiveLocalOperations = function (operations) {
|
|
30
61
|
_this.pendingOperationList.push(operations);
|
|
31
62
|
if (_this.pendingOperationList.length > 5) {
|
|
@@ -34,6 +65,7 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
|
|
|
34
65
|
_this.sendOperations();
|
|
35
66
|
};
|
|
36
67
|
this.sendOperations = function () {
|
|
68
|
+
if (_this.editor.mode !== MODE.EDITOR) return;
|
|
37
69
|
if (_this.state !== STATE.IDLE) return;
|
|
38
70
|
stateDebug("State changed: ".concat(_this.state, " -> ").concat(STATE.SENDING));
|
|
39
71
|
_this.state = STATE.SENDING;
|
|
@@ -292,7 +324,7 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
|
|
|
292
324
|
_this.socketClient.disconnectWithServer();
|
|
293
325
|
};
|
|
294
326
|
this.editor = editor;
|
|
295
|
-
this.document =
|
|
327
|
+
this.document = _document;
|
|
296
328
|
this.socketClient = new SocketClient(config);
|
|
297
329
|
this.pendingOperationList = []; // Two-dimensional arrays: [operations, operations, ...]
|
|
298
330
|
this.remoteOperationsList = []; // Same with pending operations
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MODE } from '../../constants';
|
|
1
2
|
import { generateCursorData } from '../cursor/helper';
|
|
2
3
|
import EventBus from '../utils/event-bus';
|
|
3
4
|
import SocketManager from './socket-manager';
|
|
@@ -19,28 +20,55 @@ var withSocketIO = function withSocketIO(editor, options) {
|
|
|
19
20
|
SocketManager.destroy();
|
|
20
21
|
};
|
|
21
22
|
newEditor.onChange = function () {
|
|
22
|
-
|
|
23
|
+
var document = options.document,
|
|
24
|
+
config = options.config;
|
|
25
|
+
if (newEditor.mode === MODE.DIFF_VIEWER) return;
|
|
23
26
|
var operations = newEditor.operations;
|
|
24
27
|
if (!newEditor.isRemote && operations.length > 0) {
|
|
25
28
|
var isAllSetSelection = operations.every(function (operation) {
|
|
26
29
|
return operation.type === 'set_selection';
|
|
27
30
|
});
|
|
28
|
-
var _socketManager = SocketManager.getInstance();
|
|
31
|
+
var _socketManager = SocketManager.getInstance(newEditor, document, config);
|
|
29
32
|
if (!isAllSetSelection) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
if (newEditor.mode === MODE.EDITOR) {
|
|
34
|
+
// get update content value operations
|
|
35
|
+
var updateOperations = operations.filter(function (operation) {
|
|
36
|
+
return operation.type !== 'set_selection';
|
|
37
|
+
});
|
|
38
|
+
_socketManager.onReceiveLocalOperations(updateOperations);
|
|
39
|
+
}
|
|
35
40
|
}
|
|
36
|
-
|
|
41
|
+
if (newEditor.mode === MODE.EDITOR) {
|
|
42
|
+
_socketManager.sendCursorLocation(editor.selection);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (newEditor.mode === MODE.EDITOR) {
|
|
46
|
+
// dispatch editor change event
|
|
47
|
+
var eventBus = EventBus.getInstance(newEditor, document, config);
|
|
48
|
+
eventBus.dispatch('change');
|
|
37
49
|
}
|
|
38
|
-
|
|
39
|
-
// dispatch editor change event
|
|
40
|
-
var eventBus = EventBus.getInstance();
|
|
41
|
-
eventBus.dispatch('change');
|
|
42
50
|
onChange();
|
|
43
51
|
};
|
|
52
|
+
newEditor.rebaseContent = function (document, originFileVersion) {
|
|
53
|
+
var config = options.config;
|
|
54
|
+
var socketManager = SocketManager.getInstance(newEditor, document, config);
|
|
55
|
+
socketManager.sendRebaseContent(document, originFileVersion);
|
|
56
|
+
};
|
|
57
|
+
newEditor.publishDocument = function (originDocUuid, originDocName, callback) {
|
|
58
|
+
var config = options.config;
|
|
59
|
+
var socketManager = SocketManager.getInstance(newEditor, document, config);
|
|
60
|
+
socketManager.sendPublishDocument(originDocUuid, originDocName, callback);
|
|
61
|
+
};
|
|
62
|
+
newEditor.replaceDocument = function (document) {
|
|
63
|
+
var config = options.config;
|
|
64
|
+
var socketManager = SocketManager.getInstance(newEditor, document, config);
|
|
65
|
+
socketManager.sendReplaceDocument(document);
|
|
66
|
+
};
|
|
67
|
+
newEditor.saveDocument = function (callback) {
|
|
68
|
+
var config = options.config;
|
|
69
|
+
var socketManager = SocketManager.getInstance(newEditor, document, config);
|
|
70
|
+
socketManager.sendSaveDocument(callback);
|
|
71
|
+
};
|
|
44
72
|
return newEditor;
|
|
45
73
|
};
|
|
46
74
|
export default withSocketIO;
|
|
@@ -2,13 +2,13 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import slugid from 'slugid';
|
|
5
|
-
import { ELEMENT_TYPE, ADDED_STYLE, DELETED_STYLE } from '../../basic-sdk/extension/constants';
|
|
5
|
+
import { ELEMENT_TYPE, ADDED_STYLE, DELETED_STYLE, TEXT_STYLE_MAP } from '../../basic-sdk/extension/constants';
|
|
6
6
|
import ObjectUtils from './object-utils';
|
|
7
7
|
import DiffText from './diff-text';
|
|
8
8
|
import { normalizeChildren } from './document-utils';
|
|
9
9
|
|
|
10
10
|
// ignore
|
|
11
|
-
var IGNORE_KEYS = ['BOLD', 'ITALIC', 'columns', 'minHeight', 'language', 'white_space'];
|
|
11
|
+
var IGNORE_KEYS = ['BOLD', 'ITALIC', 'bold', 'italic', 'columns', 'minHeight', 'min_height', 'language', 'white_space'];
|
|
12
12
|
var generatorDiffTextElement = function generatorDiffTextElement(textElement, diffType) {
|
|
13
13
|
var style = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
14
14
|
if (!textElement) return null;
|
|
@@ -31,7 +31,7 @@ var generatorDiffElement = function generatorDiffElement(element, diffType) {
|
|
|
31
31
|
return generatorDiffElement(item, diffType, style);
|
|
32
32
|
})), _objectSpread3));
|
|
33
33
|
};
|
|
34
|
-
var generateIdMapAndIds = function generateIdMapAndIds(elements) {
|
|
34
|
+
export var generateIdMapAndIds = function generateIdMapAndIds(elements) {
|
|
35
35
|
var map = {};
|
|
36
36
|
var ids = [];
|
|
37
37
|
if (!Array.isArray(elements) || elements.length === 0) return {
|
|
@@ -54,7 +54,7 @@ var hasChildren = function hasChildren(element) {
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
// id diffs
|
|
57
|
-
var getIdDiffs = function getIdDiffs(oldIds, newIds) {
|
|
57
|
+
export var getIdDiffs = function getIdDiffs(oldIds, newIds) {
|
|
58
58
|
var diff = new DiffText(oldIds, newIds);
|
|
59
59
|
return diff.getDiffs();
|
|
60
60
|
};
|
|
@@ -74,11 +74,11 @@ var getTextDiff = function getTextDiff(element, oldElement, diff) {
|
|
|
74
74
|
};
|
|
75
75
|
if (item.added) {
|
|
76
76
|
diff.changes.push(id);
|
|
77
|
-
var commonChild = generatorDiffTextElement(elementItem,
|
|
77
|
+
var commonChild = generatorDiffTextElement(elementItem, TEXT_STYLE_MAP.ADD, ADDED_STYLE);
|
|
78
78
|
newChildren.push(commonChild);
|
|
79
79
|
} else if (item.removed) {
|
|
80
80
|
diff.changes.push(id);
|
|
81
|
-
var _commonChild = generatorDiffTextElement(elementItem,
|
|
81
|
+
var _commonChild = generatorDiffTextElement(elementItem, TEXT_STYLE_MAP.DELETE, DELETED_STYLE);
|
|
82
82
|
newChildren.push(_commonChild);
|
|
83
83
|
} else {
|
|
84
84
|
var _commonChild2 = generatorDiffTextElement(elementItem);
|
|
@@ -99,9 +99,9 @@ var getCommonDiff = function getCommonDiff(element, oldElement, diff) {
|
|
|
99
99
|
diff.changes.push("".concat(elementId, "_delete"));
|
|
100
100
|
return [generatorDiffElement(_objectSpread(_objectSpread({}, oldElement), {}, {
|
|
101
101
|
id: "".concat(elementId, "_delete")
|
|
102
|
-
}),
|
|
102
|
+
}), TEXT_STYLE_MAP.DELETE, DELETED_STYLE), generatorDiffElement(_objectSpread(_objectSpread({}, element), {}, {
|
|
103
103
|
id: "".concat(elementId, "_add")
|
|
104
|
-
}),
|
|
104
|
+
}), TEXT_STYLE_MAP.ADD, ADDED_STYLE)];
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// Content does not change
|
|
@@ -129,10 +129,10 @@ var getCommonDiff = function getCommonDiff(element, oldElement, diff) {
|
|
|
129
129
|
var oldChildrenElement = oldMap[id];
|
|
130
130
|
if (isAdded) {
|
|
131
131
|
diff.changes.push(id);
|
|
132
|
-
newChildren.push(generatorDiffElement(newChildrenElement,
|
|
132
|
+
newChildren.push(generatorDiffElement(newChildrenElement, TEXT_STYLE_MAP.ADD, ADDED_STYLE));
|
|
133
133
|
} else if (isDelete) {
|
|
134
134
|
diff.changes.push(id);
|
|
135
|
-
newChildren.push(generatorDiffElement(oldChildrenElement,
|
|
135
|
+
newChildren.push(generatorDiffElement(oldChildrenElement, TEXT_STYLE_MAP.DELETE, DELETED_STYLE));
|
|
136
136
|
} else {
|
|
137
137
|
if (ObjectUtils.isSameObject(newChildrenElement, oldChildrenElement, IGNORE_KEYS)) {
|
|
138
138
|
newChildren.push(newChildrenElement);
|
|
@@ -147,10 +147,10 @@ var getCommonDiff = function getCommonDiff(element, oldElement, diff) {
|
|
|
147
147
|
} else {
|
|
148
148
|
newChildren.push(generatorDiffTextElement(_objectSpread(_objectSpread({}, element), {}, {
|
|
149
149
|
id: element.id + '_add'
|
|
150
|
-
}),
|
|
150
|
+
}), TEXT_STYLE_MAP.ADD, ADDED_STYLE));
|
|
151
151
|
newChildren.push(generatorDiffTextElement(_objectSpread(_objectSpread({}, oldChildrenElement), {}, {
|
|
152
152
|
id: element.id + '_delete'
|
|
153
|
-
}),
|
|
153
|
+
}), TEXT_STYLE_MAP.DELETE, DELETED_STYLE));
|
|
154
154
|
}
|
|
155
155
|
} else if (newChildrenElement.type === ELEMENT_TYPE.LINK) {
|
|
156
156
|
if (newChildrenElement.title !== oldChildrenElement.title) {
|
|
@@ -160,10 +160,10 @@ var getCommonDiff = function getCommonDiff(element, oldElement, diff) {
|
|
|
160
160
|
diff.changes.push(oldChildrenElement.id + '_delete');
|
|
161
161
|
newChildren.push(generatorDiffTextElement(_objectSpread(_objectSpread({}, oldChildrenElement), {}, {
|
|
162
162
|
id: oldChildrenElement.id + '_delete'
|
|
163
|
-
}),
|
|
163
|
+
}), TEXT_STYLE_MAP.DELETE, DELETED_STYLE));
|
|
164
164
|
newChildren.push(generatorDiffTextElement(_objectSpread(_objectSpread({}, newChildrenElement), {}, {
|
|
165
165
|
id: newChildrenElement.id + '_add'
|
|
166
|
-
}),
|
|
166
|
+
}), TEXT_STYLE_MAP.ADD, ADDED_STYLE));
|
|
167
167
|
} else {
|
|
168
168
|
newChildren.push(newChildrenElement);
|
|
169
169
|
}
|
|
@@ -178,10 +178,10 @@ var getCommonDiff = function getCommonDiff(element, oldElement, diff) {
|
|
|
178
178
|
diff.changes.push(oldChildrenElement.id + '_delete');
|
|
179
179
|
newChildren.push(generatorDiffTextElement(_objectSpread(_objectSpread({}, oldChildrenElement), {}, {
|
|
180
180
|
id: oldChildrenElement.id + '_delete'
|
|
181
|
-
}),
|
|
181
|
+
}), TEXT_STYLE_MAP.DELETE, DELETED_STYLE));
|
|
182
182
|
newChildren.push(generatorDiffTextElement(_objectSpread(_objectSpread({}, newChildrenElement), {}, {
|
|
183
183
|
id: newChildrenElement.id + '_add'
|
|
184
|
-
}),
|
|
184
|
+
}), TEXT_STYLE_MAP.ADD, ADDED_STYLE));
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
}
|
|
@@ -228,14 +228,14 @@ var getElementDiffValue = function getElementDiffValue(currentContent, oldConten
|
|
|
228
228
|
elementIds.forEach(function (elementId) {
|
|
229
229
|
diff.changes.push(elementId);
|
|
230
230
|
var element = oldContentMap[elementId];
|
|
231
|
-
var diffElement = generatorDiffElement(element,
|
|
231
|
+
var diffElement = generatorDiffElement(element, TEXT_STYLE_MAP.DELETE, DELETED_STYLE);
|
|
232
232
|
diff.value.push(diffElement);
|
|
233
233
|
});
|
|
234
234
|
} else if (diffItem.added) {
|
|
235
235
|
elementIds.forEach(function (elementId) {
|
|
236
236
|
diff.changes.push(elementId);
|
|
237
237
|
var element = currentContentMap[elementId];
|
|
238
|
-
var diffElement = generatorDiffElement(element,
|
|
238
|
+
var diffElement = generatorDiffElement(element, TEXT_STYLE_MAP.ADD, ADDED_STYLE);
|
|
239
239
|
diff.value.push(diffElement);
|
|
240
240
|
});
|
|
241
241
|
} else {
|
|
@@ -288,4 +288,5 @@ export var getDiff = function getDiff() {
|
|
|
288
288
|
changes: []
|
|
289
289
|
};
|
|
290
290
|
return getElementDiffValue(currentContent, oldContent);
|
|
291
|
-
};
|
|
291
|
+
};
|
|
292
|
+
window.getIdDiffs = getIdDiffs;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
+
import { generateIdMapAndIds, getIdDiffs } from './diff';
|
|
5
|
+
import ObjectUtils from './object-utils';
|
|
6
|
+
import { MODIFY_TYPE, REBASE_TYPE, REBASE_MARK_KEY, REBASE_ORIGIN } from '../constants';
|
|
7
|
+
import { ELEMENT_TYPE } from '../extension/constants';
|
|
8
|
+
import { replaceNodeId } from '../node-id/helpers';
|
|
9
|
+
export var hasConflict = function hasConflict(content) {
|
|
10
|
+
if (!Array.isArray(content) || content.length === 0) return false;
|
|
11
|
+
return content.filter(function (item) {
|
|
12
|
+
return item.rebase_type;
|
|
13
|
+
}).length !== 0;
|
|
14
|
+
};
|
|
15
|
+
var getChanges = function getChanges(masterContent, revisionContent) {
|
|
16
|
+
var _generateIdMapAndIds = generateIdMapAndIds(masterContent.children),
|
|
17
|
+
masterContentMap = _generateIdMapAndIds.map,
|
|
18
|
+
masterIds = _generateIdMapAndIds.ids;
|
|
19
|
+
var _generateIdMapAndIds2 = generateIdMapAndIds(revisionContent.children),
|
|
20
|
+
currentContentMap = _generateIdMapAndIds2.map,
|
|
21
|
+
currentIds = _generateIdMapAndIds2.ids;
|
|
22
|
+
var idDiffs = getIdDiffs(masterIds, currentIds);
|
|
23
|
+
var content = [];
|
|
24
|
+
idDiffs.forEach(function (idDiff) {
|
|
25
|
+
var value = idDiff.value,
|
|
26
|
+
added = idDiff.added,
|
|
27
|
+
removed = idDiff.removed;
|
|
28
|
+
if (added) {
|
|
29
|
+
var addedList = value.map(function (item) {
|
|
30
|
+
return _objectSpread(_objectSpread({}, currentContentMap[item]), {}, _defineProperty({}, REBASE_MARK_KEY.MODIFY_TYPE, MODIFY_TYPE.ADD));
|
|
31
|
+
});
|
|
32
|
+
content.push.apply(content, _toConsumableArray(addedList));
|
|
33
|
+
} else if (removed) {
|
|
34
|
+
var deletedList = value.map(function (item) {
|
|
35
|
+
return _objectSpread(_objectSpread({}, masterContentMap[item]), {}, _defineProperty({}, REBASE_MARK_KEY.MODIFY_TYPE, MODIFY_TYPE.DELETE));
|
|
36
|
+
});
|
|
37
|
+
content.push.apply(content, _toConsumableArray(deletedList));
|
|
38
|
+
} else {
|
|
39
|
+
value.forEach(function (elementId) {
|
|
40
|
+
if (ObjectUtils.isSameObject(masterContentMap[elementId], currentContentMap[elementId])) {
|
|
41
|
+
content.push(currentContentMap[elementId]);
|
|
42
|
+
} else {
|
|
43
|
+
var _objectSpread4;
|
|
44
|
+
var oldElement = masterContentMap[elementId];
|
|
45
|
+
var currentElement = currentContentMap[elementId];
|
|
46
|
+
var newElement = _objectSpread(_objectSpread({}, currentElement), {}, (_objectSpread4 = {}, _defineProperty(_objectSpread4, REBASE_MARK_KEY.MODIFY_TYPE, MODIFY_TYPE.MODIFY), _defineProperty(_objectSpread4, REBASE_MARK_KEY.OLD_ELEMENT, oldElement), _objectSpread4));
|
|
47
|
+
if (currentElement.type === oldElement.type) {
|
|
48
|
+
var elementType = currentElement.type;
|
|
49
|
+
if ([ELEMENT_TYPE.UNORDERED_LIST, ELEMENT_TYPE.ORDERED_LIST].includes(elementType)) {
|
|
50
|
+
var listContent = getChanges(oldElement, currentElement);
|
|
51
|
+
newElement[REBASE_MARK_KEY.MODIFY_TYPE] = MODIFY_TYPE.CHILDREN_MODIFY;
|
|
52
|
+
newElement['children'] = listContent;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
content.push(newElement);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return content;
|
|
61
|
+
};
|
|
62
|
+
var getMergeElement = function getMergeElement(diffElement, basicElement) {
|
|
63
|
+
var modifyType = diffElement[REBASE_MARK_KEY.MODIFY_TYPE];
|
|
64
|
+
var newElement = _objectSpread({}, diffElement);
|
|
65
|
+
newElement[REBASE_MARK_KEY.MODIFY_TYPE] && delete newElement[REBASE_MARK_KEY.MODIFY_TYPE];
|
|
66
|
+
|
|
67
|
+
// revision does not have this element, master has this element
|
|
68
|
+
if (modifyType === MODIFY_TYPE.DELETE) {
|
|
69
|
+
// basic content does not have this element, indicating that it is newly added by master and needs to be retained, and will not be counted as a conflict.
|
|
70
|
+
if (!basicElement) return [newElement];
|
|
71
|
+
|
|
72
|
+
// basic content has this element, master modified it, indicating that revision deleted it, and the user manually selected the conflict
|
|
73
|
+
if (!ObjectUtils.isSameObject(basicElement, diffElement, [REBASE_MARK_KEY.MODIFY_TYPE])) {
|
|
74
|
+
newElement[REBASE_MARK_KEY.REBASE_TYPE] = REBASE_TYPE.MODIFY_DELETE;
|
|
75
|
+
return [newElement];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// basic content has this element, but master has not modified it. It means that revision has deleted it and the program has deleted it. The conflict will not be counted.
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// revision has this element, master does not have this element
|
|
83
|
+
if (modifyType === MODIFY_TYPE.ADD) {
|
|
84
|
+
// basic content does not have this element, indicating that it is newly added by revision and needs to be retained, and will not be counted as a conflict.
|
|
85
|
+
if (!basicElement) return [newElement];
|
|
86
|
+
|
|
87
|
+
// master deleted it, revision modified it, and the user manually selected the conflict
|
|
88
|
+
if (!ObjectUtils.isSameObject(basicElement, diffElement, [REBASE_MARK_KEY.MODIFY_TYPE])) {
|
|
89
|
+
newElement[REBASE_MARK_KEY.REBASE_TYPE] = REBASE_TYPE.DELETE_MODIFY;
|
|
90
|
+
return [newElement];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// master deleted it, revision did not modify it, the program deleted it, and the conflict is not counted.
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Elements that differ between revision and master
|
|
98
|
+
if (modifyType === MODIFY_TYPE.MODIFY) {
|
|
99
|
+
var _objectSpread7, _objectSpread8;
|
|
100
|
+
var masterElement = _objectSpread({}, diffElement[REBASE_MARK_KEY.OLD_ELEMENT]);
|
|
101
|
+
delete newElement[REBASE_MARK_KEY.OLD_ELEMENT];
|
|
102
|
+
|
|
103
|
+
// revision and master both add a new element, but the content is different. ===》 At present, this situation does not exist, it only exists in the theoretical stage.
|
|
104
|
+
if (!basicElement) {
|
|
105
|
+
var _objectSpread5, _objectSpread6;
|
|
106
|
+
return [_objectSpread(_objectSpread({}, replaceNodeId(masterElement)), {}, (_objectSpread5 = {}, _defineProperty(_objectSpread5, REBASE_MARK_KEY.REBASE_TYPE, REBASE_TYPE.MODIFY_MODIFY), _defineProperty(_objectSpread5, REBASE_MARK_KEY.OLD_ELEMENT, masterElement), _defineProperty(_objectSpread5, REBASE_MARK_KEY.ORIGIN, REBASE_ORIGIN.OTHER), _objectSpread5)), _objectSpread(_objectSpread({}, newElement), {}, (_objectSpread6 = {}, _defineProperty(_objectSpread6, REBASE_MARK_KEY.REBASE_TYPE, REBASE_TYPE.MODIFY_MODIFY), _defineProperty(_objectSpread6, REBASE_MARK_KEY.ORIGIN, REBASE_ORIGIN.MY), _objectSpread6))];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// master is the same as base, indicating that revision has modified the content
|
|
110
|
+
if (ObjectUtils.isSameObject(masterElement, basicElement)) return [newElement];
|
|
111
|
+
|
|
112
|
+
// revision is the same as base, indicating that master has modified the content
|
|
113
|
+
if (ObjectUtils.isSameObject(newElement, basicElement)) return [masterElement];
|
|
114
|
+
|
|
115
|
+
// They are all different. Revision and master were modified at the same time. If there is a conflict, the conflict needs to be resolved manually.
|
|
116
|
+
return [_objectSpread(_objectSpread({}, replaceNodeId(masterElement)), {}, (_objectSpread7 = {}, _defineProperty(_objectSpread7, REBASE_MARK_KEY.REBASE_TYPE, REBASE_TYPE.MODIFY_MODIFY), _defineProperty(_objectSpread7, REBASE_MARK_KEY.OLD_ELEMENT, masterElement), _defineProperty(_objectSpread7, REBASE_MARK_KEY.ORIGIN, REBASE_ORIGIN.OTHER), _objectSpread7)), _objectSpread(_objectSpread({}, newElement), {}, (_objectSpread8 = {}, _defineProperty(_objectSpread8, REBASE_MARK_KEY.REBASE_TYPE, REBASE_TYPE.MODIFY_MODIFY), _defineProperty(_objectSpread8, REBASE_MARK_KEY.ORIGIN, REBASE_ORIGIN.MY), _objectSpread8))];
|
|
117
|
+
}
|
|
118
|
+
if (modifyType === MODIFY_TYPE.CHILDREN_MODIFY) {
|
|
119
|
+
var _masterElement = _objectSpread({}, diffElement[REBASE_MARK_KEY.OLD_ELEMENT]);
|
|
120
|
+
delete newElement[REBASE_MARK_KEY.OLD_ELEMENT];
|
|
121
|
+
|
|
122
|
+
// revision and master both add a new element, but the content is different. ===》 At present, this situation does not exist, it only exists in the theoretical stage.
|
|
123
|
+
if (!basicElement) {
|
|
124
|
+
var _objectSpread9, _objectSpread10;
|
|
125
|
+
return [_objectSpread(_objectSpread({}, replaceNodeId(_masterElement)), {}, (_objectSpread9 = {}, _defineProperty(_objectSpread9, REBASE_MARK_KEY.REBASE_TYPE, REBASE_TYPE.MODIFY_MODIFY), _defineProperty(_objectSpread9, REBASE_MARK_KEY.OLD_ELEMENT, _masterElement), _defineProperty(_objectSpread9, REBASE_MARK_KEY.ORIGIN, REBASE_ORIGIN.OTHER), _objectSpread9)), _objectSpread(_objectSpread({}, newElement), {}, (_objectSpread10 = {}, _defineProperty(_objectSpread10, REBASE_MARK_KEY.REBASE_TYPE, REBASE_TYPE.MODIFY_MODIFY), _defineProperty(_objectSpread10, REBASE_MARK_KEY.ORIGIN, REBASE_ORIGIN.MY), _objectSpread10))];
|
|
126
|
+
}
|
|
127
|
+
if (ObjectUtils.isSameObject(_masterElement, basicElement)) return [newElement];
|
|
128
|
+
if (ObjectUtils.isSameObject(newElement, basicElement)) return [_masterElement];
|
|
129
|
+
if (ObjectUtils.isSameObject(_masterElement, newElement, ['type'])) {
|
|
130
|
+
if (ObjectUtils.isSameObject(_masterElement, basicElement, ['type'])) return [newElement];
|
|
131
|
+
if (ObjectUtils.isSameObject(newElement, basicElement, ['type'])) return [_masterElement];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// The content of the subnode has changed and needs to be solved manually.
|
|
135
|
+
var _getMergeContent = getMergeContent(basicElement, diffElement.children),
|
|
136
|
+
childrenContent = _getMergeContent.content;
|
|
137
|
+
return [_objectSpread(_objectSpread({}, newElement), {}, _defineProperty({
|
|
138
|
+
children: childrenContent
|
|
139
|
+
}, REBASE_MARK_KEY.REBASE_TYPE, REBASE_TYPE.CHILDREN_MODIFY))];
|
|
140
|
+
}
|
|
141
|
+
newElement[REBASE_MARK_KEY.OLD_ELEMENT] && delete newElement[REBASE_MARK_KEY.OLD_ELEMENT];
|
|
142
|
+
return [newElement];
|
|
143
|
+
};
|
|
144
|
+
var getMergeContent = function getMergeContent(basicContent, diffChanges) {
|
|
145
|
+
var _generateIdMapAndIds3 = generateIdMapAndIds(diffChanges),
|
|
146
|
+
diffChangesContentMap = _generateIdMapAndIds3.map,
|
|
147
|
+
diffChangesContentIds = _generateIdMapAndIds3.ids;
|
|
148
|
+
var _generateIdMapAndIds4 = generateIdMapAndIds(basicContent.children),
|
|
149
|
+
baseContentMap = _generateIdMapAndIds4.map;
|
|
150
|
+
var content = [];
|
|
151
|
+
diffChangesContentIds.forEach(function (elementId) {
|
|
152
|
+
var diffElement = diffChangesContentMap[elementId];
|
|
153
|
+
var basicElement = baseContentMap[elementId];
|
|
154
|
+
var mergeElements = getMergeElement(diffElement, basicElement);
|
|
155
|
+
content.push.apply(content, _toConsumableArray(mergeElements));
|
|
156
|
+
});
|
|
157
|
+
var canMerge = !hasConflict(content);
|
|
158
|
+
return {
|
|
159
|
+
content: content,
|
|
160
|
+
canMerge: canMerge
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
export var getRebase = function getRebase(masterContent, basicContent, revisionContent) {
|
|
164
|
+
// master no changes, merged directly
|
|
165
|
+
if (masterContent.version === basicContent.version) {
|
|
166
|
+
return {
|
|
167
|
+
canMerge: true,
|
|
168
|
+
isNeedReplaceMaster: true,
|
|
169
|
+
value: revisionContent
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// The revision content has not changed
|
|
174
|
+
if (basicContent.version === revisionContent.version) {
|
|
175
|
+
return {
|
|
176
|
+
canMerge: true,
|
|
177
|
+
isNeedReplaceMaster: false,
|
|
178
|
+
value: masterContent
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
var diffChanges = getChanges(masterContent, revisionContent);
|
|
182
|
+
var _getMergeContent2 = getMergeContent(basicContent, diffChanges),
|
|
183
|
+
canMerge = _getMergeContent2.canMerge,
|
|
184
|
+
content = _getMergeContent2.content;
|
|
185
|
+
return {
|
|
186
|
+
canMerge: canMerge,
|
|
187
|
+
isNeedReplaceMaster: true,
|
|
188
|
+
value: _objectSpread(_objectSpread({}, revisionContent), {}, {
|
|
189
|
+
children: content,
|
|
190
|
+
version: Math.max(masterContent.version, revisionContent.version) + 1
|
|
191
|
+
})
|
|
192
|
+
};
|
|
193
|
+
};
|
|
@@ -6,7 +6,8 @@ import { ELEMENT_TYPE, ADDED_STYLE, DELETED_STYLE } from '../extension/constants
|
|
|
6
6
|
import SDocViewer from './viewer';
|
|
7
7
|
import '../../assets/css/diff-viewer.css';
|
|
8
8
|
var DiffViewer = function DiffViewer(_ref) {
|
|
9
|
-
var
|
|
9
|
+
var editor = _ref.editor,
|
|
10
|
+
currentContent = _ref.currentContent,
|
|
10
11
|
lastContent = _ref.lastContent,
|
|
11
12
|
didMountCallback = _ref.didMountCallback,
|
|
12
13
|
showToolbar = _ref.showToolbar,
|
|
@@ -38,6 +39,7 @@ var DiffViewer = function DiffViewer(_ref) {
|
|
|
38
39
|
return renderElement(props, editor);
|
|
39
40
|
}, []);
|
|
40
41
|
return /*#__PURE__*/React.createElement(SDocViewer, {
|
|
42
|
+
editor: editor,
|
|
41
43
|
showToolbar: showToolbar,
|
|
42
44
|
showOutline: showOutline,
|
|
43
45
|
document: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Fragment
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
2
|
import { Editable, Slate } from '@seafile/slate-react';
|
|
3
3
|
import { renderLeaf as _renderLeaf, renderElement as _renderElement, createDefaultEditor } from '../extension';
|
|
4
4
|
import withNodeId from '../node-id';
|
|
@@ -8,18 +8,15 @@ import { usePipDecorate } from '../decorates';
|
|
|
8
8
|
import { ArticleContainer, EditorContainer, EditorContent } from '../layout';
|
|
9
9
|
import '../assets/css/simple-viewer.css';
|
|
10
10
|
var SDocViewer = function SDocViewer(_ref) {
|
|
11
|
-
var
|
|
11
|
+
var editor = _ref.editor,
|
|
12
|
+
document = _ref.document,
|
|
12
13
|
customRenderLeaf = _ref.renderLeaf,
|
|
13
14
|
customRenderElement = _ref.renderElement,
|
|
14
15
|
showToolbar = _ref.showToolbar,
|
|
15
16
|
showOutline = _ref.showOutline;
|
|
16
|
-
var
|
|
17
|
-
var defaultEditor = createDefaultEditor();
|
|
18
|
-
return withNodeId(defaultEditor);
|
|
19
|
-
}, []);
|
|
20
|
-
editor.readonly = true;
|
|
17
|
+
var validEditor = editor || withNodeId(createDefaultEditor());
|
|
21
18
|
var slateValue = (document || generateDefaultDocContent()).children;
|
|
22
|
-
var decorate = usePipDecorate(
|
|
19
|
+
var decorate = usePipDecorate(validEditor);
|
|
23
20
|
return /*#__PURE__*/React.createElement(EditorContainer, {
|
|
24
21
|
editor: editor,
|
|
25
22
|
showToolbar: showToolbar,
|
|
@@ -29,19 +26,19 @@ var SDocViewer = function SDocViewer(_ref) {
|
|
|
29
26
|
readonly: true,
|
|
30
27
|
showOutline: showOutline
|
|
31
28
|
}, /*#__PURE__*/React.createElement(Slate, {
|
|
32
|
-
editor:
|
|
29
|
+
editor: validEditor,
|
|
33
30
|
value: slateValue
|
|
34
31
|
}, /*#__PURE__*/React.createElement(ArticleContainer, {
|
|
35
|
-
editor:
|
|
32
|
+
editor: validEditor,
|
|
36
33
|
readOnly: true
|
|
37
34
|
}, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(SetNodeToDecorations, null), /*#__PURE__*/React.createElement(Editable, {
|
|
38
35
|
readOnly: true,
|
|
39
36
|
placeholder: "",
|
|
40
37
|
renderElement: function renderElement(props) {
|
|
41
|
-
return (customRenderElement || _renderElement)(props,
|
|
38
|
+
return (customRenderElement || _renderElement)(props, validEditor);
|
|
42
39
|
},
|
|
43
40
|
renderLeaf: function renderLeaf(props) {
|
|
44
|
-
return (customRenderLeaf || _renderLeaf)(props,
|
|
41
|
+
return (customRenderLeaf || _renderLeaf)(props, validEditor);
|
|
45
42
|
},
|
|
46
43
|
onDOMBeforeInput: function onDOMBeforeInput(event) {},
|
|
47
44
|
decorate: decorate
|
|
@@ -11,14 +11,16 @@ import './style.css';
|
|
|
11
11
|
var DocOperations = function DocOperations(_ref) {
|
|
12
12
|
var isShowChanges = _ref.isShowChanges,
|
|
13
13
|
changes = _ref.changes,
|
|
14
|
-
toggleViewChanges = _ref.toggleViewChanges
|
|
14
|
+
toggleViewChanges = _ref.toggleViewChanges,
|
|
15
|
+
publishRevision = _ref.publishRevision;
|
|
15
16
|
var isSdocRevision = context.getSetting('isSdocRevision');
|
|
16
17
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
18
|
className: "doc-ops"
|
|
18
19
|
}, /*#__PURE__*/React.createElement(RevisionOperations, {
|
|
19
20
|
isShowChanges: isShowChanges,
|
|
20
21
|
changes: changes,
|
|
21
|
-
toggleViewChanges: toggleViewChanges
|
|
22
|
+
toggleViewChanges: toggleViewChanges,
|
|
23
|
+
publishRevision: publishRevision
|
|
22
24
|
}), /*#__PURE__*/React.createElement(CommentsOperation, null), !isSdocRevision && /*#__PURE__*/React.createElement(ShareOperation, null), /*#__PURE__*/React.createElement(HistoryOperation, null), /*#__PURE__*/React.createElement(CollaboratorsOperation, null), !isSdocRevision && /*#__PURE__*/React.createElement(MoreOperations, null));
|
|
23
25
|
};
|
|
24
26
|
export default withTranslation('sdoc-editor')(DocOperations);
|
|
@@ -8,7 +8,8 @@ import ChangesCount from './changes-count';
|
|
|
8
8
|
var RevisionOperations = function RevisionOperations(_ref) {
|
|
9
9
|
var isShowChanges = _ref.isShowChanges,
|
|
10
10
|
changes = _ref.changes,
|
|
11
|
-
toggleViewChanges = _ref.toggleViewChanges
|
|
11
|
+
toggleViewChanges = _ref.toggleViewChanges,
|
|
12
|
+
publishRevision = _ref.publishRevision;
|
|
12
13
|
var isSdocRevision = context.getSetting('isSdocRevision');
|
|
13
14
|
var isPublished = context.getSetting('isPublished');
|
|
14
15
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !isSdocRevision && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MoreRevisionOperations, null), /*#__PURE__*/React.createElement(Revisions, null)), isSdocRevision && isShowChanges && /*#__PURE__*/React.createElement(ChangesCount, {
|
|
@@ -16,6 +17,8 @@ var RevisionOperations = function RevisionOperations(_ref) {
|
|
|
16
17
|
}), isSdocRevision && /*#__PURE__*/React.createElement(ViewChanges, {
|
|
17
18
|
isShowChanges: isShowChanges,
|
|
18
19
|
toggleViewChanges: toggleViewChanges
|
|
19
|
-
}), isSdocRevision && !isPublished && /*#__PURE__*/React.createElement(PublishRevision,
|
|
20
|
+
}), isSdocRevision && !isPublished && /*#__PURE__*/React.createElement(PublishRevision, {
|
|
21
|
+
publishRevision: publishRevision
|
|
22
|
+
}));
|
|
20
23
|
};
|
|
21
24
|
export default RevisionOperations;
|