@seafile/seafile-editor 2.0.47-beta3 → 2.0.47-beta5
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.
|
@@ -34,7 +34,6 @@ function SlateViewer(_ref) {
|
|
|
34
34
|
const containerScrollRef = externalScrollRef ? externalScrollRef : scrollRef;
|
|
35
35
|
const decorate = (0, _extension.useHighlight)(editor);
|
|
36
36
|
(0, _userLinkClick.default)(editor._id, onLinkClick);
|
|
37
|
-
const [count, setCount] = (0, _react.useState)(0);
|
|
38
37
|
|
|
39
38
|
// willUnmount
|
|
40
39
|
(0, _react.useEffect)(() => {
|
|
@@ -49,8 +48,7 @@ function SlateViewer(_ref) {
|
|
|
49
48
|
}, []);
|
|
50
49
|
(0, _react.useEffect)(() => {
|
|
51
50
|
editor.children = value;
|
|
52
|
-
|
|
53
|
-
}, [count, editor, value]);
|
|
51
|
+
}, [editor, value]);
|
|
54
52
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
55
53
|
className: `sf-slate-viewer-container ${_common.isMobile && 'mobile'}`
|
|
56
54
|
}, /*#__PURE__*/_react.default.createElement(_slateReact.Slate, {
|
package/dist/extension/editor.js
CHANGED
|
@@ -30,7 +30,7 @@ const inlineEditor = () => {
|
|
|
30
30
|
return editor;
|
|
31
31
|
};
|
|
32
32
|
exports.inlineEditor = inlineEditor;
|
|
33
|
-
const createSlateEditor =
|
|
33
|
+
const createSlateEditor = () => {
|
|
34
34
|
const editor = _plugins.default.reduce((editor, pluginItem) => {
|
|
35
35
|
const withPlugin = pluginItem.editorPlugin;
|
|
36
36
|
if (withPlugin) {
|
|
@@ -39,9 +39,6 @@ const createSlateEditor = children => {
|
|
|
39
39
|
return editor;
|
|
40
40
|
}, (0, _slateHistory.withHistory)((0, _slateReact.withReact)((0, _slate.createEditor)())));
|
|
41
41
|
editor._id = (0, _slugid.nice)();
|
|
42
|
-
if (children) {
|
|
43
|
-
editor.children = children;
|
|
44
|
-
}
|
|
45
42
|
return editor;
|
|
46
43
|
};
|
|
47
44
|
exports.createSlateEditor = createSlateEditor;
|
|
@@ -31,7 +31,7 @@ var _slateViewer = _interopRequireDefault(require("../editors/slate-viewer"));
|
|
|
31
31
|
function MarkdownViewer(_ref) {
|
|
32
32
|
let {
|
|
33
33
|
isFetching,
|
|
34
|
-
|
|
34
|
+
isShowLoading,
|
|
35
35
|
value,
|
|
36
36
|
mathJaxSource,
|
|
37
37
|
isShowOutline,
|
|
@@ -41,26 +41,22 @@ function MarkdownViewer(_ref) {
|
|
|
41
41
|
options
|
|
42
42
|
} = _ref;
|
|
43
43
|
const [richValue, setRichValue] = (0, _react.useState)([]);
|
|
44
|
-
const [isLoading, setIsLoading] = (0, _react.useState)(
|
|
44
|
+
const [isLoading, setIsLoading] = (0, _react.useState)(true);
|
|
45
45
|
const {
|
|
46
46
|
isLoadingMathJax
|
|
47
47
|
} = (0, _useMathjax.default)(mathJaxSource);
|
|
48
48
|
(0, _react.useEffect)(() => {
|
|
49
49
|
if (!isFetching) {
|
|
50
|
-
|
|
51
|
-
setIsLoading(true);
|
|
52
|
-
}
|
|
50
|
+
setIsLoading(true);
|
|
53
51
|
const richValue = (0, _slateConvert.mdStringToSlate)(value);
|
|
54
52
|
beforeRenderCallback && beforeRenderCallback(richValue);
|
|
55
53
|
setRichValue(richValue);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}, 0);
|
|
60
|
-
}
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
setIsLoading(false);
|
|
56
|
+
}, 0);
|
|
61
57
|
}
|
|
62
58
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
|
-
}, [isFetching, value
|
|
59
|
+
}, [isFetching, value]);
|
|
64
60
|
const props = {
|
|
65
61
|
options,
|
|
66
62
|
isSupportFormula: !!mathJaxSource,
|
|
@@ -69,7 +65,7 @@ function MarkdownViewer(_ref) {
|
|
|
69
65
|
scrollRef: scrollRef,
|
|
70
66
|
onLinkClick: onLinkClick
|
|
71
67
|
};
|
|
72
|
-
if (isFetching || isLoading || isLoadingMathJax) {
|
|
68
|
+
if (isShowLoading && (isFetching || isLoading || isLoadingMathJax)) {
|
|
73
69
|
const loadingOption = (options === null || options === void 0 ? void 0 : options.loading) || {};
|
|
74
70
|
const {
|
|
75
71
|
render
|