@seafile/seafile-editor 2.0.15 → 2.0.16

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.
@@ -16,6 +16,7 @@ var _constants = require("../../constants");
16
16
  require("./index.css");
17
17
  const LongTextInlineEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
18
18
  let {
19
+ isAlwaysEnableEdit = false,
19
20
  autoSave,
20
21
  isCheckBrowser,
21
22
  saveDelay,
@@ -26,7 +27,7 @@ const LongTextInlineEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) =>
26
27
  onSaveEditorValue,
27
28
  editorApi
28
29
  } = _ref;
29
- const [enableEdit, setEnableEdit] = (0, _react.useState)(false);
30
+ const [enableEdit, setEnableEdit] = (0, _react.useState)(isAlwaysEnableEdit);
30
31
  const valueRef = (0, _react.useRef)(typeof value === 'string' ? {
31
32
  text: value
32
33
  } : value);
@@ -37,14 +38,17 @@ const LongTextInlineEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) =>
37
38
  return (0, _getBrowserInfo.default)(isCheckBrowser);
38
39
  }, [isCheckBrowser]);
39
40
  const openEditor = (0, _react.useCallback)(() => {
41
+ if (isAlwaysEnableEdit) return;
40
42
  setEnableEdit(true);
41
- }, []);
43
+ }, [isAlwaysEnableEdit]);
42
44
  const closeEditor = (0, _react.useCallback)(() => {
43
45
  if (longTextValueChangedRef.current) {
44
46
  onSaveEditorValue(valueRef.current);
45
47
  }
46
- setEnableEdit(false);
47
- }, [longTextValueChangedRef, valueRef, onSaveEditorValue]);
48
+ if (!isAlwaysEnableEdit) {
49
+ setEnableEdit(false);
50
+ }
51
+ }, [isAlwaysEnableEdit, longTextValueChangedRef, valueRef, onSaveEditorValue]);
48
52
  const onEditorValueChanged = (0, _react.useCallback)(value => {
49
53
  valueRef.current = value;
50
54
  longTextValueChangedRef.current = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "2.0.15",
3
+ "version": "2.0.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {