@seafile/sdoc-editor 1.0.186 → 1.0.187
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.
|
@@ -61,6 +61,7 @@ exports.getCodeBlockNode = getCodeBlockNode;
|
|
|
61
61
|
const changeToCodeBlock = function (editor) {
|
|
62
62
|
let language = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
63
63
|
let position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _constants.INSERT_POSITION.CURRENT;
|
|
64
|
+
let isQuickMenu = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
64
65
|
if (!editor.selection) return;
|
|
65
66
|
let strArr = []; // Summarizes the strings for the selected highest-level node
|
|
66
67
|
const path = _slate.Editor.path(editor, editor.selection, {
|
|
@@ -134,7 +135,11 @@ const changeToCodeBlock = function (editor) {
|
|
|
134
135
|
at: atPath
|
|
135
136
|
});
|
|
136
137
|
queueMicrotask(() => {
|
|
137
|
-
|
|
138
|
+
if (!isQuickMenu) {
|
|
139
|
+
_slate.Transforms.select(editor, atPoint);
|
|
140
|
+
} else {
|
|
141
|
+
(0, _core.focusEditor)(editor, atPoint);
|
|
142
|
+
}
|
|
138
143
|
});
|
|
139
144
|
}
|
|
140
145
|
};
|
|
@@ -88,7 +88,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
88
88
|
const onInsertCodeBlock = (0, _react.useCallback)(() => {
|
|
89
89
|
callback && callback();
|
|
90
90
|
const newInsertPosition = slateNode.type === _constants.ELEMENT_TYPE.LIST_ITEM ? _constants.INSERT_POSITION.AFTER : insertPosition;
|
|
91
|
-
(0, _helpers3.changeToCodeBlock)(editor, 'plaintext', newInsertPosition);
|
|
91
|
+
(0, _helpers3.changeToCodeBlock)(editor, 'plaintext', newInsertPosition, true);
|
|
92
92
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
93
93
|
}, [editor, insertPosition, slateNode]);
|
|
94
94
|
const onInsertList = (0, _react.useCallback)(type => {
|