@seafile/sdoc-editor 0.5.76 → 0.5.77
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/constants/index.js +1 -0
- package/dist/basic-sdk/extension/plugins/paragraph/render-elem.js +1 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/index.css +14 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/index.js +15 -6
- package/dist/basic-sdk/utils/dom-utils.js +3 -1
- package/dist/pages/document-plugin-editor.js +2 -2
- package/package.json +1 -1
- package/public/locales/cs/sdoc-editor.json +1 -1
- package/public/locales/de/sdoc-editor.json +1 -1
- package/public/locales/es/sdoc-editor.json +1 -1
- package/public/locales/es_AR/sdoc-editor.json +1 -1
- package/public/locales/es_MX/sdoc-editor.json +1 -1
- package/public/locales/fr/sdoc-editor.json +1 -1
- package/public/locales/it/sdoc-editor.json +1 -1
- package/public/locales/ru/sdoc-editor.json +2 -2
- package/public/locales/zh_CN/sdoc-editor.json +1 -1
|
@@ -33,6 +33,7 @@ export const PAGE_EDIT_AREA_WIDTH = 672; // 672 = 794 - 2[borderLeft + borderRig
|
|
|
33
33
|
export const COMMENT_EDITOR_EDIT_AREA_WIDTH = 364;
|
|
34
34
|
export const COMMENT_EDITOR = 'comment_editor';
|
|
35
35
|
export const WIKI_EDITOR = 'wiki_editor';
|
|
36
|
+
export const DOCUMENT_PLUGIN_EDITOR = 'document_plugin_editor';
|
|
36
37
|
export const MODIFY_TYPE = {
|
|
37
38
|
ADD: 'add',
|
|
38
39
|
DELETE: 'delete',
|
|
@@ -33,7 +33,7 @@ const Paragraph = _ref => {
|
|
|
33
33
|
const node = editor.children[1];
|
|
34
34
|
isShowPlaceHolder = Node.string(element) === '' && (node === null || node === void 0 ? void 0 : node.id) === (element === null || element === void 0 ? void 0 : element.id) && !isComposing;
|
|
35
35
|
}
|
|
36
|
-
if (isSelected && isWikiEditor && Range.isCollapsed(editor.selection) && isEmptyNode(element)) {
|
|
36
|
+
if (isSelected && isWikiEditor && Range.isCollapsed(editor.selection) && isEmptyNode(element) && !isComposing) {
|
|
37
37
|
isShowPlaceHolder = true;
|
|
38
38
|
}
|
|
39
39
|
const style = {
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
width: 24px;
|
|
9
9
|
height: 24px;
|
|
10
10
|
border-radius: 3px;
|
|
11
|
-
transition: all 0.2s;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
.sdoc-side-toolbar-container:hover {
|
|
@@ -32,3 +31,17 @@
|
|
|
32
31
|
background-color: #F2F2F2;
|
|
33
32
|
border-radius: 2px;
|
|
34
33
|
}
|
|
34
|
+
|
|
35
|
+
@keyframes fade-out {
|
|
36
|
+
from {
|
|
37
|
+
opacity: 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
to {
|
|
41
|
+
opacity: 0.3;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.fade-out {
|
|
46
|
+
animation: fade-out 0.15s ease-out;
|
|
47
|
+
}
|
|
@@ -24,6 +24,7 @@ const SideToolbar = () => {
|
|
|
24
24
|
const [isShowSideMenu, setShowSideMenu] = useState(false);
|
|
25
25
|
const [menuPosition, setMenuPosition] = useState({});
|
|
26
26
|
const [isEnterMoreVertical, setIsEnterMoreVertical] = useState(false);
|
|
27
|
+
const [isMoving, setIsMoving] = useState(false);
|
|
27
28
|
const sideMenuRef = useRef();
|
|
28
29
|
const onReset = useCallback(() => {
|
|
29
30
|
setShowSideMenu(false);
|
|
@@ -74,10 +75,15 @@ const SideToolbar = () => {
|
|
|
74
75
|
const top = getDomTopHeight(editor, dom, node);
|
|
75
76
|
const isEmpty = isVoidNode(node);
|
|
76
77
|
const offsetY = !editor.editorType ? -1 : 0; // editorType is undefined means sdoc editor
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
const topValue = top + scrollRef.current.scrollTop + offsetY;
|
|
79
|
+
if (topValue !== sidePosition.top) setIsMoving(true);
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
// wait animation
|
|
82
|
+
setSidePosition({
|
|
83
|
+
top: topValue,
|
|
84
|
+
left: 20
|
|
85
|
+
});
|
|
86
|
+
}, 150);
|
|
81
87
|
setSlateNode(node);
|
|
82
88
|
setNodeEmpty(isEmpty);
|
|
83
89
|
};
|
|
@@ -86,7 +92,7 @@ const SideToolbar = () => {
|
|
|
86
92
|
return unSubscribeMouseEnter;
|
|
87
93
|
|
|
88
94
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
89
|
-
}, [editor, isShowSideMenu, scrollRef]);
|
|
95
|
+
}, [editor, isShowSideMenu, scrollRef, sidePosition.top]);
|
|
90
96
|
const onShowSideMenuToggle = useCallback(() => {
|
|
91
97
|
setSelection(editor, slateNode);
|
|
92
98
|
const {
|
|
@@ -249,7 +255,10 @@ const SideToolbar = () => {
|
|
|
249
255
|
setIsEnterMoreVertical(false);
|
|
250
256
|
}, []);
|
|
251
257
|
return /*#__PURE__*/React.createElement("div", {
|
|
252
|
-
|
|
258
|
+
onAnimationEnd: () => setIsMoving(false),
|
|
259
|
+
className: classnames('sdoc-side-toolbar-container', {
|
|
260
|
+
'fade-out': isMoving
|
|
261
|
+
}),
|
|
253
262
|
style: sidePosition
|
|
254
263
|
}, slateNode && /*#__PURE__*/React.createElement("div", {
|
|
255
264
|
ref: menuRef,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WIKI_EDITOR } from '../constants';
|
|
1
|
+
import { WIKI_EDITOR, DOCUMENT_PLUGIN_EDITOR } from '../constants';
|
|
2
2
|
export const getDomHeight = dom => {
|
|
3
3
|
const styles = window.getComputedStyle(dom);
|
|
4
4
|
const rect = dom.getBoundingClientRect();
|
|
@@ -59,6 +59,8 @@ export const getHeaderHeight = editor => {
|
|
|
59
59
|
switch (editorType) {
|
|
60
60
|
case WIKI_EDITOR:
|
|
61
61
|
return 113.2;
|
|
62
|
+
case DOCUMENT_PLUGIN_EDITOR:
|
|
63
|
+
return 38 + 48 + 49 + 37;
|
|
62
64
|
default:
|
|
63
65
|
// sdoc-editor-page-header height = 56
|
|
64
66
|
// sdoc-editor-toolbar height = 37
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useMemo } from 'react';
|
|
|
2
2
|
import { withTranslation } from 'react-i18next';
|
|
3
3
|
import context from '../context';
|
|
4
4
|
import { SDocEditor } from '../basic-sdk';
|
|
5
|
-
import { PAGE_EDIT_AREA_WIDTH } from '../basic-sdk/constants';
|
|
5
|
+
import { PAGE_EDIT_AREA_WIDTH, DOCUMENT_PLUGIN_EDITOR } from '../basic-sdk/constants';
|
|
6
6
|
import { createDefaultEditor } from '../basic-sdk/extension';
|
|
7
7
|
import withNodeId from '../basic-sdk/node-id';
|
|
8
8
|
import { withSocketIO } from '../basic-sdk/socket';
|
|
@@ -50,7 +50,7 @@ const DocumentPluginEditor = _ref => {
|
|
|
50
50
|
newEditor.getTableCellValue = getTableCellValue;
|
|
51
51
|
newEditor.cursors = cursors || {};
|
|
52
52
|
newEditor.width = PAGE_EDIT_AREA_WIDTH; // default width
|
|
53
|
-
|
|
53
|
+
newEditor.editorType = DOCUMENT_PLUGIN_EDITOR;
|
|
54
54
|
return newEditor;
|
|
55
55
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
56
|
}, []);
|
package/package.json
CHANGED
|
@@ -461,6 +461,6 @@
|
|
|
461
461
|
"Enter_text_or_press_forward_slash_to_insert_element": "Введите текст или нажмите '/', чтобы вставить элемент",
|
|
462
462
|
"Vertical_align": "Вертикальное выравнивание",
|
|
463
463
|
"Horizontal_align": "Горизонтальное выравнивание",
|
|
464
|
-
"SeaTable_column": "SeaTable
|
|
465
|
-
"
|
|
464
|
+
"SeaTable_column": "Столбец SeaTable",
|
|
465
|
+
"SeaTable_table": "SeaTable table"
|
|
466
466
|
}
|