@seafile/comment-editor 0.0.1-alpha.52 → 0.0.1-alpha.53
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.
|
@@ -143,30 +143,32 @@ const CommentEditor = _ref => {
|
|
|
143
143
|
}, []);
|
|
144
144
|
|
|
145
145
|
// set editor children
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}, [editor, content]);
|
|
146
|
+
// useEffect(() => {
|
|
147
|
+
// let children = mdStringToSlate(content);
|
|
148
|
+
// editor.children = children;
|
|
149
|
+
// Transforms.select(editor, Editor.end(editor, []));
|
|
150
|
+
// }, [editor, content]);
|
|
151
|
+
|
|
152
|
+
// // useMount: focus editor
|
|
153
|
+
// useEffect(() => {
|
|
154
|
+
// const [firstNode] = editor.children;
|
|
155
|
+
// if (firstNode) {
|
|
156
|
+
// const [firstNodeFirstChild] = firstNode.children;
|
|
157
|
+
|
|
158
|
+
// if (firstNodeFirstChild) {
|
|
159
|
+
// const endOfFirstNode = Editor.end(editor, [0, 0]);
|
|
160
|
+
// const range = {
|
|
161
|
+
// anchor: endOfFirstNode,
|
|
162
|
+
// focus: endOfFirstNode,
|
|
163
|
+
// };
|
|
164
|
+
// focusEditor(editor, range);
|
|
165
|
+
// }
|
|
166
|
+
// // Force refresh to fix comment list
|
|
167
|
+
// setSlateValue([...editor.children]);
|
|
168
|
+
// }
|
|
169
|
+
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
170
|
+
// }, []);
|
|
151
171
|
|
|
152
|
-
// useMount: focus editor
|
|
153
|
-
(0, _react.useEffect)(() => {
|
|
154
|
-
const [firstNode] = editor.children;
|
|
155
|
-
if (firstNode) {
|
|
156
|
-
const [firstNodeFirstChild] = firstNode.children;
|
|
157
|
-
if (firstNodeFirstChild) {
|
|
158
|
-
const endOfFirstNode = _slate.Editor.end(editor, [0, 0]);
|
|
159
|
-
const range = {
|
|
160
|
-
anchor: endOfFirstNode,
|
|
161
|
-
focus: endOfFirstNode
|
|
162
|
-
};
|
|
163
|
-
(0, _core.focusEditor)(editor, range);
|
|
164
|
-
}
|
|
165
|
-
// Force refresh to fix comment list
|
|
166
|
-
setSlateValue([...editor.children]);
|
|
167
|
-
}
|
|
168
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
169
|
-
}, []);
|
|
170
172
|
const handleFocusEditor = e => {
|
|
171
173
|
if (e.target === commentEditorContainerRef.current) {
|
|
172
174
|
const focusPoint = _slate.Editor.end(editor, []);
|