@seafile/sdoc-editor 0.1.148-beta → 0.1.149-beta
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/basic-sdk/comment/comment/comment-item-content.js +5 -0
- package/dist/basic-sdk/comment/comment/comment-item-reply.js +3 -0
- package/dist/basic-sdk/comment/comment/global-comment-header.js +5 -2
- package/dist/basic-sdk/comment/comment/global-comment.js +1 -1
- package/dist/basic-sdk/comment/comment/style.css +6 -5
- package/dist/basic-sdk/constants/index.js +7 -1
- package/dist/basic-sdk/extension/render/render-element.js +19 -15
- package/dist/basic-sdk/socket/socket-client.js +1 -1
- package/dist/basic-sdk/utils/rebase.js +27 -43
- package/dist/basic-sdk/views/viewer.js +1 -1
- package/dist/components/tip-dialog/index.js +0 -1
- package/dist/components/tip-dialog/tip-content.js +5 -11
- package/dist/pages/simple-editor.js +20 -12
- package/package.json +1 -1
- package/public/media/sdoc-editor-font/iconfont.eot +0 -0
- package/public/media/sdoc-editor-font/iconfont.svg +4 -0
- package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
- package/public/media/sdoc-editor-font.css +14 -6
- package/dist/components/tip-dialog/index.css +0 -0
|
@@ -106,17 +106,22 @@ var CommentItem = function CommentItem(_ref) {
|
|
|
106
106
|
}, /*#__PURE__*/React.createElement("i", {
|
|
107
107
|
className: "sdocfont sdoc-more-options"
|
|
108
108
|
})), /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
109
|
+
className: "sdoc-dropdown-menu",
|
|
109
110
|
container: container
|
|
110
111
|
}, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
112
|
+
className: "sdoc-dropdown-menu-item",
|
|
111
113
|
tag: "div",
|
|
112
114
|
onClick: onEditToggle
|
|
113
115
|
}, t('Edit')), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
116
|
+
className: "sdoc-dropdown-menu-item",
|
|
114
117
|
tag: "div",
|
|
115
118
|
onClick: onDeleteToggle
|
|
116
119
|
}, t('Delete')), !comment.resolved && /*#__PURE__*/React.createElement(DropdownItem, {
|
|
120
|
+
className: "sdoc-dropdown-menu-item",
|
|
117
121
|
tag: "div",
|
|
118
122
|
onClick: markAsResolved
|
|
119
123
|
}, t('Mark_as_Resolved')), comment.resolved && /*#__PURE__*/React.createElement(DropdownItem, {
|
|
124
|
+
className: "sdoc-dropdown-menu-item",
|
|
120
125
|
tag: "div",
|
|
121
126
|
onClick: resubmit
|
|
122
127
|
}, t('Resubmit')))))), /*#__PURE__*/React.createElement("div", {
|
|
@@ -77,11 +77,14 @@ var CommentItemReply = function CommentItemReply(_ref) {
|
|
|
77
77
|
}, /*#__PURE__*/React.createElement("i", {
|
|
78
78
|
className: "sdocfont sdoc-more-options"
|
|
79
79
|
})), /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
80
|
+
className: "sdoc-dropdown-menu",
|
|
80
81
|
container: container
|
|
81
82
|
}, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
83
|
+
className: "sdoc-dropdown-menu-item",
|
|
82
84
|
tag: "div",
|
|
83
85
|
onClick: onEditToggle
|
|
84
86
|
}, t('Edit')), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
87
|
+
className: "sdoc-dropdown-menu-item",
|
|
85
88
|
tag: "div",
|
|
86
89
|
onClick: onDeleteToggle
|
|
87
90
|
}, t('Delete')))))), /*#__PURE__*/React.createElement("div", {
|
|
@@ -42,19 +42,22 @@ function GlobalCommentHeader(_ref) {
|
|
|
42
42
|
}, /*#__PURE__*/React.createElement("div", {
|
|
43
43
|
id: id
|
|
44
44
|
}, t(commentType))), /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
className: "sdoc-dropdown-menu",
|
|
46
|
+
container: "comment-types"
|
|
47
47
|
}, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
48
|
+
className: "sdoc-dropdown-menu-item",
|
|
48
49
|
tag: 'div',
|
|
49
50
|
onClick: function onClick() {
|
|
50
51
|
return onCommentTypeChanged(COMMENT_TYPES.all);
|
|
51
52
|
}
|
|
52
53
|
}, t(COMMENT_TYPES.all)), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
54
|
+
className: "sdoc-dropdown-menu-item",
|
|
53
55
|
tag: 'div',
|
|
54
56
|
onClick: function onClick() {
|
|
55
57
|
return onCommentTypeChanged(COMMENT_TYPES.resolved);
|
|
56
58
|
}
|
|
57
59
|
}, t(COMMENT_TYPES.resolved)), /*#__PURE__*/React.createElement(DropdownItem, {
|
|
60
|
+
className: "sdoc-dropdown-menu-item",
|
|
58
61
|
tag: 'div',
|
|
59
62
|
onClick: function onClick() {
|
|
60
63
|
return onCommentTypeChanged(COMMENT_TYPES.unresolved);
|
|
@@ -67,7 +67,7 @@ var GlobalComment = function GlobalComment(_ref) {
|
|
|
67
67
|
return setShowCommentList(false);
|
|
68
68
|
}
|
|
69
69
|
}, /*#__PURE__*/React.createElement("i", {
|
|
70
|
-
className: "sdocfont sdoc-close"
|
|
70
|
+
className: "sdocfont sdoc-sm-close"
|
|
71
71
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
72
72
|
className: "comments-panel-body"
|
|
73
73
|
}, /*#__PURE__*/React.createElement(GlobalCommentHeader, {
|
|
@@ -73,17 +73,17 @@
|
|
|
73
73
|
font-weight: 500;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
.global-comments-popover .comments-panel-header .sdoc-close {
|
|
76
|
+
.global-comments-popover .comments-panel-header .sdoc-sm-close {
|
|
77
77
|
display: flex;
|
|
78
78
|
align-items: center;
|
|
79
79
|
justify-content: center;
|
|
80
|
-
font-size:
|
|
80
|
+
font-size: 16px;
|
|
81
81
|
font-weight: 700;
|
|
82
82
|
color: #999;
|
|
83
83
|
cursor: pointer;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
.global-comments-popover .comments-panel-header .sdoc-close:hover {
|
|
86
|
+
.global-comments-popover .comments-panel-header .sdoc-sm-close:hover {
|
|
87
87
|
color: #5a5a5a;
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -145,6 +145,7 @@
|
|
|
145
145
|
background: #f5f5f5;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
.sdoc-
|
|
149
|
-
font-size:
|
|
148
|
+
.sdoc-dropdown-menu .dropdown-item {
|
|
149
|
+
font-size: 14px;
|
|
150
|
+
color: #212529;
|
|
150
151
|
}
|
|
@@ -18,4 +18,10 @@ export var REBASE_TYPE = {
|
|
|
18
18
|
DELETE_MODIFY: 'delete-modify',
|
|
19
19
|
CHILDREN_MODIFY: 'children-modify'
|
|
20
20
|
};
|
|
21
|
-
export var
|
|
21
|
+
export var REBASE_MARK_KEY = {
|
|
22
|
+
ORIGIN: 'origin',
|
|
23
|
+
REBASE_TYPE: 'rebase_type',
|
|
24
|
+
MODIFY_TYPE: 'modify_type',
|
|
25
|
+
OLD_ELEMENT: 'old_element'
|
|
26
|
+
};
|
|
27
|
+
export var REBASE_MARKS = ['origin', 'rebase_type', 'old_element'];
|
|
@@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
9
9
|
import { BLOCKQUOTE, LINK, CHECK_LIST_ITEM, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, LIST_ITEM, LIST_LIC, ORDERED_LIST, PARAGRAPH, UNORDERED_LIST, CODE_BLOCK, CODE_LINE, IMAGE, ELEMENT_TYPE, SDOC_LINK, TITLE, SUBTITLE } from '../constants';
|
|
10
10
|
import { BlockquotePlugin, LinkPlugin, CheckListPlugin, HeaderPlugin, ListPlugin, CodeBlockPlugin, ImagePlugin, TablePlugin, SdocLinkPlugin, ParagraphPlugin } from '../plugins';
|
|
11
11
|
import EventBus from '../../utils/event-bus';
|
|
12
|
-
import { INTERNAL_EVENT, REBASE_TYPE, REBASE_MARKS } from '../../constants';
|
|
12
|
+
import { INTERNAL_EVENT, REBASE_TYPE, REBASE_MARKS, REBASE_MARK_KEY } from '../../constants';
|
|
13
13
|
import { findPath, getNode, replaceNode, generateEmptyElement, deleteNodeMark } from '../../extension/core';
|
|
14
14
|
var CustomElement = function CustomElement(props) {
|
|
15
15
|
var editor = useSlateStatic();
|
|
@@ -153,16 +153,16 @@ var RenderElement = function RenderElement(props) {
|
|
|
153
153
|
var parentPath = path.slice(0, -1);
|
|
154
154
|
var parentNode = getNode(editor, parentPath);
|
|
155
155
|
if (parentNode.children.filter(function (item) {
|
|
156
|
-
return item.
|
|
156
|
+
return item[REBASE_MARK_KEY.REBASE_TYPE];
|
|
157
157
|
}).length === 0) {
|
|
158
158
|
var newParentElement = _objectSpread({}, parentNode);
|
|
159
|
-
newParentElement[
|
|
160
|
-
newParentElement[
|
|
161
|
-
newParentElement[
|
|
159
|
+
newParentElement[REBASE_MARK_KEY.REBASE_TYPE] && delete newParentElement[REBASE_MARK_KEY.REBASE_TYPE];
|
|
160
|
+
newParentElement[REBASE_MARK_KEY.OLD_ELEMENT] && delete newParentElement[REBASE_MARK_KEY.OLD_ELEMENT];
|
|
161
|
+
newParentElement[REBASE_MARK_KEY.ORIGIN] && delete newParentElement[REBASE_MARK_KEY.ORIGIN];
|
|
162
162
|
newParentElement['children'] = newParentElement['children'].map(function (item) {
|
|
163
|
-
item[
|
|
164
|
-
item[
|
|
165
|
-
item[
|
|
163
|
+
item[REBASE_MARK_KEY.REBASE_TYPE] && delete item[REBASE_MARK_KEY.REBASE_TYPE];
|
|
164
|
+
item[REBASE_MARK_KEY.OLD_ELEMENT] && delete item[REBASE_MARK_KEY.OLD_ELEMENT];
|
|
165
|
+
item[REBASE_MARK_KEY.ORIGIN] && delete item[REBASE_MARK_KEY.ORIGIN];
|
|
166
166
|
return item;
|
|
167
167
|
});
|
|
168
168
|
replaceNode(editor, {
|
|
@@ -268,10 +268,11 @@ var RenderElement = function RenderElement(props) {
|
|
|
268
268
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
269
269
|
}, [editor]);
|
|
270
270
|
var element = props.element;
|
|
271
|
-
|
|
271
|
+
var rebaseType = element[REBASE_MARK_KEY.REBASE_TYPE];
|
|
272
|
+
if (!rebaseType) {
|
|
272
273
|
return /*#__PURE__*/React.createElement(CustomElement, props);
|
|
273
274
|
}
|
|
274
|
-
if (
|
|
275
|
+
if (rebaseType === REBASE_TYPE.DELETE_MODIFY) {
|
|
275
276
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
276
277
|
className: "w-100 d-flex sdoc-rebase-btn-group",
|
|
277
278
|
contentEditable: false
|
|
@@ -301,14 +302,15 @@ var RenderElement = function RenderElement(props) {
|
|
|
301
302
|
className: "w-100",
|
|
302
303
|
contentEditable: false
|
|
303
304
|
}, '======='), /*#__PURE__*/React.createElement("div", {
|
|
304
|
-
className: "w-100 sdoc-rebase-incoming-changes"
|
|
305
|
+
className: "w-100 sdoc-rebase-incoming-changes",
|
|
306
|
+
contentEditable: false
|
|
305
307
|
}, /*#__PURE__*/React.createElement(CustomElement, props)), /*#__PURE__*/React.createElement("div", {
|
|
306
308
|
className: "w-100 sdoc-rebase-incoming-changes-end",
|
|
307
309
|
contentEditable: false
|
|
308
310
|
}, '>>>>>>>'));
|
|
309
311
|
}
|
|
310
|
-
if (
|
|
311
|
-
if (element.
|
|
312
|
+
if (rebaseType === REBASE_TYPE.MODIFY_MODIFY) {
|
|
313
|
+
if (element[REBASE_MARK_KEY.ORIGIN] === 'master') {
|
|
312
314
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
313
315
|
className: "w-100 d-flex sdoc-rebase-btn-group",
|
|
314
316
|
contentEditable: false
|
|
@@ -335,14 +337,16 @@ var RenderElement = function RenderElement(props) {
|
|
|
335
337
|
className: "w-100 sdoc-rebase-current-changes-start",
|
|
336
338
|
contentEditable: false
|
|
337
339
|
}, '<<<<<<<'), /*#__PURE__*/React.createElement("div", {
|
|
338
|
-
className: "w-100 sdoc-rebase-current-changes"
|
|
340
|
+
className: "w-100 sdoc-rebase-current-changes",
|
|
341
|
+
contentEditable: false
|
|
339
342
|
}, /*#__PURE__*/React.createElement(CustomElement, props)));
|
|
340
343
|
}
|
|
341
344
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
342
345
|
className: "w-100",
|
|
343
346
|
contentEditable: false
|
|
344
347
|
}, '======='), /*#__PURE__*/React.createElement("div", {
|
|
345
|
-
className: "w-100 sdoc-rebase-incoming-changes"
|
|
348
|
+
className: "w-100 sdoc-rebase-incoming-changes",
|
|
349
|
+
contentEditable: false
|
|
346
350
|
}, /*#__PURE__*/React.createElement(CustomElement, props)), /*#__PURE__*/React.createElement("div", {
|
|
347
351
|
className: "w-100 sdoc-rebase-incoming-changes-end",
|
|
348
352
|
contentEditable: false
|
|
@@ -137,7 +137,7 @@ var SocketClient = /*#__PURE__*/_createClass(function SocketClient(config) {
|
|
|
137
137
|
socketManager.receivePublishDocumentError();
|
|
138
138
|
};
|
|
139
139
|
this.sendReplaceDocument = function (document, callback) {
|
|
140
|
-
_this.socket.emit('replace-
|
|
140
|
+
_this.socket.emit('replace-document', _this.getParams({
|
|
141
141
|
document: document
|
|
142
142
|
}), function (result) {
|
|
143
143
|
callback && callback(result);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
4
|
import { generateIdMapAndIds, getIdDiffs } from './diff';
|
|
4
5
|
import ObjectUtils from './object-utils';
|
|
5
|
-
import { MODIFY_TYPE, REBASE_TYPE } from '../constants';
|
|
6
|
+
import { MODIFY_TYPE, REBASE_TYPE, REBASE_MARK_KEY } from '../constants';
|
|
6
7
|
import { ELEMENT_TYPE } from '../extension/constants';
|
|
7
8
|
import { replaceNodeId } from '../node-id/helpers';
|
|
8
9
|
var getRevisionChanges = function getRevisionChanges(masterContent, currentContent) {
|
|
@@ -20,16 +21,12 @@ var getRevisionChanges = function getRevisionChanges(masterContent, currentConte
|
|
|
20
21
|
removed = idDiff.removed;
|
|
21
22
|
if (added) {
|
|
22
23
|
var addedList = value.map(function (item) {
|
|
23
|
-
return _objectSpread(_objectSpread({}, currentContentMap[item]), {}, {
|
|
24
|
-
modifyType: MODIFY_TYPE.ADD
|
|
25
|
-
});
|
|
24
|
+
return _objectSpread(_objectSpread({}, currentContentMap[item]), {}, _defineProperty({}, REBASE_MARK_KEY.MODIFY_TYPE, MODIFY_TYPE.ADD));
|
|
26
25
|
});
|
|
27
26
|
content.push.apply(content, _toConsumableArray(addedList));
|
|
28
27
|
} else if (removed) {
|
|
29
28
|
var deletedList = value.map(function (item) {
|
|
30
|
-
return _objectSpread(_objectSpread({}, masterContentMap[item]), {}, {
|
|
31
|
-
modifyType: MODIFY_TYPE.DELETE
|
|
32
|
-
});
|
|
29
|
+
return _objectSpread(_objectSpread({}, masterContentMap[item]), {}, _defineProperty({}, REBASE_MARK_KEY.MODIFY_TYPE, MODIFY_TYPE.DELETE));
|
|
33
30
|
});
|
|
34
31
|
content.push.apply(content, _toConsumableArray(deletedList));
|
|
35
32
|
} else {
|
|
@@ -37,17 +34,15 @@ var getRevisionChanges = function getRevisionChanges(masterContent, currentConte
|
|
|
37
34
|
if (ObjectUtils.isSameObject(masterContentMap[elementId], currentContentMap[elementId])) {
|
|
38
35
|
content.push(currentContentMap[elementId]);
|
|
39
36
|
} else {
|
|
37
|
+
var _objectSpread4;
|
|
40
38
|
var oldElement = masterContentMap[elementId];
|
|
41
39
|
var currentElement = currentContentMap[elementId];
|
|
42
|
-
var newElement = _objectSpread(_objectSpread({}, currentElement), {}, {
|
|
43
|
-
modifyType: MODIFY_TYPE.MODIFY,
|
|
44
|
-
oldElement: oldElement
|
|
45
|
-
});
|
|
40
|
+
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));
|
|
46
41
|
if (currentElement.type === oldElement.type) {
|
|
47
42
|
var elementType = currentElement.type;
|
|
48
43
|
if ([ELEMENT_TYPE.UNORDERED_LIST, ELEMENT_TYPE.ORDERED_LIST].includes(elementType)) {
|
|
49
44
|
var listContent = getRevisionChanges(oldElement, currentElement);
|
|
50
|
-
newElement[
|
|
45
|
+
newElement[REBASE_MARK_KEY.MODIFY_TYPE] = MODIFY_TYPE.CHILDREN_MODIFY;
|
|
51
46
|
newElement['children'] = listContent;
|
|
52
47
|
}
|
|
53
48
|
}
|
|
@@ -82,8 +77,8 @@ var getMasterChanges = function getMasterChanges(masterContent, revisionChanges)
|
|
|
82
77
|
};
|
|
83
78
|
// The content has been deleted from the master, but this branch has been modified. At this time, rebase is required, and the user needs to confirm the selected content
|
|
84
79
|
// ==> delete | use modification
|
|
85
|
-
if (element.
|
|
86
|
-
newElement[
|
|
80
|
+
if (element[REBASE_MARK_KEY.MODIFY_TYPE] === MODIFY_TYPE.MODIFY) {
|
|
81
|
+
newElement[REBASE_MARK_KEY.REBASE_TYPE] = REBASE_TYPE.DELETE_MODIFY;
|
|
87
82
|
content.push(newElement);
|
|
88
83
|
canMerge = false;
|
|
89
84
|
} else {
|
|
@@ -106,54 +101,43 @@ var getMasterChanges = function getMasterChanges(masterContent, revisionChanges)
|
|
|
106
101
|
content.push(currentElement);
|
|
107
102
|
|
|
108
103
|
// The content of the master branch is modified in the current branch, but the content of the master branch is the same as that of origin
|
|
109
|
-
} else if (ObjectUtils.isSameObject(masterElement, currentElement.
|
|
104
|
+
} else if (ObjectUtils.isSameObject(masterElement, currentElement[REBASE_MARK_KEY.OLD_ELEMENT])) {
|
|
110
105
|
var newElement = _objectSpread({}, currentElement);
|
|
111
|
-
newElement[
|
|
112
|
-
newElement[
|
|
106
|
+
newElement[REBASE_MARK_KEY.OLD_ELEMENT] && delete newElement[REBASE_MARK_KEY.OLD_ELEMENT];
|
|
107
|
+
newElement[REBASE_MARK_KEY.MODIFY_TYPE] && delete newElement[REBASE_MARK_KEY.MODIFY_TYPE];
|
|
113
108
|
content.push(newElement);
|
|
114
109
|
|
|
115
110
|
// Modify at the same time
|
|
116
|
-
} else if (currentElement.
|
|
117
|
-
var
|
|
118
|
-
|
|
119
|
-
origin: 'master'
|
|
120
|
-
}));
|
|
111
|
+
} else if (currentElement[REBASE_MARK_KEY.MODIFY_TYPE] === MODIFY_TYPE.MODIFY) {
|
|
112
|
+
var _objectSpread5, _objectSpread6;
|
|
113
|
+
var oldMasterElement = replaceNodeId(_objectSpread(_objectSpread({}, masterElement), {}, (_objectSpread5 = {}, _defineProperty(_objectSpread5, REBASE_MARK_KEY.REBASE_TYPE, REBASE_TYPE.MODIFY_MODIFY), _defineProperty(_objectSpread5, REBASE_MARK_KEY.ORIGIN, 'master'), _objectSpread5)));
|
|
121
114
|
content.push(oldMasterElement);
|
|
122
|
-
var _newElement = _objectSpread(_objectSpread({}, currentElement), {}, {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
});
|
|
126
|
-
_newElement['modifyType'] && delete _newElement['modifyType'];
|
|
127
|
-
_newElement['oldElement'] && delete _newElement['oldElement'];
|
|
115
|
+
var _newElement = _objectSpread(_objectSpread({}, currentElement), {}, (_objectSpread6 = {}, _defineProperty(_objectSpread6, REBASE_MARK_KEY.REBASE_TYPE, REBASE_TYPE.MODIFY_MODIFY), _defineProperty(_objectSpread6, REBASE_MARK_KEY.ORIGIN, 'current'), _objectSpread6));
|
|
116
|
+
_newElement[REBASE_MARK_KEY.MODIFY_TYPE] && delete _newElement[REBASE_MARK_KEY.MODIFY_TYPE];
|
|
117
|
+
_newElement[REBASE_MARK_KEY.OLD_ELEMENT] && delete _newElement[REBASE_MARK_KEY.OLD_ELEMENT];
|
|
128
118
|
content.push(_newElement);
|
|
129
119
|
canMerge = false;
|
|
130
120
|
|
|
131
121
|
// children modify
|
|
132
|
-
} else if (currentElement.
|
|
122
|
+
} else if (currentElement[REBASE_MARK_KEY.MODIFY_TYPE] === MODIFY_TYPE.CHILDREN_MODIFY) {
|
|
133
123
|
canMerge = false;
|
|
134
124
|
if (currentElement.type === masterElement.type) {
|
|
135
125
|
var _getMasterChanges = getMasterChanges(masterElement, currentElement.children),
|
|
136
126
|
childrenContent = _getMasterChanges.content;
|
|
137
|
-
content.push(_objectSpread(_objectSpread({}, masterElement), {}, {
|
|
138
|
-
children: childrenContent
|
|
139
|
-
|
|
140
|
-
}));
|
|
127
|
+
content.push(_objectSpread(_objectSpread({}, masterElement), {}, _defineProperty({
|
|
128
|
+
children: childrenContent
|
|
129
|
+
}, REBASE_MARK_KEY.REBASE_TYPE, REBASE_TYPE.CHILDREN_MODIFY)));
|
|
141
130
|
} else {
|
|
142
|
-
var
|
|
143
|
-
|
|
144
|
-
origin: 'master'
|
|
145
|
-
}));
|
|
131
|
+
var _objectSpread8, _objectSpread9;
|
|
132
|
+
var _oldMasterElement = replaceNodeId(_objectSpread(_objectSpread({}, masterElement), {}, (_objectSpread8 = {}, _defineProperty(_objectSpread8, REBASE_MARK_KEY.REBASE_TYPE, REBASE_TYPE.MODIFY_MODIFY), _defineProperty(_objectSpread8, REBASE_MARK_KEY.ORIGIN, 'master'), _objectSpread8)));
|
|
146
133
|
content.push(_oldMasterElement);
|
|
147
|
-
var _newElement2 = _objectSpread(_objectSpread({}, currentElement.
|
|
148
|
-
rebaseType: REBASE_TYPE.MODIFY_MODIFY,
|
|
149
|
-
origin: 'current'
|
|
150
|
-
});
|
|
134
|
+
var _newElement2 = _objectSpread(_objectSpread({}, currentElement[REBASE_MARK_KEY.OLD_ELEMENT]), {}, (_objectSpread9 = {}, _defineProperty(_objectSpread9, REBASE_MARK_KEY.REBASE_TYPE, REBASE_TYPE.MODIFY_MODIFY), _defineProperty(_objectSpread9, REBASE_MARK_KEY.ORIGIN, 'current'), _objectSpread9));
|
|
151
135
|
content.push(_newElement2);
|
|
152
136
|
}
|
|
153
137
|
} else {
|
|
154
138
|
var _newElement3 = _objectSpread({}, currentElement);
|
|
155
|
-
_newElement3[
|
|
156
|
-
_newElement3[
|
|
139
|
+
_newElement3[REBASE_MARK_KEY.OLD_ELEMENT] && delete _newElement3[REBASE_MARK_KEY.OLD_ELEMENT];
|
|
140
|
+
_newElement3[REBASE_MARK_KEY.MODIFY_TYPE] && delete _newElement3[REBASE_MARK_KEY.MODIFY_TYPE];
|
|
157
141
|
content.push(_newElement3);
|
|
158
142
|
}
|
|
159
143
|
});
|
|
@@ -16,7 +16,7 @@ var SDocViewer = function SDocViewer(_ref) {
|
|
|
16
16
|
showOutline = _ref.showOutline;
|
|
17
17
|
var validEditor = editor || withNodeId(createDefaultEditor());
|
|
18
18
|
var slateValue = (document || generateDefaultDocContent()).children;
|
|
19
|
-
var decorate = usePipDecorate(
|
|
19
|
+
var decorate = usePipDecorate(validEditor);
|
|
20
20
|
return /*#__PURE__*/React.createElement(EditorContainer, {
|
|
21
21
|
editor: editor,
|
|
22
22
|
showToolbar: showToolbar,
|
|
@@ -4,7 +4,6 @@ import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap';
|
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { TIP_TYPE, TIP_TITLE } from '../../constants';
|
|
6
6
|
import TipContent from './tip-content';
|
|
7
|
-
import './index.css';
|
|
8
7
|
var TipDialog = function TipDialog(_ref) {
|
|
9
8
|
var className = _ref.className,
|
|
10
9
|
tipType = _ref.tipType,
|
|
@@ -37,18 +37,12 @@ var TipContent = function TipContent(_ref) {
|
|
|
37
37
|
}, [time]);
|
|
38
38
|
var _useTranslation = useTranslation(),
|
|
39
39
|
t = _useTranslation.t;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
time: time
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
default:
|
|
48
|
-
{
|
|
49
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, t(TIP_CONTENT[tipType]));
|
|
50
|
-
}
|
|
40
|
+
if (tipType === TIP_TYPE.HAS_BEEN_PUBLISHED) {
|
|
41
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, t(TIP_CONTENT[tipType], {
|
|
42
|
+
time: time
|
|
43
|
+
}));
|
|
51
44
|
}
|
|
45
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, t(TIP_CONTENT[tipType]));
|
|
52
46
|
};
|
|
53
47
|
TipContent.propTypes = {
|
|
54
48
|
tipType: PropTypes.string
|
|
@@ -102,19 +102,27 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
102
102
|
|
|
103
103
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
104
104
|
}, [editorRef]);
|
|
105
|
-
var onDocumentReplacedError = useCallback(function () {
|
|
106
|
-
|
|
105
|
+
var onDocumentReplacedError = useCallback(function () {
|
|
106
|
+
toaster.danger(t('Error'));
|
|
107
|
+
|
|
108
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
109
|
+
}, []);
|
|
110
|
+
var publishDocumentError = useCallback(function () {
|
|
111
|
+
toaster.danger(t('Error'));
|
|
112
|
+
|
|
113
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
114
|
+
}, []);
|
|
107
115
|
useEffect(function () {
|
|
108
116
|
var eventBus = EventBus.getInstance();
|
|
109
|
-
var
|
|
110
|
-
var
|
|
111
|
-
var
|
|
112
|
-
var
|
|
117
|
+
var unsubscribeMergeDocument = eventBus.subscribe(EXTERNAL_EVENT.DOCUMENT_REPLACED, onDocumentReplaced);
|
|
118
|
+
var unsubscribePublishDocument = eventBus.subscribe(EXTERNAL_EVENT.PUBLISH_DOCUMENT, hasPublishRevision);
|
|
119
|
+
var unsubscribeMergeDocumentError = eventBus.subscribe(EXTERNAL_EVENT.DOCUMENT_REPLACED_ERROR, onDocumentReplacedError);
|
|
120
|
+
var unsubscribePublishDocumentError = eventBus.subscribe(EXTERNAL_EVENT.PUBLISH_DOCUMENT_ERROR, publishDocumentError);
|
|
113
121
|
return function () {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
unsubscribeMergeDocument();
|
|
123
|
+
unsubscribePublishDocument();
|
|
124
|
+
unsubscribeMergeDocumentError();
|
|
125
|
+
unsubscribePublishDocumentError();
|
|
118
126
|
};
|
|
119
127
|
|
|
120
128
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -161,7 +169,7 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
161
169
|
var toggleViewChanges = useCallback(function (isShowChanges) {
|
|
162
170
|
var revisionCurrentContent = editorRef.current.getSlateValue();
|
|
163
171
|
if (isShowChanges && revisionCurrentContent.children.filter(function (item) {
|
|
164
|
-
return item.
|
|
172
|
+
return item.rebase_type;
|
|
165
173
|
}).length !== 0) {
|
|
166
174
|
setTipType(TIP_TYPE.HAS_CONFLICT_BEFORE_VIEW_CHANGES);
|
|
167
175
|
setShowTip(true);
|
|
@@ -194,7 +202,7 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
194
202
|
loadDocument(function (document) {
|
|
195
203
|
var revisionCurrentContent = document;
|
|
196
204
|
if (revisionCurrentContent.children.filter(function (item) {
|
|
197
|
-
return item.
|
|
205
|
+
return item.rebase_type;
|
|
198
206
|
}).length !== 0) {
|
|
199
207
|
setTipType(TIP_TYPE.HAS_CONFLICT_BEFORE_PUBLISH);
|
|
200
208
|
setShowTip(true);
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
/>
|
|
15
15
|
<missing-glyph />
|
|
16
16
|
|
|
17
|
+
<glyph glyph-name="sdoc-sm-close" unicode="" d="M512 439.466667L230.4 721.066667l-25.6 25.6-55.466667-55.466667 25.6-25.6 281.6-281.6-281.6-281.6-25.6-25.6 55.466667-55.466667 25.6 25.6 281.6 281.6 281.6-281.6 25.6-25.6 55.466667 55.466667-25.6 25.6-281.6 281.6 281.6 281.6 25.6 25.6-55.466667 55.466667-25.6-25.6z" horiz-adv-x="1024" />
|
|
18
|
+
|
|
19
|
+
<glyph glyph-name="sdoc-merge-cell" unicode="" d="M480 896v-288h-96V800H96v-832h288v192h96v-288H0V896h480zM313.6 528L480 384l-166.4-144v96H160v92.8h153.6v99.2zM1024 896v-1024H544v288h96v-192h288V800h-288v-192h-96V896h480z m-313.6-368v-99.2H864v-92.8h-153.6v-96L544 384l166.4 144z" horiz-adv-x="1024" />
|
|
20
|
+
|
|
17
21
|
<glyph glyph-name="sdoc-download" unicode="" d="M582.4 326.4V793.6c0 41.6-32 70.4-70.4 70.4s-70.4-28.8-70.4-70.4v-467.2l-172.8 172.8c-25.6 25.6-70.4 25.6-96-3.2-25.6-25.6-25.6-70.4 0-96l291.2-291.2c25.6-25.6 70.4-25.6 96 0l291.2 291.2c25.6 25.6 25.6 70.4 3.2 96-25.6 25.6-70.4 25.6-96 3.2l-3.2-3.2-172.8-169.6z m-480-284.8h822.4c38.4 0 70.4-28.8 70.4-70.4s-32-67.2-73.6-67.2H102.4C60.8-96 32-67.2 32-25.6c0 35.2 28.8 67.2 70.4 67.2z" horiz-adv-x="1024" />
|
|
18
22
|
|
|
19
23
|
<glyph glyph-name="sdoc-next-page" unicode="" d="M342.4 768c12.8 0 28.8-6.4 38.4-16l329.6-329.6c22.4-22.4 22.4-57.6 0-76.8L380.8 16c-22.4-22.4-57.6-22.4-76.8 0-22.4 22.4-22.4 57.6 0 76.8L595.2 384 304 675.2c-22.4 22.4-22.4 57.6 0 76.8 9.6 9.6 25.6 16 38.4 16z" horiz-adv-x="1024" />
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-family: "sdocfont"; /* Project id 4097705 */
|
|
3
|
-
src: url('./sdoc-editor-font/iconfont.eot?t=
|
|
4
|
-
src: url('./sdoc-editor-font/iconfont.eot?t=
|
|
5
|
-
url('./sdoc-editor-font/iconfont.woff2?t=
|
|
6
|
-
url('./sdoc-editor-font/iconfont.woff?t=
|
|
7
|
-
url('./sdoc-editor-font/iconfont.ttf?t=
|
|
8
|
-
url('./sdoc-editor-font/iconfont.svg?t=
|
|
3
|
+
src: url('./sdoc-editor-font/iconfont.eot?t=1694758459474'); /* IE9 */
|
|
4
|
+
src: url('./sdoc-editor-font/iconfont.eot?t=1694758459474#iefix') format('embedded-opentype'), /* IE6-IE8 */
|
|
5
|
+
url('./sdoc-editor-font/iconfont.woff2?t=1694758459474') format('woff2'),
|
|
6
|
+
url('./sdoc-editor-font/iconfont.woff?t=1694758459474') format('woff'),
|
|
7
|
+
url('./sdoc-editor-font/iconfont.ttf?t=1694758459474') format('truetype'),
|
|
8
|
+
url('./sdoc-editor-font/iconfont.svg?t=1694758459474#sdocfont') format('svg');
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.sdocfont {
|
|
@@ -16,6 +16,14 @@
|
|
|
16
16
|
-moz-osx-font-smoothing: grayscale;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
.sdoc-sm-close:before {
|
|
20
|
+
content: "\e655";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.sdoc-merge-cell:before {
|
|
24
|
+
content: "\e653";
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
.sdoc-download:before {
|
|
20
28
|
content: "\e652";
|
|
21
29
|
}
|
|
File without changes
|