@seafile/seafile-editor 2.0.48-beta → 2.0.48-beta1
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.
|
@@ -40,8 +40,8 @@ const InlineEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
40
40
|
const [slateValue, setSlateValue] = (0, _react.useState)(value);
|
|
41
41
|
const focusRangeRef = (0, _react.useRef)(null);
|
|
42
42
|
const editor = (0, _react.useMemo)(() => {
|
|
43
|
-
const
|
|
44
|
-
return (0, _withPropsEditor.default)(
|
|
43
|
+
const _editor = (0, _extension.inlineEditor)();
|
|
44
|
+
return (0, _withPropsEditor.default)(_editor, {
|
|
45
45
|
editorApi,
|
|
46
46
|
onSave,
|
|
47
47
|
columns,
|
|
@@ -31,11 +31,14 @@ const SimpleSlateEditor = _ref => {
|
|
|
31
31
|
onExpandEditorToggle
|
|
32
32
|
} = _ref;
|
|
33
33
|
const [slateValue, setSlateValue] = (0, _react.useState)(value);
|
|
34
|
-
const editor = (0, _react.useMemo)(() =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
const editor = (0, _react.useMemo)(() => {
|
|
35
|
+
const _editor = (0, _extension.baseEditor)();
|
|
36
|
+
return (0, _withPropsEditor.default)(_editor, {
|
|
37
|
+
editorApi,
|
|
38
|
+
onSave,
|
|
39
|
+
columns
|
|
40
|
+
});
|
|
41
|
+
}, [columns, editorApi, onSave]);
|
|
39
42
|
const eventProxy = (0, _react.useMemo)(() => {
|
|
40
43
|
return new _eventHandler.default(editor);
|
|
41
44
|
}, [editor]);
|
|
@@ -38,10 +38,13 @@ function SlateEditor(_ref) {
|
|
|
38
38
|
const {
|
|
39
39
|
containerStyle
|
|
40
40
|
} = (0, _useContainerStyle.default)(scrollRef);
|
|
41
|
-
const editor = (0, _react.useMemo)(() =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
const editor = (0, _react.useMemo)(() => {
|
|
42
|
+
const _editor = (0, _extension.baseEditor)();
|
|
43
|
+
return (0, _withPropsEditor.default)(_editor, {
|
|
44
|
+
editorApi,
|
|
45
|
+
onSave
|
|
46
|
+
});
|
|
47
|
+
}, [editorApi, onSave]);
|
|
45
48
|
const eventProxy = (0, _react.useMemo)(() => {
|
|
46
49
|
return new _eventHandler.default(editor);
|
|
47
50
|
}, [editor]);
|
package/dist/extension/editor.js
CHANGED
|
@@ -10,14 +10,18 @@ var _slateHistory = require("slate-history");
|
|
|
10
10
|
var _slateReact = require("slate-react");
|
|
11
11
|
var _slugid = require("slugid");
|
|
12
12
|
var _plugins = _interopRequireDefault(require("./plugins"));
|
|
13
|
-
const baseEditor =
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
const baseEditor = () => {
|
|
14
|
+
const editor = _plugins.default.reduce((editor, pluginItem) => {
|
|
15
|
+
const withPlugin = pluginItem.editorPlugin;
|
|
16
|
+
if (withPlugin) {
|
|
17
|
+
return withPlugin(editor);
|
|
18
|
+
}
|
|
19
|
+
return editor;
|
|
20
|
+
}, (0, _slateHistory.withHistory)((0, _slateReact.withReact)((0, _slate.createEditor)())));
|
|
18
21
|
editor._id = (0, _slugid.nice)();
|
|
19
22
|
return editor;
|
|
20
|
-
}
|
|
23
|
+
};
|
|
24
|
+
exports.baseEditor = baseEditor;
|
|
21
25
|
const inlineEditor = () => {
|
|
22
26
|
const editor = _plugins.default.reduce((editor, pluginItem) => {
|
|
23
27
|
const withPlugin = pluginItem.editorPlugin;
|