@seafile/seafile-editor 1.0.127 → 1.0.128
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.
|
@@ -20,6 +20,7 @@ const isMacOS = (0, _common.isMac)();
|
|
|
20
20
|
const SimpleSlateEditor = _ref => {
|
|
21
21
|
let {
|
|
22
22
|
value,
|
|
23
|
+
focusEnd,
|
|
23
24
|
editorApi,
|
|
24
25
|
onSave,
|
|
25
26
|
columns,
|
|
@@ -54,12 +55,21 @@ const SimpleSlateEditor = _ref => {
|
|
|
54
55
|
const [firstNodeFirstChild] = firstNode.children;
|
|
55
56
|
if (firstNodeFirstChild) {
|
|
56
57
|
const startOfFirstNode = _slate.Editor.start(editor, [0, 0]);
|
|
57
|
-
|
|
58
|
+
let range = {
|
|
58
59
|
anchor: startOfFirstNode,
|
|
59
60
|
focus: startOfFirstNode
|
|
60
61
|
};
|
|
62
|
+
if (focusEnd) {
|
|
63
|
+
const firstNode = editor.children[0];
|
|
64
|
+
const endOfFirstNode = _slate.Editor.end(editor, [0, firstNode.children.length - 1]);
|
|
65
|
+
range = {
|
|
66
|
+
anchor: endOfFirstNode,
|
|
67
|
+
focus: endOfFirstNode
|
|
68
|
+
};
|
|
69
|
+
}
|
|
61
70
|
(0, _core.focusEditor)(editor, range);
|
|
62
71
|
}
|
|
72
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
73
|
}, []);
|
|
64
74
|
|
|
65
75
|
// const focusEndNode = useCallback((editor) => {
|
|
@@ -22,6 +22,7 @@ function LongTextEditorDialog(_ref) {
|
|
|
22
22
|
value,
|
|
23
23
|
autoSave = true,
|
|
24
24
|
saveDelay = 60000,
|
|
25
|
+
focusEnd = false,
|
|
25
26
|
isCheckBrowser = false,
|
|
26
27
|
mathJaxSource,
|
|
27
28
|
className,
|
|
@@ -179,6 +180,7 @@ function LongTextEditorDialog(_ref) {
|
|
|
179
180
|
}, !readOnly && !isWindowsWechat && /*#__PURE__*/_react.default.createElement(_simpleEditor.default, {
|
|
180
181
|
ref: editorRef,
|
|
181
182
|
value: value,
|
|
183
|
+
focusEnd: focusEnd,
|
|
182
184
|
editorApi: editorApi,
|
|
183
185
|
mathJaxSource: mathJaxSource,
|
|
184
186
|
onContentChanged: onContentChanged
|
|
@@ -17,6 +17,7 @@ const SimpleEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
17
17
|
isInline,
|
|
18
18
|
isFetching,
|
|
19
19
|
value,
|
|
20
|
+
focusEnd = false,
|
|
20
21
|
editorApi,
|
|
21
22
|
mathJaxSource,
|
|
22
23
|
onSave: propsOnSave,
|
|
@@ -54,6 +55,7 @@ const SimpleEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
54
55
|
const props = {
|
|
55
56
|
isSupportFormula: !!mathJaxSource,
|
|
56
57
|
value: richValue,
|
|
58
|
+
focusEnd,
|
|
57
59
|
editorApi: editorApi,
|
|
58
60
|
onSave: propsOnSave,
|
|
59
61
|
onContentChanged: onContentChanged,
|