@seafile/seafile-editor 1.0.66 → 1.0.67

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.
@@ -52,30 +52,31 @@ function SimpleSlateEditor(_ref) {
52
52
  if (!firstNode) return;
53
53
  const [firstNodeFirstChild] = firstNode.children;
54
54
  if (firstNodeFirstChild) {
55
- const endOfFirstNode = _slate.Editor.end(editor, [0, 0]);
55
+ const startOfFirstNode = _slate.Editor.start(editor, [0, 0]);
56
56
  const range = {
57
- anchor: endOfFirstNode,
58
- focus: endOfFirstNode
59
- };
60
- (0, _core.focusEditor)(editor, range);
61
- }
62
- }, []);
63
- const focusEndNode = (0, _react.useCallback)(editor => {
64
- const lastChildIndex = editor.children.length - 1;
65
- if (lastChildIndex < 0) return;
66
- const lastNode = editor.children[lastChildIndex];
67
- if (!lastNode) return;
68
- const [lastNodeFirstChild] = lastNode.children;
69
- if (lastNodeFirstChild) {
70
- const endOfFirstNode = _slate.Editor.end(editor, [lastChildIndex, 0]);
71
- const range = {
72
- anchor: endOfFirstNode,
73
- focus: endOfFirstNode
57
+ anchor: startOfFirstNode,
58
+ focus: startOfFirstNode
74
59
  };
75
60
  (0, _core.focusEditor)(editor, range);
76
61
  }
77
62
  }, []);
78
63
 
64
+ // const focusEndNode = useCallback((editor) => {
65
+ // const lastChildIndex = editor.children.length - 1;
66
+ // if (lastChildIndex < 0) return;
67
+ // const lastNode = editor.children[lastChildIndex];
68
+ // if (!lastNode) return;
69
+ // const [lastNodeFirstChild] = lastNode.children;
70
+ // if (lastNodeFirstChild) {
71
+ // const endOfFirstNode = Editor.end(editor, [lastChildIndex, 0]);
72
+ // const range = {
73
+ // anchor: endOfFirstNode,
74
+ // focus: endOfFirstNode,
75
+ // };
76
+ // focusEditor(editor, range);
77
+ // }
78
+ // }, []);
79
+
79
80
  // useMount: focus editor
80
81
  (0, _react.useEffect)(() => {
81
82
  editor.forceNormalize = true;
@@ -57,10 +57,10 @@ function SlateEditor(_ref) {
57
57
  if (!firstNode) return;
58
58
  const [firstNodeFirstChild] = firstNode.children;
59
59
  if (firstNodeFirstChild) {
60
- const endOfFirstNode = _slate.Editor.end(editor, [0, 0]);
60
+ const startOfFirstNode = _slate.Editor.start(editor, [0, 0]);
61
61
  const range = {
62
- anchor: endOfFirstNode,
63
- focus: endOfFirstNode
62
+ anchor: startOfFirstNode,
63
+ focus: startOfFirstNode
64
64
  };
65
65
  (0, _core.focusEditor)(editor, range);
66
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "1.0.66",
3
+ "version": "1.0.67",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {