@seafile/sdoc-editor 1.0.101 → 1.0.103
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/components/comment-editor.js +3 -3
- package/dist/basic-sdk/editor/sdoc-comment-editor.js +4 -4
- package/dist/basic-sdk/editor/sdoc-editor.js +7 -7
- package/dist/basic-sdk/editor/wiki-editor.js +7 -7
- package/dist/basic-sdk/extension/plugins/seatable-tables/op-menu/index.css +15 -15
- package/dist/basic-sdk/extension/plugins/seatable-tables/op-menu/index.js +5 -5
- package/dist/basic-sdk/outline/style.css +5 -5
- package/dist/basic-sdk/outline/wiki-outline.js +22 -21
- package/dist/basic-sdk/utils/diff.js +8 -8
- package/dist/basic-sdk/views/published-revision-diff-viewer.js +1 -1
- package/dist/basic-sdk/views/revision-diff-viewer.js +1 -1
- package/dist/basic-sdk/views/sdoc-diff-viewer.js +1 -1
- package/dist/basic-sdk/views/sdoc-viewer.js +1 -1
- package/dist/basic-sdk/views/sdoc-wiki-viewer.js +1 -0
- package/dist/hooks/use-document.js +0 -7
- package/dist/pages/simple-viewer.js +0 -6
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
|
@@ -50,12 +50,12 @@ const CommentEditor = _ref => {
|
|
|
50
50
|
const userInfo = _context.default.getUserInfo();
|
|
51
51
|
const document = (0, _react.useMemo)(() => {
|
|
52
52
|
const cursor = {};
|
|
53
|
-
let
|
|
54
|
-
|
|
53
|
+
let elements = null;
|
|
54
|
+
elements = [(0, _core.generateEmptyElement)(_constants.PARAGRAPH, {
|
|
55
55
|
placeholder
|
|
56
56
|
})];
|
|
57
57
|
return {
|
|
58
|
-
|
|
58
|
+
elements,
|
|
59
59
|
cursor
|
|
60
60
|
};
|
|
61
61
|
}, [placeholder]);
|
|
@@ -33,7 +33,7 @@ const SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
33
33
|
submitBtnText,
|
|
34
34
|
onCancel
|
|
35
35
|
} = _ref;
|
|
36
|
-
const [slateValue, setSlateValue] = (0, _react.useState)(document.
|
|
36
|
+
const [slateValue, setSlateValue] = (0, _react.useState)(document.elements);
|
|
37
37
|
const commentEditorContainerRef = (0, _react.useRef)(null);
|
|
38
38
|
const validEditor = (0, _react.useMemo)(() => {
|
|
39
39
|
if (propsEditor) return propsEditor;
|
|
@@ -85,8 +85,8 @@ const SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
85
85
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
86
86
|
setSlateValue: document => {
|
|
87
87
|
// Force update of editor's child elements
|
|
88
|
-
validEditor.children = document.
|
|
89
|
-
setSlateValue([...document.
|
|
88
|
+
validEditor.children = document.elements;
|
|
89
|
+
setSlateValue([...document.elements]);
|
|
90
90
|
},
|
|
91
91
|
updateDocumentVersion: document => {
|
|
92
92
|
validEditor.updateDocumentVersion(document);
|
|
@@ -95,7 +95,7 @@ const SdocCommentEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
95
95
|
getSlateValue: () => {
|
|
96
96
|
return (0, _deepCopy.default)({
|
|
97
97
|
...document,
|
|
98
|
-
|
|
98
|
+
elements: slateValue
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -51,13 +51,13 @@ const SdocEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
51
51
|
|
|
52
52
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
53
|
}, []);
|
|
54
|
-
const [slateValue, setSlateValue] = (0, _react.useState)(document.
|
|
54
|
+
const [slateValue, setSlateValue] = (0, _react.useState)(document.elements);
|
|
55
55
|
|
|
56
56
|
// Fix: The editor's children are not updated when the document is updated in revision
|
|
57
|
-
// In revision mode, the document is updated, but the editor's children are not updated,as onValueChange override the new document.
|
|
57
|
+
// In revision mode, the document is updated, but the editor's children are not updated,as onValueChange override the new document.elements. This unexpected action cause the editor to display the old content
|
|
58
58
|
(0, _react.useEffect)(() => {
|
|
59
|
-
setSlateValue(document.
|
|
60
|
-
}, [document.
|
|
59
|
+
setSlateValue(document.elements);
|
|
60
|
+
}, [document.elements]);
|
|
61
61
|
(0, _react.useEffect)(() => {
|
|
62
62
|
validEditor.readonly = false;
|
|
63
63
|
return () => {
|
|
@@ -111,8 +111,8 @@ const SdocEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
111
111
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
112
112
|
setSlateValue: document => {
|
|
113
113
|
// Force update of editor's child elements
|
|
114
|
-
validEditor.children = document.
|
|
115
|
-
setSlateValue([...document.
|
|
114
|
+
validEditor.children = document.elements;
|
|
115
|
+
setSlateValue([...document.elements]);
|
|
116
116
|
},
|
|
117
117
|
updateDocumentVersion: document => {
|
|
118
118
|
validEditor.updateDocumentVersion(document);
|
|
@@ -121,7 +121,7 @@ const SdocEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
121
121
|
getSlateValue: () => {
|
|
122
122
|
return (0, _deepCopy.default)({
|
|
123
123
|
...document,
|
|
124
|
-
|
|
124
|
+
elements: slateValue
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -52,13 +52,13 @@ const WikiEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
52
52
|
|
|
53
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
54
54
|
}, []);
|
|
55
|
-
const [slateValue, setSlateValue] = (0, _react.useState)(document.
|
|
55
|
+
const [slateValue, setSlateValue] = (0, _react.useState)(document.elements);
|
|
56
56
|
|
|
57
57
|
// Fix: The editor's children are not updated when the document is updated in revision
|
|
58
|
-
// In revision mode, the document is updated, but the editor's children are not updated,as onValueChange override the new document.
|
|
58
|
+
// In revision mode, the document is updated, but the editor's children are not updated,as onValueChange override the new document.elements. This unexpected action cause the editor to display the old content
|
|
59
59
|
(0, _react.useEffect)(() => {
|
|
60
|
-
setSlateValue(document.
|
|
61
|
-
}, [document.
|
|
60
|
+
setSlateValue(document.elements);
|
|
61
|
+
}, [document.elements]);
|
|
62
62
|
(0, _react.useEffect)(() => {
|
|
63
63
|
validEditor.readonly = false;
|
|
64
64
|
return () => {
|
|
@@ -117,8 +117,8 @@ const WikiEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
117
117
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
118
118
|
setSlateValue: document => {
|
|
119
119
|
// Force update of editor's child elements
|
|
120
|
-
validEditor.children = document.
|
|
121
|
-
setSlateValue([...document.
|
|
120
|
+
validEditor.children = document.elements;
|
|
121
|
+
setSlateValue([...document.elements]);
|
|
122
122
|
},
|
|
123
123
|
updateDocumentVersion: document => {
|
|
124
124
|
validEditor.updateDocumentVersion(document);
|
|
@@ -127,7 +127,7 @@ const WikiEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
127
127
|
getSlateValue: () => {
|
|
128
128
|
return (0, _deepCopy.default)({
|
|
129
129
|
...document,
|
|
130
|
-
|
|
130
|
+
elements: slateValue
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
color: #444;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-
|
|
87
|
+
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-popover {
|
|
88
88
|
position: absolute;
|
|
89
89
|
top: 38px;
|
|
90
90
|
left: 0px;
|
|
@@ -96,12 +96,12 @@
|
|
|
96
96
|
border: 1px solid #dedede;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-right-
|
|
99
|
+
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-right-popover {
|
|
100
100
|
left: 200px;
|
|
101
101
|
width: 300px;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-
|
|
104
|
+
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-popover .tables-list-empty {
|
|
105
105
|
padding: 10px;
|
|
106
106
|
width: 100%;
|
|
107
107
|
font-size: 13px;
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
vertical-align: middle;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-
|
|
113
|
+
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-popover .seatable-setting-container {
|
|
114
114
|
list-style: none;
|
|
115
115
|
overflow-y: auto;
|
|
116
116
|
max-height: 280px;
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
padding: 8px 0px;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-
|
|
121
|
+
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-popover .seatable-setting-container .seatable-setting-item {
|
|
122
122
|
position: relative;
|
|
123
123
|
white-space: nowrap;
|
|
124
124
|
cursor: pointer;
|
|
@@ -130,52 +130,52 @@
|
|
|
130
130
|
justify-content: space-between;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-
|
|
133
|
+
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-popover .seatable-setting-container .seatable-custom-switch-item .custom-switch-description {
|
|
134
134
|
margin-left: 0px;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-
|
|
137
|
+
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-popover .seatable-setting-container .seatable-custom-switch-item .custom-switch {
|
|
138
138
|
padding-left: 0px;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-
|
|
141
|
+
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-popover .seatable-setting-container .seatable-custom-switch-item .custom-switch-indicator {
|
|
142
142
|
position: absolute;
|
|
143
143
|
right: 0px;
|
|
144
144
|
cursor: pointer;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-
|
|
147
|
+
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-popover .seatable-setting-container .seatable-setting-item:hover {
|
|
148
148
|
background-color: #f5f5f5;;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-
|
|
151
|
+
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-popover .seatable-setting-container .seatable-setting-item .active {
|
|
152
152
|
background-color: #f5f5f5;;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-
|
|
155
|
+
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-popover .seatable-setting-container .seatable-setting-item .check-mark {
|
|
156
156
|
opacity: 0;
|
|
157
157
|
padding: 0 10px;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-
|
|
160
|
+
.sdoc-seatable-hover-menu-container .hover-menu-container .sdoc-seatable-setting-popover .seatable-setting-container .seatable-setting-item .checked {
|
|
161
161
|
opacity: 1;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
.sdoc-seatable-setting-filter-
|
|
164
|
+
.sdoc-seatable-setting-filter-popover-wrapper {
|
|
165
165
|
top: 38px !important;
|
|
166
166
|
left: 83px !important;
|
|
167
167
|
transform: unset !important;
|
|
168
168
|
margin-top: 0px !important;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
.sdoc-seatable-setting-sort-
|
|
171
|
+
.sdoc-seatable-setting-sort-popover-wrapper {
|
|
172
172
|
top: 38px !important;
|
|
173
173
|
left: 122px !important;
|
|
174
174
|
transform: unset !important;
|
|
175
175
|
margin-top: 0px !important;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
.sdoc-seatable-setting-hide-column-
|
|
178
|
+
.sdoc-seatable-setting-hide-column-popover-wrapper {
|
|
179
179
|
top: 38px !important;
|
|
180
180
|
left: 158px !important;
|
|
181
181
|
transform: unset !important;
|
|
@@ -289,7 +289,7 @@ function OpMenu(_ref3) {
|
|
|
289
289
|
placement: "top",
|
|
290
290
|
fade: true
|
|
291
291
|
}, t('Style_settings'))), isShowTableList && /*#__PURE__*/_react.default.createElement("div", {
|
|
292
|
-
className: "sdoc-seatable-setting-
|
|
292
|
+
className: "sdoc-seatable-setting-popover"
|
|
293
293
|
}, /*#__PURE__*/_react.default.createElement(TablesList, {
|
|
294
294
|
tablesData: tablesData,
|
|
295
295
|
onSelectTable: onSelectTable,
|
|
@@ -297,7 +297,7 @@ function OpMenu(_ref3) {
|
|
|
297
297
|
})), /*#__PURE__*/_react.default.createElement(_filterSetter.default, {
|
|
298
298
|
target: "sdoc_seatable_filter",
|
|
299
299
|
container: document.getElementById('sdoc-seatable-hover-menu-container'),
|
|
300
|
-
popperClassName: "sdoc-seatable-setting-filter-
|
|
300
|
+
popperClassName: "sdoc-seatable-setting-filter-popover-wrapper",
|
|
301
301
|
columns: selectedTable.columns,
|
|
302
302
|
filterConjunction: element.filter_conjunction || 'And',
|
|
303
303
|
filters: element.filters || [],
|
|
@@ -309,7 +309,7 @@ function OpMenu(_ref3) {
|
|
|
309
309
|
}), /*#__PURE__*/_react.default.createElement(_sortSetter.default, {
|
|
310
310
|
target: "sdoc_seatable_sort",
|
|
311
311
|
container: document.getElementById('sdoc-seatable-hover-menu-container'),
|
|
312
|
-
popperClassName: "sdoc-seatable-setting-sort-
|
|
312
|
+
popperClassName: "sdoc-seatable-setting-sort-popover-wrapper",
|
|
313
313
|
columns: selectedTable.columns,
|
|
314
314
|
sorts: element.sorts || [],
|
|
315
315
|
isShowSortPopover: isShowSort,
|
|
@@ -319,14 +319,14 @@ function OpMenu(_ref3) {
|
|
|
319
319
|
}), /*#__PURE__*/_react.default.createElement(_hideColumnSetter.default, {
|
|
320
320
|
target: "sdoc_seatable_hidden_column",
|
|
321
321
|
container: document.getElementById('sdoc-seatable-hover-menu-container'),
|
|
322
|
-
popperClassName: "sdoc-seatable-setting-hide-column-
|
|
322
|
+
popperClassName: "sdoc-seatable-setting-hide-column-popover-wrapper",
|
|
323
323
|
columns: selectedTable.columns,
|
|
324
324
|
shownColumnKeys: element.shown_column_keys || [],
|
|
325
325
|
isShowHideColumnSetter: isShowHideColumn,
|
|
326
326
|
onSettingUpdate: onHideColumnChange,
|
|
327
327
|
onPopoverToggle: onHiddenColumn
|
|
328
328
|
}), isShowSeaTableSetting && /*#__PURE__*/_react.default.createElement("div", {
|
|
329
|
-
className: "sdoc-seatable-setting-
|
|
329
|
+
className: "sdoc-seatable-setting-popover sdoc-seatable-setting-right-popover"
|
|
330
330
|
}, /*#__PURE__*/_react.default.createElement(TablesSettings, {
|
|
331
331
|
settings: element,
|
|
332
332
|
updatePageSettings: updatePageSettings
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
background-color: rgb(50, 48, 44);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.wiki-outline-wrapper .wiki-outline-
|
|
46
|
+
.wiki-outline-wrapper .wiki-outline-popover {
|
|
47
47
|
position: absolute;
|
|
48
48
|
right: 0;
|
|
49
49
|
width: 242px;
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
overflow-y: auto;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
.wiki-outline-wrapper .wiki-outline-
|
|
60
|
+
.wiki-outline-wrapper .wiki-outline-popover .sdoc-outline-list-container {
|
|
61
61
|
padding: 6px;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
.wiki-outline-wrapper .wiki-outline-
|
|
64
|
+
.wiki-outline-wrapper .wiki-outline-popover .sdoc-outline-list-container .sdoc-outline-item {
|
|
65
65
|
color: rgb(120, 119, 116);
|
|
66
66
|
transition: color 0.15s;
|
|
67
67
|
cursor: pointer;
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
font-size: 14px;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
.wiki-outline-wrapper .wiki-outline-
|
|
72
|
+
.wiki-outline-wrapper .wiki-outline-popover .sdoc-outline-list-container .wiki-outline-active {
|
|
73
73
|
color: rgb(35, 131, 226)
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
.wiki-outline-wrapper .wiki-outline-
|
|
76
|
+
.wiki-outline-wrapper .wiki-outline-popover .sdoc-outline-list-container .sdoc-outline-item:hover {
|
|
77
77
|
background: rgba(55, 53, 47, 0.06);
|
|
78
78
|
border-radius: 6px;
|
|
79
79
|
}
|
|
@@ -19,16 +19,21 @@ const WikiOutline = _ref => {
|
|
|
19
19
|
const scrollRef = (0, _useScrollContext.useScrollContext)();
|
|
20
20
|
const wikiOutlineRef = (0, _react.useRef)(null);
|
|
21
21
|
const [wikiOutlineList, setWikiOutlineList] = (0, _react.useState)([]);
|
|
22
|
-
const [
|
|
22
|
+
const [isShowOutlinePopover, setIsShowOutlinePopover] = (0, _react.useState)(false);
|
|
23
23
|
const onMouseOver = (0, _react.useCallback)(() => {
|
|
24
|
-
if (!
|
|
25
|
-
|
|
24
|
+
if (!isShowOutlinePopover) {
|
|
25
|
+
setIsShowOutlinePopover(true);
|
|
26
26
|
}
|
|
27
|
-
}, [
|
|
27
|
+
}, [isShowOutlinePopover]);
|
|
28
28
|
const updateWikiOutlineList = (0, _react.useCallback)(() => {
|
|
29
29
|
const list = doc.filter(item => ['header1', 'header2', 'header3'].includes(item.type));
|
|
30
|
-
if (list.length === 0)
|
|
31
|
-
|
|
30
|
+
if (list.length === 0) {
|
|
31
|
+
setWikiOutlineList([]);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// The slateValue value in the document cannot be operated, so copy it for operation
|
|
36
|
+
const newList = JSON.parse(JSON.stringify(list));
|
|
32
37
|
const index = list.findIndex(item => {
|
|
33
38
|
const {
|
|
34
39
|
id
|
|
@@ -81,29 +86,25 @@ const WikiOutline = _ref => {
|
|
|
81
86
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
82
87
|
className: "sdoc-outline-wrapper wiki-outline-wrapper",
|
|
83
88
|
onMouseLeave: () => {
|
|
84
|
-
|
|
89
|
+
setIsShowOutlinePopover(false);
|
|
85
90
|
}
|
|
86
91
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
87
92
|
className: "sdoc-outline"
|
|
88
93
|
}, wikiOutlineList.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
89
94
|
className: "sdoc-outline-list-container",
|
|
90
95
|
onMouseOver: onMouseOver
|
|
91
|
-
}, wikiOutlineList.map((item, index) => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}))), isShowOutlinePopver && /*#__PURE__*/_react.default.createElement("div", {
|
|
98
|
-
className: "wiki-outline-popver",
|
|
96
|
+
}, wikiOutlineList.map((item, index) => /*#__PURE__*/_react.default.createElement(_outlineItem.default, {
|
|
97
|
+
key: index,
|
|
98
|
+
item: item,
|
|
99
|
+
isDisplayHorizontalBar: true
|
|
100
|
+
})))), isShowOutlinePopover && /*#__PURE__*/_react.default.createElement("div", {
|
|
101
|
+
className: "wiki-outline-popover",
|
|
99
102
|
ref: wikiOutlineRef
|
|
100
103
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
101
104
|
className: "sdoc-outline-list-container"
|
|
102
|
-
}, wikiOutlineList.map((item, index) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
});
|
|
107
|
-
}))));
|
|
105
|
+
}, wikiOutlineList.map((item, index) => /*#__PURE__*/_react.default.createElement(_outlineItem.default, {
|
|
106
|
+
key: index,
|
|
107
|
+
item: item
|
|
108
|
+
})))));
|
|
108
109
|
};
|
|
109
110
|
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(WikiOutline);
|
|
@@ -333,36 +333,36 @@ const getElementDiffValue = (currentContent, oldContent) => {
|
|
|
333
333
|
*/
|
|
334
334
|
const getDiff = function () {
|
|
335
335
|
let currentValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
336
|
-
|
|
336
|
+
elements: []
|
|
337
337
|
};
|
|
338
338
|
let oldValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
339
|
-
|
|
339
|
+
elements: []
|
|
340
340
|
};
|
|
341
341
|
if (!currentValue && !oldValue) return {
|
|
342
342
|
value: [],
|
|
343
343
|
changes: []
|
|
344
344
|
};
|
|
345
345
|
if (!currentValue && oldValue) return {
|
|
346
|
-
value: (0, _documentUtils.normalizeChildren)(oldValue.
|
|
346
|
+
value: (0, _documentUtils.normalizeChildren)(oldValue.elements),
|
|
347
347
|
changes: []
|
|
348
348
|
};
|
|
349
349
|
if (currentValue && !oldValue) return {
|
|
350
|
-
value: (0, _documentUtils.normalizeChildren)(currentValue.
|
|
350
|
+
value: (0, _documentUtils.normalizeChildren)(currentValue.elements),
|
|
351
351
|
changes: []
|
|
352
352
|
};
|
|
353
353
|
const {
|
|
354
354
|
version: currentVersion,
|
|
355
|
-
|
|
355
|
+
elements: currentContent
|
|
356
356
|
} = {
|
|
357
357
|
...currentValue,
|
|
358
|
-
|
|
358
|
+
elements: (0, _documentUtils.normalizeChildren)(currentValue.elements)
|
|
359
359
|
};
|
|
360
360
|
const {
|
|
361
361
|
version: oldVersion,
|
|
362
|
-
|
|
362
|
+
elements: oldContent
|
|
363
363
|
} = {
|
|
364
364
|
...oldValue,
|
|
365
|
-
|
|
365
|
+
elements: (0, _documentUtils.normalizeChildren)(oldValue.elements)
|
|
366
366
|
};
|
|
367
367
|
if (currentVersion === oldVersion) return {
|
|
368
368
|
value: currentContent,
|
|
@@ -53,7 +53,7 @@ const PublishedRevisionDiffViewer = _ref => {
|
|
|
53
53
|
return /*#__PURE__*/_react.default.createElement(_loading.default, null);
|
|
54
54
|
}
|
|
55
55
|
const document = {
|
|
56
|
-
|
|
56
|
+
elements: isShowChanges && (diff === null || diff === void 0 ? void 0 : diff.value) || revisionContent.elements
|
|
57
57
|
};
|
|
58
58
|
return /*#__PURE__*/_react.default.createElement(_sdocViewer.default, {
|
|
59
59
|
document: document,
|
|
@@ -51,7 +51,7 @@ const RevisionDiffViewer = _ref => {
|
|
|
51
51
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_sdocViewer.default, {
|
|
52
52
|
editor: editor,
|
|
53
53
|
document: {
|
|
54
|
-
|
|
54
|
+
elements: diff.value
|
|
55
55
|
},
|
|
56
56
|
showToolbar: true,
|
|
57
57
|
showOutline: true,
|
|
@@ -25,7 +25,7 @@ const SDocViewer = _ref => {
|
|
|
25
25
|
plugins = []
|
|
26
26
|
} = _ref;
|
|
27
27
|
const validEditor = editor || (0, _nodeId.default)((0, _extension.createDefaultEditor)());
|
|
28
|
-
const slateValue = (document || (0, _utils.generateDefaultDocContent)()).
|
|
28
|
+
const slateValue = (document || (0, _utils.generateDefaultDocContent)()).elements;
|
|
29
29
|
const Provider = showComment ? _hooks.CollaboratorsProvider : _react.Fragment;
|
|
30
30
|
return /*#__PURE__*/_react.default.createElement(Provider, null, /*#__PURE__*/_react.default.createElement(_hooks.PluginsProvider, {
|
|
31
31
|
plugins: plugins,
|
|
@@ -16,6 +16,7 @@ var _useColorContext = require("../hooks/use-color-context");
|
|
|
16
16
|
var _useScrollContext = require("../hooks/use-scroll-context");
|
|
17
17
|
var _wikiOutline = _interopRequireDefault(require("../wiki-outline"));
|
|
18
18
|
require("../assets/css/sdoc-wiki-viewer.css");
|
|
19
|
+
// maybe can be deleted in the future
|
|
19
20
|
const SDocMdViewer = _ref => {
|
|
20
21
|
let {
|
|
21
22
|
editor,
|
|
@@ -22,13 +22,6 @@ const useDocument = () => {
|
|
|
22
22
|
return new Promise((resolve, reject) => {
|
|
23
23
|
_context.default.getFileContent().then(res => {
|
|
24
24
|
let result = res.data;
|
|
25
|
-
if (result && !result.children) {
|
|
26
|
-
result = {
|
|
27
|
-
version: 0,
|
|
28
|
-
children: result.content,
|
|
29
|
-
cursors: result.cursors || {}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
25
|
resolve(result);
|
|
33
26
|
}).catch(error => {
|
|
34
27
|
// eslint-disable-next-line
|
|
@@ -30,12 +30,6 @@ class SimpleViewer extends _react.default.Component {
|
|
|
30
30
|
try {
|
|
31
31
|
const contentRes = await _context.default.getFileContent();
|
|
32
32
|
let result = contentRes.data || (0, _utils.generateDefaultDocContent)();
|
|
33
|
-
if (result && !result.children) {
|
|
34
|
-
result = {
|
|
35
|
-
version: 0,
|
|
36
|
-
children: result.content
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
33
|
this.setState({
|
|
40
34
|
isContextInit: true,
|
|
41
35
|
document: result
|
package/dist/utils/index.js
CHANGED