@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 isValueValid = valueLimitCallback ? valueLimitCallback(markdownString) : true;
34
- if (isValueValid) {
35
- var _editorRef$current2;
36
- const slateNodes = (_editorRef$current2 = editorRef.current) === null || _editorRef$current2 === void 0 ? void 0 : _editorRef$current2.getSlateValue();
37
- const value = getPreviewContent(slateNodes);
38
- onSaveEditorValue({
39
- ...value,
40
- text: markdownString
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "1.0.32-3",
3
+ "version": "1.0.32-4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {