@seafile/seafile-editor 2.0.47 → 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 baseEditor = (0, _extension.inlineEditor)();
44
- return (0, _withPropsEditor.default)(baseEditor, {
43
+ const _editor = (0, _extension.inlineEditor)();
44
+ return (0, _withPropsEditor.default)(_editor, {
45
45
  editorApi,
46
46
  onSave,
47
47
  columns,
@@ -15,6 +15,8 @@ var _eventHandler = _interopRequireDefault(require("../../utils/event-handler"))
15
15
  var _withPropsEditor = _interopRequireDefault(require("./with-props-editor"));
16
16
  var _core = require("../../extension/core");
17
17
  var _common = require("../../utils/common");
18
+ var _useAttachments = _interopRequireDefault(require("../../hooks/use-attachments"));
19
+ var _userLinkClick = _interopRequireDefault(require("../../hooks/user-link-click"));
18
20
  require("./style.css");
19
21
  const isMacOS = (0, _common.isMac)();
20
22
  const SimpleSlateEditor = _ref => {
@@ -29,14 +31,19 @@ const SimpleSlateEditor = _ref => {
29
31
  onExpandEditorToggle
30
32
  } = _ref;
31
33
  const [slateValue, setSlateValue] = (0, _react.useState)(value);
32
- const editor = (0, _react.useMemo)(() => (0, _withPropsEditor.default)(_extension.baseEditor, {
33
- editorApi,
34
- onSave,
35
- columns
36
- }), [columns, editorApi, onSave]);
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]);
37
42
  const eventProxy = (0, _react.useMemo)(() => {
38
43
  return new _eventHandler.default(editor);
39
44
  }, [editor]);
45
+ (0, _useAttachments.default)(editor);
46
+ (0, _userLinkClick.default)(editor._id);
40
47
  const decorate = (0, _extension.useHighlight)(editor);
41
48
  const onChange = (0, _react.useCallback)(value => {
42
49
  setSlateValue(value);
@@ -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)(() => (0, _withPropsEditor.default)(_extension.baseEditor, {
42
- editorApi,
43
- onSave
44
- }), [editorApi, onSave]);
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]);
@@ -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 = exports.baseEditor = _plugins.default.reduce((editor, pluginItem) => {
14
- const withPlugin = pluginItem.editorPlugin;
15
- if (withPlugin) {
16
- return withPlugin(editor);
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
- }, (0, _slateHistory.withHistory)((0, _slateReact.withReact)((0, _slate.createEditor)())));
23
+ };
24
+ exports.baseEditor = baseEditor;
21
25
  const inlineEditor = () => {
22
26
  const editor = _plugins.default.reduce((editor, pluginItem) => {
23
27
  const withPlugin = pluginItem.editorPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "2.0.47",
3
+ "version": "2.0.48-beta1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {