@seafile/sdoc-editor 2.0.38-alph-1.1.0 → 2.0.38-alph-1.2.0
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.
|
@@ -25,7 +25,6 @@ var _highlight = require("../highlight");
|
|
|
25
25
|
var _constants2 = require("../extension/constants");
|
|
26
26
|
var _helpers = require("../extension/plugins/table/helpers");
|
|
27
27
|
var _useForceUpdate = _interopRequireDefault(require("../../basic-sdk/hooks/use-force-update"));
|
|
28
|
-
var _helpers2 = require("../extension/plugins/ai/ai-module/helpers");
|
|
29
28
|
const EditableArticle = _ref => {
|
|
30
29
|
let {
|
|
31
30
|
showComment = true,
|
|
@@ -61,7 +61,6 @@ const SdocEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
61
61
|
setSlateValue(document.elements);
|
|
62
62
|
}, [document.elements]);
|
|
63
63
|
(0, _react.useEffect)(() => {
|
|
64
|
-
console.log(22);
|
|
65
64
|
validEditor.readonly = false;
|
|
66
65
|
return () => {
|
|
67
66
|
validEditor.selection = null;
|
|
@@ -118,15 +117,15 @@ const SdocEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
118
117
|
|
|
119
118
|
// useMount: refresh document
|
|
120
119
|
(0, _react.useEffect)(() => {
|
|
121
|
-
console.log(44343);
|
|
122
120
|
const eventBus = _basicSdk.EventBus.getInstance();
|
|
123
121
|
eventBus.subscribe(_constants2.EXTERNAL_EVENT.REFRESH_DOCUMENT, onRefreshDocument);
|
|
122
|
+
|
|
123
|
+
// Remove aiMarks on special conditions like unexpected exit or refresh page using AI
|
|
124
124
|
const hasAIMark = !_slate.Editor.nodes(validEditor, {
|
|
125
125
|
at: [],
|
|
126
126
|
match: n => _slate.Text.isText(n) && n.isSelectedInAI === true
|
|
127
127
|
}).next().done;
|
|
128
128
|
if (hasAIMark) {
|
|
129
|
-
console.log(999);
|
|
130
129
|
(0, _helpers.removeMarks)(validEditor);
|
|
131
130
|
}
|
|
132
131
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -202,7 +201,6 @@ const SdocEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
202
201
|
}))));
|
|
203
202
|
}
|
|
204
203
|
const isShowComment = typeof showComment === 'boolean' ? showComment : true;
|
|
205
|
-
console.log(2, validEditor, slateValue, onValueChange, isShowComment);
|
|
206
204
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_layout.EditorContainer, {
|
|
207
205
|
editor: validEditor
|
|
208
206
|
}, /*#__PURE__*/_react.default.createElement(_useColorContext.ColorProvider, null, isShowHeaderToolbar && /*#__PURE__*/_react.default.createElement(_extension.HeaderToolbar, {
|
|
@@ -13,8 +13,6 @@ var _localStorageUtils = _interopRequireDefault(require("../../utils/local-stora
|
|
|
13
13
|
var _fullWidthMode = require("../utils/full-width-mode");
|
|
14
14
|
var _defaultMode = require("../utils/default-mode");
|
|
15
15
|
var _constants = require("../constants");
|
|
16
|
-
var _slate = require("@seafile/slate");
|
|
17
|
-
var _helpers = require("../extension/plugins/ai/ai-module/helpers");
|
|
18
16
|
function ArticleContainer(_ref) {
|
|
19
17
|
let {
|
|
20
18
|
editor,
|
|
@@ -27,19 +25,6 @@ function ArticleContainer(_ref) {
|
|
|
27
25
|
editor.width = articleRef.current.children[0].clientWidth;
|
|
28
26
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
27
|
}, []);
|
|
30
|
-
|
|
31
|
-
// useEffect(() => {
|
|
32
|
-
// const hasAIMark = !Editor.nodes(editor, {
|
|
33
|
-
// at: [],
|
|
34
|
-
// match: n => Text.isText(n) && n.isSelectedInAI === true,
|
|
35
|
-
// }).next().done;
|
|
36
|
-
|
|
37
|
-
// if (hasAIMark) {
|
|
38
|
-
// removeMarks(editor);
|
|
39
|
-
// }
|
|
40
|
-
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
|
-
// }, []);
|
|
42
|
-
|
|
43
28
|
const handleWindowResize = (0, _react.useCallback)(function () {
|
|
44
29
|
let {
|
|
45
30
|
scrollIntoArticle = false,
|