@seafile/seafile-editor 1.0.32-3 → 1.0.32-4
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.
|
@@ -19,29 +19,24 @@ export default function LongTextEditorDialog(_ref) {
|
|
|
19
19
|
editorApi,
|
|
20
20
|
onSaveEditorValue,
|
|
21
21
|
onEditorValueChanged,
|
|
22
|
-
onCloseEditorDialog
|
|
23
|
-
valueLimitCallback
|
|
22
|
+
onCloseEditorDialog
|
|
24
23
|
} = _ref;
|
|
25
24
|
const editorRef = useRef(null);
|
|
26
25
|
const [isValueChanged, setValueChanged] = useState(false);
|
|
27
26
|
const [isFullScreen, setIsFullScreen] = useState(false);
|
|
28
27
|
const [dialogStyle, setDialogStyle] = useState({});
|
|
29
28
|
const onUpdateEditorValue = useCallback(() => {
|
|
30
|
-
var _editorRef$current;
|
|
31
|
-
if (!isValueChanged) return;
|
|
29
|
+
var _editorRef$current, _editorRef$current2;
|
|
30
|
+
if (!isValueChanged || readOnly) return;
|
|
32
31
|
const markdownString = (_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 ? void 0 : _editorRef$current.getValue();
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
setValueChanged(false);
|
|
43
|
-
}
|
|
44
|
-
}, [isValueChanged, onSaveEditorValue, valueLimitCallback]);
|
|
32
|
+
const slateNodes = (_editorRef$current2 = editorRef.current) === null || _editorRef$current2 === void 0 ? void 0 : _editorRef$current2.getSlateValue();
|
|
33
|
+
const value = getPreviewContent(slateNodes);
|
|
34
|
+
onSaveEditorValue({
|
|
35
|
+
...value,
|
|
36
|
+
text: markdownString
|
|
37
|
+
});
|
|
38
|
+
setValueChanged(false);
|
|
39
|
+
}, [isValueChanged, onSaveEditorValue, readOnly]);
|
|
45
40
|
const onCloseToggle = useCallback(() => {
|
|
46
41
|
onUpdateEditorValue();
|
|
47
42
|
onCloseEditorDialog();
|