@seafile/seafile-editor 1.0.128 → 1.0.130

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.
@@ -60,11 +60,12 @@ const SimpleSlateEditor = _ref => {
60
60
  focus: startOfFirstNode
61
61
  };
62
62
  if (focusEnd) {
63
- const firstNode = editor.children[0];
64
- const endOfFirstNode = _slate.Editor.end(editor, [0, firstNode.children.length - 1]);
63
+ const lastIndex = editor.children.length - 1;
64
+ const [, path] = _slate.Editor.last(editor, [lastIndex]);
65
+ const endOfLastNodePoint = _slate.Editor.end(editor, path);
65
66
  range = {
66
- anchor: endOfFirstNode,
67
- focus: endOfFirstNode
67
+ anchor: endOfLastNodePoint,
68
+ focus: endOfLastNodePoint
68
69
  };
69
70
  }
70
71
  (0, _core.focusEditor)(editor, range);
@@ -26,7 +26,7 @@ function SlateViewer(_ref) {
26
26
  const scrollRef = (0, _react.useRef)(null);
27
27
  const {
28
28
  containerStyle
29
- } = (0, _useContainerStyle.default)(scrollRef);
29
+ } = (0, _useContainerStyle.default)(scrollRef, isShowOutline);
30
30
  const editor = (0, _react.useMemo)(() => {
31
31
  return (0, _extension.createSlateEditor)();
32
32
  }, []);
@@ -10,7 +10,7 @@ var _outline = require("../containers/outline");
10
10
  var _common = require("../utils/common");
11
11
  var _eventBus = _interopRequireDefault(require("../utils/event-bus"));
12
12
  var _eventTypes = require("../constants/event-types");
13
- const useContainerStyle = scrollRef => {
13
+ const useContainerStyle = (scrollRef, isShowOutline) => {
14
14
  const [containerStyle, setContainerStyle] = (0, _react.useState)({});
15
15
 
16
16
  // Adjust article container margin-left value according to isShown of the outline and width of window
@@ -29,6 +29,7 @@ const useContainerStyle = scrollRef => {
29
29
  }, [scrollRef]);
30
30
  (0, _react.useEffect)(() => {
31
31
  if (_common.isMobile) return;
32
+ if (isShowOutline) return;
32
33
  handleWindowResize();
33
34
  window.addEventListener('resize', handleWindowResize);
34
35
  const eventBus = _eventBus.default.getInstance();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "1.0.128",
3
+ "version": "1.0.130",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {