@seafile/sdoc-editor 0.5.79 → 1.0.0
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/extension/plugins/link/plugin.js +1 -1
- package/dist/basic-sdk/extension/plugins/table/helpers.js +1 -0
- package/dist/basic-sdk/extension/toolbar/insert-element-toolbar/index.js +8 -8
- package/dist/basic-sdk/extension/toolbar/side-toolbar/index.js +2 -2
- package/package.json +1 -1
|
@@ -83,7 +83,7 @@ const withLink = editor => {
|
|
|
83
83
|
});
|
|
84
84
|
} else {
|
|
85
85
|
const [firstSelectedNode, ...restNodes] = getSelectedElems(newEditor);
|
|
86
|
-
if (!firstSelectedNode || restNodes) return; // If select more than one node or not select any node, return
|
|
86
|
+
if (!firstSelectedNode || restNodes.length) return; // If select more than one node or not select any node, return
|
|
87
87
|
const isSelectTextNodes = firstSelectedNode.children.some(node => Text.isText(node));
|
|
88
88
|
if (!isSelectTextNodes) return;
|
|
89
89
|
const selectContent = window.getSelection().toString();
|
|
@@ -30,6 +30,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
30
30
|
const renderItemListRef = useRef([]);
|
|
31
31
|
const downDownWrapperRef = useRef(null);
|
|
32
32
|
const onInsertImageToggle = useCallback(() => {
|
|
33
|
+
callback && callback();
|
|
33
34
|
const eventBus = EventBus.getInstance();
|
|
34
35
|
if (insertPosition === INSERT_POSITION.CURRENT) {
|
|
35
36
|
Transforms.select(editor, editor.selection.focus);
|
|
@@ -39,47 +40,47 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
39
40
|
insertPosition,
|
|
40
41
|
slateNode
|
|
41
42
|
});
|
|
42
|
-
callback && callback();
|
|
43
43
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
44
|
}, [editor, insertPosition]);
|
|
45
45
|
const createTable = useCallback(size => {
|
|
46
|
+
callback && callback();
|
|
46
47
|
const newInsertPosition = slateNode.type === ELEMENT_TYPE.LIST_ITEM ? INSERT_POSITION.AFTER : insertPosition;
|
|
47
48
|
insertTable(editor, size, editor.selection, newInsertPosition);
|
|
48
|
-
callback && callback();
|
|
49
49
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
50
|
}, [editor, insertPosition, slateNode]);
|
|
51
51
|
const openLinkDialog = useCallback(() => {
|
|
52
|
+
callback && callback();
|
|
52
53
|
const eventBus = EventBus.getInstance();
|
|
53
54
|
eventBus.dispatch(INTERNAL_EVENT.INSERT_ELEMENT, {
|
|
54
55
|
type: ELEMENT_TYPE.LINK,
|
|
55
56
|
insertPosition,
|
|
56
57
|
slateNode
|
|
57
58
|
});
|
|
58
|
-
callback && callback();
|
|
59
59
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
60
|
}, [insertPosition]);
|
|
61
61
|
const onInsertCodeBlock = useCallback(() => {
|
|
62
|
+
callback && callback();
|
|
62
63
|
const newInsertPosition = slateNode.type === ELEMENT_TYPE.LIST_ITEM ? INSERT_POSITION.AFTER : insertPosition;
|
|
63
64
|
changeToCodeBlock(editor, 'plaintext', newInsertPosition);
|
|
64
|
-
callback && callback();
|
|
65
65
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
66
66
|
}, [editor, insertPosition, slateNode]);
|
|
67
67
|
const onInsertList = useCallback(type => {
|
|
68
|
-
toggleList(editor, type, insertPosition);
|
|
69
68
|
callback && callback();
|
|
69
|
+
toggleList(editor, type, insertPosition);
|
|
70
70
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
71
71
|
}, [editor, insertPosition, slateNode]);
|
|
72
72
|
const onInsertCheckList = useCallback(() => {
|
|
73
|
-
setCheckListItemType(editor, ELEMENT_TYPE.CHECK_LIST_ITEM, insertPosition);
|
|
74
73
|
callback && callback();
|
|
74
|
+
setCheckListItemType(editor, ELEMENT_TYPE.CHECK_LIST_ITEM, insertPosition);
|
|
75
75
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
76
76
|
}, [editor, insertPosition, slateNode]);
|
|
77
77
|
const onInsert = useCallback(type => {
|
|
78
|
-
insertElement(editor, type, insertPosition);
|
|
79
78
|
callback && callback();
|
|
79
|
+
insertElement(editor, type, insertPosition);
|
|
80
80
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
81
|
}, [editor, insertPosition, slateNode]);
|
|
82
82
|
const onInsertCallout = useCallback(type => {
|
|
83
|
+
callback && callback();
|
|
83
84
|
if (insertPosition === INSERT_POSITION.CURRENT) {
|
|
84
85
|
wrapCallout(editor);
|
|
85
86
|
Transforms.removeNodes(editor, {
|
|
@@ -89,7 +90,6 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
89
90
|
insertElement(editor, type, insertPosition);
|
|
90
91
|
wrapCallout(editor);
|
|
91
92
|
}
|
|
92
|
-
callback && callback();
|
|
93
93
|
}, [callback, editor, insertPosition]);
|
|
94
94
|
const isDisableCallout = useMemo(() => {
|
|
95
95
|
const callout = getAboveBlockNode(editor, {
|
|
@@ -33,9 +33,9 @@ const SideToolbar = () => {
|
|
|
33
33
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
34
|
}, []);
|
|
35
35
|
const handleClick = useCallback(e => {
|
|
36
|
-
if (!isShowSideMenu) return;
|
|
36
|
+
if (!isShowSideMenu || !menuRef.current) return;
|
|
37
37
|
const isClickSideTool = menuRef.current.contains(e.target);
|
|
38
|
-
if (isClickSideTool) return;
|
|
38
|
+
if (isClickSideTool || !sideMenuRef.current) return;
|
|
39
39
|
const {
|
|
40
40
|
sideMenuDom
|
|
41
41
|
} = sideMenuRef.current;
|