@seafile/sdoc-editor 0.1.165 → 0.1.166
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.
- package/dist/basic-sdk/assets/css/simple-viewer.css +10 -0
- package/dist/basic-sdk/editor/{slate-editor.js → editable-article.js} +8 -13
- package/dist/basic-sdk/editor/index.js +8 -9
- package/dist/basic-sdk/editor/{common-editor.js → sdoc-editor.js} +14 -12
- package/dist/basic-sdk/extension/index.js +2 -2
- package/dist/basic-sdk/extension/plugins/image/render-elem.js +18 -0
- package/dist/basic-sdk/extension/toolbar/header-toolbar/index.js +3 -3
- package/dist/basic-sdk/extension/toolbar/index.js +2 -2
- package/dist/basic-sdk/layout/editor-container.js +9 -17
- package/dist/basic-sdk/layout/editor-content.js +7 -15
- package/dist/basic-sdk/views/diff-viewer.js +4 -27
- package/dist/basic-sdk/views/index.js +1 -1
- package/dist/basic-sdk/views/readonly-article.js +24 -0
- package/dist/basic-sdk/views/sdoc-viewer.js +35 -0
- package/package.json +1 -1
- package/public/locales/cs/sdoc-editor.json +1 -1
- package/public/locales/de/sdoc-editor.json +1 -1
- package/public/locales/en/sdoc-editor.json +1 -1
- package/public/locales/es/sdoc-editor.json +1 -1
- package/public/locales/fr/sdoc-editor.json +1 -1
- package/public/locales/it/sdoc-editor.json +1 -1
- package/public/locales/ru/sdoc-editor.json +4 -4
- package/public/locales/zh_CN/sdoc-editor.json +1 -1
- package/dist/basic-sdk/views/viewer.js +0 -51
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
height: 100%;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
.sdoc-editor-container .sdoc-editor-content.no-outline .sdoc-absolute-wrapper {
|
|
6
|
+
display: flex;
|
|
7
|
+
position: relative;
|
|
8
|
+
min-height: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.sdoc-editor-container .sdoc-editor-content.no-outline .sdoc-article-container {
|
|
12
|
+
margin-left: 0 !important;
|
|
13
|
+
}
|
|
14
|
+
|
|
5
15
|
.sdoc-editor-container.mobile .sdoc-editor-content.readonly .sdoc-article-container {
|
|
6
16
|
padding: 0;
|
|
7
17
|
width: auto;
|
|
@@ -13,12 +13,11 @@ import { getCursorPosition, getDomHeight, getDomMarginTop } from '../utils/dom-u
|
|
|
13
13
|
import EventBus from '../utils/event-bus';
|
|
14
14
|
import { ArticleContainer } from '../layout';
|
|
15
15
|
import { useScrollContext } from '../hooks/use-scroll-context';
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
|
|
16
|
+
var EditableArticle = function EditableArticle(_ref) {
|
|
17
|
+
var isShowComment = _ref.isShowComment,
|
|
18
|
+
editor = _ref.editor,
|
|
19
19
|
slateValue = _ref.slateValue,
|
|
20
|
-
|
|
21
|
-
isShowComment = _ref.isShowComment;
|
|
20
|
+
updateSlateValue = _ref.updateSlateValue;
|
|
22
21
|
var _useCursors = useCursors(editor),
|
|
23
22
|
cursors = _useCursors.cursors;
|
|
24
23
|
var decorate = usePipDecorate(editor);
|
|
@@ -28,10 +27,6 @@ var SlateEditor = function SlateEditor(_ref) {
|
|
|
28
27
|
var eventProxy = useMemo(function () {
|
|
29
28
|
return new EventProxy(editor);
|
|
30
29
|
}, []);
|
|
31
|
-
var onChange = useCallback(function (slateValue) {
|
|
32
|
-
setSlateValue(slateValue);
|
|
33
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
-
}, []);
|
|
35
30
|
var onMouseDown = useCallback(function (event) {
|
|
36
31
|
if (event.button === 0) {
|
|
37
32
|
editor.reSetTableSelectedRange();
|
|
@@ -135,12 +130,12 @@ var SlateEditor = function SlateEditor(_ref) {
|
|
|
135
130
|
return /*#__PURE__*/React.createElement(Slate, {
|
|
136
131
|
editor: editor,
|
|
137
132
|
value: slateValue,
|
|
138
|
-
onChange:
|
|
133
|
+
onChange: updateSlateValue
|
|
139
134
|
}, /*#__PURE__*/React.createElement(ArticleContainer, {
|
|
140
135
|
editor: editor
|
|
141
136
|
}, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(ContextToolbar, null), /*#__PURE__*/React.createElement(SetNodeToDecorations, null), /*#__PURE__*/React.createElement(Editable, {
|
|
142
137
|
cursors: cursors,
|
|
143
|
-
renderElement:
|
|
138
|
+
renderElement: renderElement,
|
|
144
139
|
renderLeaf: renderLeaf,
|
|
145
140
|
onKeyDown: onKeyDown,
|
|
146
141
|
onMouseDown: onMouseDown,
|
|
@@ -148,7 +143,7 @@ var SlateEditor = function SlateEditor(_ref) {
|
|
|
148
143
|
onCut: eventProxy.onCut
|
|
149
144
|
})), /*#__PURE__*/React.createElement(SideToolbar, null), isShowComment && /*#__PURE__*/React.createElement(CommentContextProvider, null, /*#__PURE__*/React.createElement(CommentWrapper, null))));
|
|
150
145
|
};
|
|
151
|
-
|
|
146
|
+
EditableArticle.defaultProps = {
|
|
152
147
|
isShowComment: true
|
|
153
148
|
};
|
|
154
|
-
export default
|
|
149
|
+
export default EditableArticle;
|
|
@@ -2,15 +2,15 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import React, { useMemo, useEffect, useState, useCallback, useImperativeHandle, forwardRef } from 'react';
|
|
4
4
|
import deepCopy from 'deep-copy';
|
|
5
|
-
import
|
|
6
|
-
import { withSocketIO } from '../socket';
|
|
7
|
-
import withNodeId from '../node-id';
|
|
8
|
-
import { PAGE_EDIT_AREA_WIDTH } from '../constants';
|
|
5
|
+
import context from '../../context';
|
|
9
6
|
import { MODE } from '../../constants';
|
|
10
|
-
import DiffViewer from '../views/diff-viewer';
|
|
11
|
-
import SDocEditor from './common-editor';
|
|
12
7
|
import CommonLoading from '../../components/common-loading';
|
|
13
|
-
import
|
|
8
|
+
import { PAGE_EDIT_AREA_WIDTH } from '../constants';
|
|
9
|
+
import { createDefaultEditor } from '../extension';
|
|
10
|
+
import withNodeId from '../node-id';
|
|
11
|
+
import { withSocketIO } from '../socket';
|
|
12
|
+
import DiffViewer from '../views/diff-viewer';
|
|
13
|
+
import SDocEditor from './sdoc-editor';
|
|
14
14
|
import './index.css';
|
|
15
15
|
var Editor = forwardRef(function (_ref, ref) {
|
|
16
16
|
var mode = _ref.mode,
|
|
@@ -118,8 +118,7 @@ var Editor = forwardRef(function (_ref, ref) {
|
|
|
118
118
|
return /*#__PURE__*/React.createElement(SDocEditor, {
|
|
119
119
|
slateValue: slateValue,
|
|
120
120
|
editor: editor,
|
|
121
|
-
updateSlateValue: updateSlateValue
|
|
122
|
-
renderElement: renderElement
|
|
121
|
+
updateSlateValue: updateSlateValue
|
|
123
122
|
});
|
|
124
123
|
});
|
|
125
124
|
export default Editor;
|
|
@@ -3,13 +3,14 @@ import React, { useEffect } from 'react';
|
|
|
3
3
|
import { Editor } from '@seafile/slate';
|
|
4
4
|
import { focusEditor } from '../extension/core';
|
|
5
5
|
import { EditorContainer, EditorContent } from '../layout';
|
|
6
|
-
import SlateEditor from './slate-editor';
|
|
7
6
|
import InsertElementDialog from '../extension/commons/insert-element-dialog';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import EditableArticle from './editable-article';
|
|
8
|
+
import { ColorProvider } from '../hooks/use-color-context';
|
|
9
|
+
import { HeaderToolbar } from '../extension';
|
|
10
|
+
var SdocEditor = function SdocEditor(_ref) {
|
|
11
|
+
var editor = _ref.editor,
|
|
12
|
+
slateValue = _ref.slateValue,
|
|
13
|
+
updateSlateValue = _ref.updateSlateValue;
|
|
13
14
|
// useMount: focus editor
|
|
14
15
|
useEffect(function () {
|
|
15
16
|
var timer = setTimeout(function () {
|
|
@@ -35,16 +36,17 @@ var CommonEditor = function CommonEditor(_ref) {
|
|
|
35
36
|
}, []);
|
|
36
37
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditorContainer, {
|
|
37
38
|
editor: editor
|
|
38
|
-
}, /*#__PURE__*/React.createElement(
|
|
39
|
+
}, /*#__PURE__*/React.createElement(ColorProvider, null, /*#__PURE__*/React.createElement(HeaderToolbar, {
|
|
40
|
+
editor: editor
|
|
41
|
+
}), /*#__PURE__*/React.createElement(EditorContent, {
|
|
39
42
|
docValue: slateValue,
|
|
40
43
|
showOutline: true
|
|
41
|
-
}, /*#__PURE__*/React.createElement(
|
|
44
|
+
}, /*#__PURE__*/React.createElement(EditableArticle, {
|
|
42
45
|
editor: editor,
|
|
43
46
|
slateValue: slateValue,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}))), /*#__PURE__*/React.createElement(InsertElementDialog, {
|
|
47
|
+
updateSlateValue: updateSlateValue
|
|
48
|
+
})))), /*#__PURE__*/React.createElement(InsertElementDialog, {
|
|
47
49
|
editor: editor
|
|
48
50
|
}));
|
|
49
51
|
};
|
|
50
|
-
export default
|
|
52
|
+
export default SdocEditor;
|
|
@@ -4,7 +4,7 @@ import { withHistory } from '@seafile/slate-history';
|
|
|
4
4
|
import Plugins from './plugins';
|
|
5
5
|
import renderElement from './render/render-element';
|
|
6
6
|
import renderLeaf from './render/render-leaf';
|
|
7
|
-
import {
|
|
7
|
+
import { HeaderToolbar, ContextToolbar, SideToolbar } from './toolbar';
|
|
8
8
|
var baseEditor = withHistory(withReact(createEditor()));
|
|
9
9
|
var defaultEditor = Plugins === null || Plugins === void 0 ? void 0 : Plugins.reduce(function (editor, pluginItem) {
|
|
10
10
|
var withPlugin = pluginItem.editorPlugin;
|
|
@@ -24,4 +24,4 @@ export var createDefaultEditor = function createDefaultEditor() {
|
|
|
24
24
|
return defaultEditor;
|
|
25
25
|
};
|
|
26
26
|
export default defaultEditor;
|
|
27
|
-
export { renderLeaf, renderElement,
|
|
27
|
+
export { renderLeaf, renderElement, HeaderToolbar, ContextToolbar, SideToolbar };
|
|
@@ -14,6 +14,7 @@ import toaster from '../../../../components/toast';
|
|
|
14
14
|
import context from '../../../../context';
|
|
15
15
|
import { getErrorMsg } from '../../../../utils';
|
|
16
16
|
import imagePlaceholder from '../../../assets/images/image-placeholder.png';
|
|
17
|
+
import { ADDED_STYLE, DELETED_STYLE } from '../../constants';
|
|
17
18
|
var Image = /*#__PURE__*/function (_React$Component) {
|
|
18
19
|
_inherits(Image, _React$Component);
|
|
19
20
|
var _super = _createSuper(Image);
|
|
@@ -195,6 +196,23 @@ var SdocImage = withTranslation('sdoc-editor')(Image);
|
|
|
195
196
|
function renderImage(props, editor) {
|
|
196
197
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
197
198
|
var isSelected = useSelected();
|
|
199
|
+
|
|
200
|
+
// decorate diff-viewer
|
|
201
|
+
var element = props.element;
|
|
202
|
+
if (element.ADD || element.DELETE) {
|
|
203
|
+
var style = element.ADD ? ADDED_STYLE : DELETED_STYLE;
|
|
204
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
205
|
+
className: "d-inline-block p-1",
|
|
206
|
+
style: {
|
|
207
|
+
backgroundColor: style.computed_background_color,
|
|
208
|
+
width: 'fit-content',
|
|
209
|
+
height: 'fit-content'
|
|
210
|
+
}
|
|
211
|
+
}, /*#__PURE__*/React.createElement(SdocImage, Object.assign({}, props, {
|
|
212
|
+
editor: editor,
|
|
213
|
+
isSelected: isSelected
|
|
214
|
+
})));
|
|
215
|
+
}
|
|
198
216
|
return /*#__PURE__*/React.createElement(SdocImage, Object.assign({}, props, {
|
|
199
217
|
editor: editor,
|
|
200
218
|
isSelected: isSelected
|
|
@@ -13,7 +13,7 @@ import HistoryMenu from './redo-undo';
|
|
|
13
13
|
import Font from '../../plugins/font/menu';
|
|
14
14
|
import InsertToolbar from './insert-toolbar';
|
|
15
15
|
import ActiveTableMenu from '../../plugins/table/menu/active-table-menu';
|
|
16
|
-
var
|
|
16
|
+
var HeaderToolbar = function HeaderToolbar(_ref) {
|
|
17
17
|
var editor = _ref.editor,
|
|
18
18
|
readonly = _ref.readonly;
|
|
19
19
|
useSelectionUpdate();
|
|
@@ -59,7 +59,7 @@ var Toolbar = function Toolbar(_ref) {
|
|
|
59
59
|
readonly: readonly
|
|
60
60
|
}));
|
|
61
61
|
};
|
|
62
|
-
|
|
62
|
+
HeaderToolbar.defaultProps = {
|
|
63
63
|
readonly: false
|
|
64
64
|
};
|
|
65
|
-
export default
|
|
65
|
+
export default HeaderToolbar;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import HeaderToolbar from './header-toolbar';
|
|
2
2
|
import ContextToolbar from './context-toolbar';
|
|
3
3
|
import SideToolbar from './side-toolbar';
|
|
4
|
-
export {
|
|
4
|
+
export { HeaderToolbar, ContextToolbar, SideToolbar };
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { ColorProvider } from '../hooks/use-color-context';
|
|
4
|
-
import { Toolbar } from '../extension';
|
|
2
|
+
import classNames from 'classnames';
|
|
5
3
|
import { isMobile } from '../../utils';
|
|
6
4
|
import '../assets/css/default.css';
|
|
7
5
|
import '../assets/css/layout.css';
|
|
8
6
|
import '../assets/css/sdoc-editor-plugins.css';
|
|
9
7
|
import '../assets/css/dropdown-menu.css';
|
|
10
8
|
var EditorContainer = function EditorContainer(_ref) {
|
|
11
|
-
var
|
|
12
|
-
readonly = _ref.readonly
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
var children = _ref.children,
|
|
10
|
+
readonly = _ref.readonly;
|
|
11
|
+
var className = classNames('sdoc-editor-container', {
|
|
12
|
+
'mobile': isMobile,
|
|
13
|
+
'readonly': readonly
|
|
14
|
+
});
|
|
15
15
|
return /*#__PURE__*/React.createElement("div", {
|
|
16
|
-
className:
|
|
17
|
-
|
|
18
|
-
})
|
|
19
|
-
}, /*#__PURE__*/React.createElement(ColorProvider, null, showToolbar && /*#__PURE__*/React.createElement(Toolbar, {
|
|
20
|
-
editor: editor,
|
|
21
|
-
readonly: readonly
|
|
22
|
-
}), children));
|
|
23
|
-
};
|
|
24
|
-
EditorContainer.defaultProps = {
|
|
25
|
-
showToolbar: true
|
|
16
|
+
className: className
|
|
17
|
+
}, children);
|
|
26
18
|
};
|
|
27
19
|
export default EditorContainer;
|
|
@@ -2,6 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import React, { useRef, useState, useCallback } from 'react';
|
|
3
3
|
import { ScrollContext } from '../hooks/use-scroll-context';
|
|
4
4
|
import SDocOutline from '../outline';
|
|
5
|
+
import classNames from 'classnames';
|
|
5
6
|
var EditorContent = function EditorContent(_ref) {
|
|
6
7
|
var readonly = _ref.readonly,
|
|
7
8
|
showOutline = _ref.showOutline,
|
|
@@ -16,22 +17,13 @@ var EditorContent = function EditorContent(_ref) {
|
|
|
16
17
|
var scrollLeft = event.target.scrollLeft;
|
|
17
18
|
setScrollLeft(scrollLeft);
|
|
18
19
|
}, []);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
ref: scrollRef,
|
|
24
|
-
className: "sdoc-scroll-container",
|
|
25
|
-
id: "sdoc-scroll-container"
|
|
26
|
-
}, /*#__PURE__*/React.createElement(ScrollContext.Provider, {
|
|
27
|
-
value: {
|
|
28
|
-
scrollRef: scrollRef
|
|
29
|
-
}
|
|
30
|
-
}, children)));
|
|
31
|
-
}
|
|
20
|
+
var className = classNames('sdoc-editor-content', {
|
|
21
|
+
'readonly': readonly,
|
|
22
|
+
'no-outline': !showOutline
|
|
23
|
+
});
|
|
32
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
33
|
-
className:
|
|
34
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
className: className
|
|
26
|
+
}, showOutline && /*#__PURE__*/React.createElement("div", {
|
|
35
27
|
className: "sdoc-absolute-wrapper"
|
|
36
28
|
}, /*#__PURE__*/React.createElement(SDocOutline, {
|
|
37
29
|
scrollLeft: scrollLeft,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { renderLeaf, renderElement } from '../extension';
|
|
3
|
-
import { getDiff } from '../utils/diff';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
4
2
|
import context from '../../context';
|
|
5
|
-
import {
|
|
6
|
-
import SDocViewer from './viewer';
|
|
3
|
+
import { getDiff } from '../utils/diff';
|
|
4
|
+
import SDocViewer from './sdoc-viewer';
|
|
7
5
|
import '../../assets/css/diff-viewer.css';
|
|
8
6
|
var DiffViewer = function DiffViewer(_ref) {
|
|
9
7
|
var editor = _ref.editor,
|
|
@@ -19,34 +17,13 @@ var DiffViewer = function DiffViewer(_ref) {
|
|
|
19
17
|
|
|
20
18
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
19
|
}, []);
|
|
22
|
-
var customRenderLeaf = useCallback(function (props, editor) {
|
|
23
|
-
return renderLeaf(props, editor);
|
|
24
|
-
}, []);
|
|
25
|
-
var customRenderElement = useCallback(function (props, editor) {
|
|
26
|
-
var element = props.element;
|
|
27
|
-
var type = element.type;
|
|
28
|
-
if (type === ELEMENT_TYPE.IMAGE && (element.ADD || element.DELETE)) {
|
|
29
|
-
var style = element.ADD ? ADDED_STYLE : DELETED_STYLE;
|
|
30
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
31
|
-
className: "d-inline-block p-1",
|
|
32
|
-
style: {
|
|
33
|
-
backgroundColor: style.computed_background_color,
|
|
34
|
-
width: 'fit-content',
|
|
35
|
-
height: 'fit-content'
|
|
36
|
-
}
|
|
37
|
-
}, renderElement(props, editor));
|
|
38
|
-
}
|
|
39
|
-
return renderElement(props, editor);
|
|
40
|
-
}, []);
|
|
41
20
|
return /*#__PURE__*/React.createElement(SDocViewer, {
|
|
42
21
|
editor: editor,
|
|
43
22
|
showToolbar: showToolbar,
|
|
44
23
|
showOutline: showOutline,
|
|
45
24
|
document: {
|
|
46
25
|
children: diff.value
|
|
47
|
-
}
|
|
48
|
-
renderLeaf: customRenderLeaf,
|
|
49
|
-
renderElement: customRenderElement
|
|
26
|
+
}
|
|
50
27
|
});
|
|
51
28
|
};
|
|
52
29
|
DiffViewer.defaultProps = {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { Editable, Slate } from '@seafile/slate-react';
|
|
3
|
+
import { ArticleContainer } from '../layout';
|
|
4
|
+
import { SetNodeToDecorations } from '../highlight-decorate/setNodeToDecorations';
|
|
5
|
+
import { renderElement, renderLeaf } from '../extension';
|
|
6
|
+
import { usePipDecorate } from '../decorates';
|
|
7
|
+
export default function ReadOnlyArticle(_ref) {
|
|
8
|
+
var editor = _ref.editor,
|
|
9
|
+
slateValue = _ref.slateValue;
|
|
10
|
+
var decorate = usePipDecorate(editor);
|
|
11
|
+
return /*#__PURE__*/React.createElement(Slate, {
|
|
12
|
+
editor: editor,
|
|
13
|
+
value: slateValue
|
|
14
|
+
}, /*#__PURE__*/React.createElement(ArticleContainer, {
|
|
15
|
+
editor: editor,
|
|
16
|
+
readOnly: true
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(SetNodeToDecorations, null), /*#__PURE__*/React.createElement(Editable, {
|
|
18
|
+
readOnly: true,
|
|
19
|
+
placeholder: "",
|
|
20
|
+
renderElement: renderElement,
|
|
21
|
+
renderLeaf: renderLeaf,
|
|
22
|
+
decorate: decorate
|
|
23
|
+
}))));
|
|
24
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HeaderToolbar, createDefaultEditor } from '../extension';
|
|
3
|
+
import withNodeId from '../node-id';
|
|
4
|
+
import { generateDefaultDocContent } from '../../utils';
|
|
5
|
+
import { EditorContainer, EditorContent } from '../layout';
|
|
6
|
+
import ReadOnlyArticle from './readonly-article';
|
|
7
|
+
import { ColorProvider } from '../hooks/use-color-context';
|
|
8
|
+
import '../assets/css/simple-viewer.css';
|
|
9
|
+
var SDocViewer = function SDocViewer(_ref) {
|
|
10
|
+
var editor = _ref.editor,
|
|
11
|
+
document = _ref.document,
|
|
12
|
+
showToolbar = _ref.showToolbar,
|
|
13
|
+
showOutline = _ref.showOutline;
|
|
14
|
+
var validEditor = editor || withNodeId(createDefaultEditor());
|
|
15
|
+
var slateValue = (document || generateDefaultDocContent()).children;
|
|
16
|
+
return /*#__PURE__*/React.createElement(EditorContainer, {
|
|
17
|
+
editor: validEditor,
|
|
18
|
+
readonly: true
|
|
19
|
+
}, /*#__PURE__*/React.createElement(ColorProvider, null, showToolbar && /*#__PURE__*/React.createElement(HeaderToolbar, {
|
|
20
|
+
editor: validEditor,
|
|
21
|
+
readonly: true
|
|
22
|
+
}), /*#__PURE__*/React.createElement(EditorContent, {
|
|
23
|
+
docValue: slateValue,
|
|
24
|
+
readonly: true,
|
|
25
|
+
showOutline: showOutline
|
|
26
|
+
}, /*#__PURE__*/React.createElement(ReadOnlyArticle, {
|
|
27
|
+
editor: validEditor,
|
|
28
|
+
slateValue: slateValue
|
|
29
|
+
}))));
|
|
30
|
+
};
|
|
31
|
+
SDocViewer.defaultProps = {
|
|
32
|
+
showToolbar: false,
|
|
33
|
+
showOutline: false
|
|
34
|
+
};
|
|
35
|
+
export default SDocViewer;
|
package/package.json
CHANGED
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
"Link_file": "Link file",
|
|
368
368
|
"Keep_my_modification": "Keep my modification",
|
|
369
369
|
"Keep_other_modification": "Keep other's modification",
|
|
370
|
-
"Keep_both_modification": "Keep
|
|
370
|
+
"Keep_both_modification": "Keep both modification",
|
|
371
371
|
"Tip": "Tip",
|
|
372
372
|
"Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
|
|
373
373
|
"Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
"Link_file": "Link file",
|
|
368
368
|
"Keep_my_modification": "Keep my modification",
|
|
369
369
|
"Keep_other_modification": "Keep other's modification",
|
|
370
|
-
"Keep_both_modification": "Keep
|
|
370
|
+
"Keep_both_modification": "Keep both modification",
|
|
371
371
|
"Tip": "Tip",
|
|
372
372
|
"Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
|
|
373
373
|
"Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
"Link_file": "Link file",
|
|
368
368
|
"Keep_my_modification": "Keep my modification",
|
|
369
369
|
"Keep_other_modification": "Keep other's modification",
|
|
370
|
-
"Keep_both_modification": "Keep
|
|
370
|
+
"Keep_both_modification": "Keep both modification",
|
|
371
371
|
"Tip": "Tip",
|
|
372
372
|
"Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
|
|
373
373
|
"Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
"Link_file": "Link file",
|
|
368
368
|
"Keep_my_modification": "Keep my modification",
|
|
369
369
|
"Keep_other_modification": "Keep other's modification",
|
|
370
|
-
"Keep_both_modification": "Keep
|
|
370
|
+
"Keep_both_modification": "Keep both modification",
|
|
371
371
|
"Tip": "Tip",
|
|
372
372
|
"Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
|
|
373
373
|
"Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
"Link_file": "Link file",
|
|
368
368
|
"Keep_my_modification": "Keep my modification",
|
|
369
369
|
"Keep_other_modification": "Keep other's modification",
|
|
370
|
-
"Keep_both_modification": "Keep
|
|
370
|
+
"Keep_both_modification": "Keep both modification",
|
|
371
371
|
"Tip": "Tip",
|
|
372
372
|
"Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
|
|
373
373
|
"Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
"Link_file": "Link file",
|
|
368
368
|
"Keep_my_modification": "Keep my modification",
|
|
369
369
|
"Keep_other_modification": "Keep other's modification",
|
|
370
|
-
"Keep_both_modification": "Keep
|
|
370
|
+
"Keep_both_modification": "Keep both modification",
|
|
371
371
|
"Tip": "Tip",
|
|
372
372
|
"Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
|
|
373
373
|
"Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
"Link_file": "Ссылка на файл",
|
|
368
368
|
"Keep_my_modification": "Сохранить мою модификацию",
|
|
369
369
|
"Keep_other_modification": "Сохранить чужую модификацию",
|
|
370
|
-
"Keep_both_modification": "
|
|
370
|
+
"Keep_both_modification": "Keep both modification",
|
|
371
371
|
"Tip": "Совет",
|
|
372
372
|
"Rebase_delete_no_change_revision_tip": "Редакция не внесла никаких изменений по сравнению с исходным документом. Вы хотите удалить эту редакцию?",
|
|
373
373
|
"Has_been_replaced_tip": "Содержимое документа было заменено. Обновите страницу.",
|
|
@@ -376,7 +376,7 @@
|
|
|
376
376
|
"Merge_tip": "В документах есть конфликты. Вы хотите объединить их?",
|
|
377
377
|
"Has_conflict_before_view_changes_tip": "В документе есть конфликты. Разрешите конфликт перед просмотром изменений!",
|
|
378
378
|
"Has_been_removed_tip": "Документ удален, посмотрите другие документы.",
|
|
379
|
-
"Revision_created": "
|
|
380
|
-
"Checking": "
|
|
381
|
-
"Publishing": "
|
|
379
|
+
"Revision_created": "Версия {{id}} создана",
|
|
380
|
+
"Checking": "Проверка...",
|
|
381
|
+
"Publishing": "Публикация..."
|
|
382
382
|
}
|
|
@@ -367,7 +367,7 @@
|
|
|
367
367
|
"Link_file": "文件链接",
|
|
368
368
|
"Keep_my_modification": "保留我的更改",
|
|
369
369
|
"Keep_other_modification": "保留其他的更改",
|
|
370
|
-
"Keep_both_modification": "
|
|
370
|
+
"Keep_both_modification": "保留两者更改",
|
|
371
371
|
"Tip": "提示",
|
|
372
372
|
"Rebase_delete_no_change_revision_tip": "修订改没有更改,是否删除修订稿?",
|
|
373
373
|
"Has_been_replaced_tip": "文档内容已经被替换,请刷新页面。",
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React, { Fragment } from 'react';
|
|
2
|
-
import { Editable, Slate } from '@seafile/slate-react';
|
|
3
|
-
import { renderLeaf as _renderLeaf, renderElement as _renderElement, createDefaultEditor } from '../extension';
|
|
4
|
-
import withNodeId from '../node-id';
|
|
5
|
-
import { generateDefaultDocContent } from '../../utils';
|
|
6
|
-
import { SetNodeToDecorations } from '../highlight-decorate/setNodeToDecorations';
|
|
7
|
-
import { usePipDecorate } from '../decorates';
|
|
8
|
-
import { ArticleContainer, EditorContainer, EditorContent } from '../layout';
|
|
9
|
-
import '../assets/css/simple-viewer.css';
|
|
10
|
-
var SDocViewer = function SDocViewer(_ref) {
|
|
11
|
-
var editor = _ref.editor,
|
|
12
|
-
document = _ref.document,
|
|
13
|
-
customRenderLeaf = _ref.renderLeaf,
|
|
14
|
-
customRenderElement = _ref.renderElement,
|
|
15
|
-
showToolbar = _ref.showToolbar,
|
|
16
|
-
showOutline = _ref.showOutline;
|
|
17
|
-
var validEditor = editor || withNodeId(createDefaultEditor());
|
|
18
|
-
var slateValue = (document || generateDefaultDocContent()).children;
|
|
19
|
-
var decorate = usePipDecorate(validEditor);
|
|
20
|
-
return /*#__PURE__*/React.createElement(EditorContainer, {
|
|
21
|
-
editor: validEditor,
|
|
22
|
-
showToolbar: showToolbar,
|
|
23
|
-
readonly: true
|
|
24
|
-
}, /*#__PURE__*/React.createElement(EditorContent, {
|
|
25
|
-
docValue: slateValue,
|
|
26
|
-
readonly: true,
|
|
27
|
-
showOutline: showOutline
|
|
28
|
-
}, /*#__PURE__*/React.createElement(Slate, {
|
|
29
|
-
editor: validEditor,
|
|
30
|
-
value: slateValue
|
|
31
|
-
}, /*#__PURE__*/React.createElement(ArticleContainer, {
|
|
32
|
-
editor: validEditor,
|
|
33
|
-
readOnly: true
|
|
34
|
-
}, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(SetNodeToDecorations, null), /*#__PURE__*/React.createElement(Editable, {
|
|
35
|
-
readOnly: true,
|
|
36
|
-
placeholder: "",
|
|
37
|
-
renderElement: function renderElement(props) {
|
|
38
|
-
return (customRenderElement || _renderElement)(props, validEditor);
|
|
39
|
-
},
|
|
40
|
-
renderLeaf: function renderLeaf(props) {
|
|
41
|
-
return (customRenderLeaf || _renderLeaf)(props, validEditor);
|
|
42
|
-
},
|
|
43
|
-
onDOMBeforeInput: function onDOMBeforeInput(event) {},
|
|
44
|
-
decorate: decorate
|
|
45
|
-
}))))));
|
|
46
|
-
};
|
|
47
|
-
SDocViewer.defaultProps = {
|
|
48
|
-
showToolbar: false,
|
|
49
|
-
showOutline: false
|
|
50
|
-
};
|
|
51
|
-
export default SDocViewer;
|