@seafile/sdoc-editor 0.5.37 → 0.5.38
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/editor/sdoc-editor.js +11 -8
- package/dist/basic-sdk/extension/toolbar/side-toolbar/helpers.js +3 -3
- package/dist/basic-sdk/layout/editor-content.js +5 -3
- package/dist/basic-sdk/views/published-revision-diff-viewer.js +2 -1
- package/dist/basic-sdk/views/revision-diff-viewer.js +7 -5
- package/dist/basic-sdk/views/sdoc-diff-viewer.js +4 -3
- package/dist/basic-sdk/views/sdoc-viewer.js +4 -2
- package/package.json +1 -1
|
@@ -115,6 +115,11 @@ const SdocEditor = forwardRef((_ref, ref) => {
|
|
|
115
115
|
|
|
116
116
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
117
117
|
}), [document, validEditor, slateValue]);
|
|
118
|
+
const onValueChange = value => {
|
|
119
|
+
const eventBus = EventBus.getInstance();
|
|
120
|
+
eventBus.dispatch(INTERNAL_EVENT.UPDATE_SEARCH_REPLACE_HIGHLIGHT, value);
|
|
121
|
+
setSlateValue(value);
|
|
122
|
+
};
|
|
118
123
|
const isFreezed = context.getSetting('isFreezed');
|
|
119
124
|
if (isReloading) {
|
|
120
125
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -129,7 +134,8 @@ const SdocEditor = forwardRef((_ref, ref) => {
|
|
|
129
134
|
docValue: slateValue,
|
|
130
135
|
readonly: true,
|
|
131
136
|
showOutline: false,
|
|
132
|
-
editor: validEditor
|
|
137
|
+
editor: validEditor,
|
|
138
|
+
showComment: false
|
|
133
139
|
}, /*#__PURE__*/React.createElement(ReadOnlyArticle, {
|
|
134
140
|
editor: validEditor,
|
|
135
141
|
slateValue: slateValue
|
|
@@ -146,18 +152,14 @@ const SdocEditor = forwardRef((_ref, ref) => {
|
|
|
146
152
|
docValue: slateValue,
|
|
147
153
|
showOutline: true,
|
|
148
154
|
readonly: isFreezed,
|
|
149
|
-
editor: validEditor
|
|
155
|
+
editor: validEditor,
|
|
156
|
+
showComment: true
|
|
150
157
|
}, /*#__PURE__*/React.createElement(ReadOnlyArticle, {
|
|
151
158
|
editor: validEditor,
|
|
152
159
|
slateValue: slateValue,
|
|
153
160
|
isShowComment: true
|
|
154
161
|
})))));
|
|
155
162
|
}
|
|
156
|
-
const onValueChange = value => {
|
|
157
|
-
const eventBus = EventBus.getInstance();
|
|
158
|
-
eventBus.dispatch(INTERNAL_EVENT.UPDATE_SEARCH_REPLACE_HIGHLIGHT, value);
|
|
159
|
-
setSlateValue(value);
|
|
160
|
-
};
|
|
161
163
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditorContainer, {
|
|
162
164
|
editor: validEditor
|
|
163
165
|
}, /*#__PURE__*/React.createElement(CollaboratorsProvider, null, /*#__PURE__*/React.createElement(ColorProvider, null, /*#__PURE__*/React.createElement(HeaderToolbar, {
|
|
@@ -165,7 +167,8 @@ const SdocEditor = forwardRef((_ref, ref) => {
|
|
|
165
167
|
}), /*#__PURE__*/React.createElement(EditorContent, {
|
|
166
168
|
docValue: slateValue,
|
|
167
169
|
showOutline: true,
|
|
168
|
-
editor: validEditor
|
|
170
|
+
editor: validEditor,
|
|
171
|
+
showComment: true
|
|
169
172
|
}, /*#__PURE__*/React.createElement(EditableArticle, {
|
|
170
173
|
editor: validEditor,
|
|
171
174
|
slateValue: slateValue,
|
|
@@ -88,11 +88,11 @@ export const getDomTopHeight = (dom, slateNode) => {
|
|
|
88
88
|
const rect = dom.getBoundingClientRect();
|
|
89
89
|
let offsetY = 0;
|
|
90
90
|
const paddingTop = parseFloat(window.getComputedStyle(dom).getPropertyValue('padding-top'));
|
|
91
|
-
const
|
|
91
|
+
const lineHeight = parseFloat(window.getComputedStyle(dom).getPropertyValue('line-height'));
|
|
92
|
+
const disToolBarHeight = 12; // side toolbar icon is 12 px
|
|
92
93
|
if (ADD_POSITION_OFFSET_TYPE.includes(slateNode.type)) {
|
|
93
|
-
offsetY =
|
|
94
|
+
offsetY = lineHeight / 2 + paddingTop - disToolBarHeight / 2;
|
|
94
95
|
}
|
|
95
|
-
|
|
96
96
|
const HEADER_HEIGHT = 56 + 44;
|
|
97
97
|
return rect.y - HEADER_HEIGHT + offsetY;
|
|
98
98
|
};
|
|
@@ -11,7 +11,8 @@ const EditorContent = _ref => {
|
|
|
11
11
|
showOutline,
|
|
12
12
|
children,
|
|
13
13
|
docValue,
|
|
14
|
-
editor
|
|
14
|
+
editor,
|
|
15
|
+
showComment
|
|
15
16
|
} = _ref;
|
|
16
17
|
const scrollRef = useRef(null);
|
|
17
18
|
const [scrollLeft, setScrollLeft] = useState(0);
|
|
@@ -25,7 +26,7 @@ const EditorContent = _ref => {
|
|
|
25
26
|
'readonly': readonly,
|
|
26
27
|
'no-outline': !showOutline
|
|
27
28
|
});
|
|
28
|
-
if (
|
|
29
|
+
if (!showComment) {
|
|
29
30
|
return /*#__PURE__*/React.createElement("div", {
|
|
30
31
|
className: "sdoc-content-wrapper"
|
|
31
32
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -69,6 +70,7 @@ const EditorContent = _ref => {
|
|
|
69
70
|
};
|
|
70
71
|
EditorContent.defaultProps = {
|
|
71
72
|
readonly: false,
|
|
72
|
-
showOutline: true
|
|
73
|
+
showOutline: true,
|
|
74
|
+
showComment: false
|
|
73
75
|
};
|
|
74
76
|
export default EditorContent;
|
|
@@ -48,9 +48,10 @@ const PublishedRevisionDiffViewer = _ref => {
|
|
|
48
48
|
children: isShowChanges && (diff === null || diff === void 0 ? void 0 : diff.value) || revisionContent.children
|
|
49
49
|
};
|
|
50
50
|
return /*#__PURE__*/React.createElement(SDocViewer, {
|
|
51
|
+
document: document,
|
|
51
52
|
showToolbar: true,
|
|
52
53
|
showOutline: true,
|
|
53
|
-
|
|
54
|
+
showComment: false
|
|
54
55
|
});
|
|
55
56
|
};
|
|
56
57
|
export default PublishedRevisionDiffViewer;
|
|
@@ -3,6 +3,7 @@ import context from '../../context';
|
|
|
3
3
|
import { getDiff } from '../utils/diff';
|
|
4
4
|
import SDocViewer from './sdoc-viewer';
|
|
5
5
|
import Loading from '../../components/loading';
|
|
6
|
+
import { CollaboratorsProvider } from '../../hooks';
|
|
6
7
|
import '../../assets/css/diff-viewer.css';
|
|
7
8
|
const RevisionDiffViewer = _ref => {
|
|
8
9
|
let {
|
|
@@ -39,13 +40,14 @@ const RevisionDiffViewer = _ref => {
|
|
|
39
40
|
if (isLoading) {
|
|
40
41
|
return /*#__PURE__*/React.createElement(Loading, null);
|
|
41
42
|
}
|
|
42
|
-
return /*#__PURE__*/React.createElement(SDocViewer, {
|
|
43
|
-
showToolbar: true,
|
|
44
|
-
showOutline: true,
|
|
43
|
+
return /*#__PURE__*/React.createElement(CollaboratorsProvider, null, /*#__PURE__*/React.createElement(SDocViewer, {
|
|
45
44
|
editor: editor,
|
|
46
45
|
document: {
|
|
47
46
|
children: diff.value
|
|
48
|
-
}
|
|
49
|
-
|
|
47
|
+
},
|
|
48
|
+
showToolbar: true,
|
|
49
|
+
showOutline: true,
|
|
50
|
+
showComment: true
|
|
51
|
+
}));
|
|
50
52
|
};
|
|
51
53
|
export default RevisionDiffViewer;
|
|
@@ -17,11 +17,12 @@ const DiffViewer = _ref => {
|
|
|
17
17
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
18
|
}, []);
|
|
19
19
|
return /*#__PURE__*/React.createElement(SDocViewer, {
|
|
20
|
-
showToolbar: false,
|
|
21
|
-
showOutline: false,
|
|
22
20
|
document: {
|
|
23
21
|
children: diff.value
|
|
24
|
-
}
|
|
22
|
+
},
|
|
23
|
+
showToolbar: false,
|
|
24
|
+
showOutline: false,
|
|
25
|
+
showComment: false
|
|
25
26
|
});
|
|
26
27
|
};
|
|
27
28
|
export default DiffViewer;
|
|
@@ -11,7 +11,8 @@ const SDocViewer = _ref => {
|
|
|
11
11
|
editor,
|
|
12
12
|
document,
|
|
13
13
|
showToolbar,
|
|
14
|
-
showOutline
|
|
14
|
+
showOutline,
|
|
15
|
+
showComment
|
|
15
16
|
} = _ref;
|
|
16
17
|
const validEditor = editor || withNodeId(createDefaultEditor());
|
|
17
18
|
const slateValue = (document || generateDefaultDocContent()).children;
|
|
@@ -25,7 +26,8 @@ const SDocViewer = _ref => {
|
|
|
25
26
|
docValue: slateValue,
|
|
26
27
|
readonly: true,
|
|
27
28
|
showOutline: showOutline,
|
|
28
|
-
editor: validEditor
|
|
29
|
+
editor: validEditor,
|
|
30
|
+
showComment: showComment
|
|
29
31
|
}, /*#__PURE__*/React.createElement(ReadOnlyArticle, {
|
|
30
32
|
editor: validEditor,
|
|
31
33
|
slateValue: slateValue
|