@seafile/seafile-editor 0.3.76
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/README.md +119 -0
- package/TODO.md +55 -0
- package/dist/components/add-formula-dialog.js +135 -0
- package/dist/components/add-image-dialog.js +78 -0
- package/dist/components/add-link-dialog.js +148 -0
- package/dist/components/comment-dialog.js +107 -0
- package/dist/components/comment-panel.js +452 -0
- package/dist/components/context-menu.js +112 -0
- package/dist/components/detail-list-view.js +119 -0
- package/dist/components/generate-share-link.js +412 -0
- package/dist/components/internal-link-dialog.js +96 -0
- package/dist/components/loading.js +32 -0
- package/dist/components/markdown-lint.js +87 -0
- package/dist/components/modal-portal.js +46 -0
- package/dist/components/outline.js +130 -0
- package/dist/components/participants-list.js +126 -0
- package/dist/components/related-files-list.js +75 -0
- package/dist/components/shortcut-dialog.js +167 -0
- package/dist/components/side-panel.js +175 -0
- package/dist/components/toast/alert.js +150 -0
- package/dist/components/toast/index.js +3 -0
- package/dist/components/toast/toast.js +179 -0
- package/dist/components/toast/toastManager.js +158 -0
- package/dist/components/toast/toaster.js +76 -0
- package/dist/components/toolbar.js +235 -0
- package/dist/components/topbar-component/button-group.js +31 -0
- package/dist/components/topbar-component/editor-toolbar.js +545 -0
- package/dist/components/topbar-component/file-info.js +65 -0
- package/dist/components/topbar-component/header-list.js +128 -0
- package/dist/components/topbar-component/icon-button.js +99 -0
- package/dist/components/topbar-component/insert-file.js +67 -0
- package/dist/components/topbar-component/table-toolbar.js +175 -0
- package/dist/components/topbar-component/upload-img.js +122 -0
- package/dist/components/user-help.js +205 -0
- package/dist/css/diff-viewer.css +105 -0
- package/dist/css/history-viewer.css +104 -0
- package/dist/css/keyboard-shortcuts.css +59 -0
- package/dist/css/layout.css +110 -0
- package/dist/css/markdown-viewer-slate/file-tags-list.css +76 -0
- package/dist/css/markdown-viewer.css +69 -0
- package/dist/css/plaineditor/markdown-editor.css +12 -0
- package/dist/css/react-mentions-default-style.js +72 -0
- package/dist/css/related-files-list.css +56 -0
- package/dist/css/richeditor/comments-list.css +184 -0
- package/dist/css/richeditor/detail-list-view.css +114 -0
- package/dist/css/richeditor/document-info.css +57 -0
- package/dist/css/richeditor/formula.css +19 -0
- package/dist/css/richeditor/image.css +141 -0
- package/dist/css/richeditor/link.css +7 -0
- package/dist/css/richeditor/navbar-imgbutton.css +79 -0
- package/dist/css/richeditor/participants-list.css +22 -0
- package/dist/css/richeditor/rich-editor-main.css +42 -0
- package/dist/css/richeditor/right-panel.css +84 -0
- package/dist/css/richeditor/side-panel.css +190 -0
- package/dist/css/richeditor/table.css +57 -0
- package/dist/css/richeditor/textlink-hovermenu.css +47 -0
- package/dist/css/richeditor/tree-view.css +67 -0
- package/dist/css/topbar.css +400 -0
- package/dist/editor/code-highlight-package.js +27 -0
- package/dist/editor/controller/block-element-controller.js +376 -0
- package/dist/editor/controller/inline-element-controller.js +129 -0
- package/dist/editor/controller/normalize-controller.js +107 -0
- package/dist/editor/controller/shortcut-controller.js +394 -0
- package/dist/editor/controller/void-element-controller.js +12 -0
- package/dist/editor/custom/custom.js +17 -0
- package/dist/editor/custom/get-event-transfer.js +34 -0
- package/dist/editor/custom/getNodesByTypeAtRange.js +69 -0
- package/dist/editor/custom/insertNodes.js +140 -0
- package/dist/editor/custom/is-empty-paragraph.js +13 -0
- package/dist/editor/custom/set-event-transfer.js +31 -0
- package/dist/editor/custom/split-nodes-at-point.js +162 -0
- package/dist/editor/custom/unwrap-node-by-type-at-range.js +81 -0
- package/dist/editor/editor-component/check-list-item.js +64 -0
- package/dist/editor/editor-component/code-block.js +150 -0
- package/dist/editor/editor-component/formula.js +79 -0
- package/dist/editor/editor-component/image.js +215 -0
- package/dist/editor/editor-component/link.js +11 -0
- package/dist/editor/editor-component/table.js +172 -0
- package/dist/editor/editor-component/textlink-hovermenu.js +136 -0
- package/dist/editor/editor-plugin.js +249 -0
- package/dist/editor/editor-utils/block-element-utils/blockquote-utils.js +96 -0
- package/dist/editor/editor-utils/block-element-utils/code-utils.js +162 -0
- package/dist/editor/editor-utils/block-element-utils/formula-utils.js +58 -0
- package/dist/editor/editor-utils/block-element-utils/index.js +38 -0
- package/dist/editor/editor-utils/block-element-utils/list-utils.js +398 -0
- package/dist/editor/editor-utils/block-element-utils/table-utils.js +418 -0
- package/dist/editor/editor-utils/common-editor-utils.js +587 -0
- package/dist/editor/editor-utils/inline-element-utils/index.js +95 -0
- package/dist/editor/editor-utils/mark-utils.js +25 -0
- package/dist/editor/editor-utils/range-utils.js +9 -0
- package/dist/editor/editor-utils/selection-utils.js +33 -0
- package/dist/editor/editor-utils/text-utils.js +130 -0
- package/dist/editor/editor.js +66 -0
- package/dist/editor/element-model/blockquote.js +16 -0
- package/dist/editor/element-model/image.js +19 -0
- package/dist/editor/element-model/link.js +19 -0
- package/dist/editor/element-model/table.js +50 -0
- package/dist/editor/element-model/text.js +13 -0
- package/dist/editor/load-script.js +83 -0
- package/dist/editor/plain-markdown-editor.js +324 -0
- package/dist/editor/rich-markdown-editor.js +580 -0
- package/dist/editor/seafile-editor.js +326 -0
- package/dist/editor/simple-editor.js +245 -0
- package/dist/editor-api.js +261 -0
- package/dist/index.css +97 -0
- package/dist/lib/slate-hyperscript/creators.js +263 -0
- package/dist/lib/slate-hyperscript/hyperscript.js +92 -0
- package/dist/lib/slate-hyperscript/index.js +3 -0
- package/dist/lib/slate-hyperscript/tokens.js +102 -0
- package/dist/lib/unified/index.js +470 -0
- package/dist/lib/vfile/core.js +172 -0
- package/dist/lib/vfile/index.js +48 -0
- package/dist/seafile-editor-chooser.js +45 -0
- package/dist/seafile-markdown-editor.js +301 -0
- package/dist/seafile-markdown-viewer.js +79 -0
- package/dist/seafile-simple-editor.js +56 -0
- package/dist/utils/copy-to-clipboard.js +47 -0
- package/dist/utils/deserialize-html.js +282 -0
- package/dist/utils/diff/compare-strings.js +46 -0
- package/dist/utils/diff/diff.js +855 -0
- package/dist/utils/diff/index.js +2 -0
- package/dist/utils/render-slate.js +219 -0
- package/dist/utils/seafile-markdown2html.js +62 -0
- package/dist/utils/slate2markdown/deserialize.js +689 -0
- package/dist/utils/slate2markdown/index.js +3 -0
- package/dist/utils/slate2markdown/serialize.js +407 -0
- package/dist/utils/utils.js +28 -0
- package/dist/viewer/diff-viewer.js +98 -0
- package/dist/viewer/markdown-viewer.js +139 -0
- package/dist/viewer/slate-viewer.js +73 -0
- package/dist/viewer/viewer-formula.js +67 -0
- package/dist/viewer/viewer-image.js +93 -0
- package/dist/viewer/viewer-outline.js +118 -0
- package/package.json +215 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +45 -0
- package/public/locales/cs/seafile-editor.json +169 -0
- package/public/locales/de/seafile-editor.json +169 -0
- package/public/locales/en/seafile-editor.json +222 -0
- package/public/locales/es/seafile-editor.json +169 -0
- package/public/locales/es-AR/seafile-editor.json +169 -0
- package/public/locales/es-MX/seafile-editor.json +169 -0
- package/public/locales/fr/seafile-editor.json +169 -0
- package/public/locales/it/seafile-editor.json +169 -0
- package/public/locales/ru/seafile-editor.json +169 -0
- package/public/locales/zh-CN/seafile-editor.json +219 -0
- package/public/manifest.json +15 -0
- package/public/media/scripts/mathjax/tex-svg.js +1 -0
- package/public/media/seafile-editor-font/iconfont.eot +0 -0
- package/public/media/seafile-editor-font/iconfont.svg +164 -0
- package/public/media/seafile-editor-font/iconfont.ttf +0 -0
- package/public/media/seafile-editor-font/iconfont.woff +0 -0
- package/public/media/seafile-editor-font/iconfont.woff2 +0 -0
- package/public/media/seafile-editor-font.css +201 -0
- package/public/media/seafile-logo.png +0 -0
- package/public/media/seafile-ui.css +11169 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { decorationNode } from '../editor/editor-utils/common-editor-utils';
|
|
7
|
+
import { Editable, withReact, Slate } from '@seafile/slate-react';
|
|
8
|
+
import '../editor/code-highlight-package';
|
|
9
|
+
import { createEditor } from 'slate';
|
|
10
|
+
import { renderNode, renderLeaf } from '../utils/render-slate';
|
|
11
|
+
|
|
12
|
+
var withVoid = function withVoid(editor) {
|
|
13
|
+
var isVoid = editor.isVoid;
|
|
14
|
+
|
|
15
|
+
editor.isVoid = function (element) {
|
|
16
|
+
return element.type === 'image' || element.type === 'formula' ? true : isVoid(element);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return editor;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var withInline = function withInline(editor) {
|
|
23
|
+
var isInline = editor.isInline;
|
|
24
|
+
|
|
25
|
+
editor.isInline = function (element) {
|
|
26
|
+
return element.type === 'link' || element.type === 'image' ? true : isInline(element);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return editor;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var SlateViewer = /*#__PURE__*/function (_React$Component) {
|
|
33
|
+
_inherits(SlateViewer, _React$Component);
|
|
34
|
+
|
|
35
|
+
var _super = _createSuper(SlateViewer);
|
|
36
|
+
|
|
37
|
+
function SlateViewer(props) {
|
|
38
|
+
var _this;
|
|
39
|
+
|
|
40
|
+
_classCallCheck(this, SlateViewer);
|
|
41
|
+
|
|
42
|
+
_this = _super.call(this, props);
|
|
43
|
+
_this.editor = withInline(withVoid(withReact(createEditor())));
|
|
44
|
+
window.viewer = _this.editor;
|
|
45
|
+
return _this;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
_createClass(SlateViewer, [{
|
|
49
|
+
key: "render",
|
|
50
|
+
value: function render() {
|
|
51
|
+
var _this$props = this.props,
|
|
52
|
+
value = _this$props.value,
|
|
53
|
+
renderDiffElement = _this$props.renderDiffElement,
|
|
54
|
+
renderDiffLeaf = _this$props.renderDiffLeaf;
|
|
55
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: "article"
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Slate, {
|
|
58
|
+
editor: this.editor,
|
|
59
|
+
value: value
|
|
60
|
+
}, /*#__PURE__*/React.createElement(Editable, {
|
|
61
|
+
readOnly: true,
|
|
62
|
+
className: 'viewer-component',
|
|
63
|
+
decorate: decorationNode,
|
|
64
|
+
renderElement: renderDiffElement ? renderDiffElement : renderNode,
|
|
65
|
+
renderLeaf: renderDiffLeaf ? renderDiffLeaf : renderLeaf
|
|
66
|
+
})));
|
|
67
|
+
}
|
|
68
|
+
}]);
|
|
69
|
+
|
|
70
|
+
return SlateViewer;
|
|
71
|
+
}(React.Component);
|
|
72
|
+
|
|
73
|
+
export default SlateViewer;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import '../css/richeditor/formula.css';
|
|
7
|
+
|
|
8
|
+
var ViewerFormula = /*#__PURE__*/function (_React$Component) {
|
|
9
|
+
_inherits(ViewerFormula, _React$Component);
|
|
10
|
+
|
|
11
|
+
var _super = _createSuper(ViewerFormula);
|
|
12
|
+
|
|
13
|
+
function ViewerFormula() {
|
|
14
|
+
var _this;
|
|
15
|
+
|
|
16
|
+
_classCallCheck(this, ViewerFormula);
|
|
17
|
+
|
|
18
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
|
+
args[_key] = arguments[_key];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
23
|
+
|
|
24
|
+
_this.renderFormula = function () {
|
|
25
|
+
var node = _this.props.node;
|
|
26
|
+
_this.formulaContainer.innerHTML = '';
|
|
27
|
+
var formula = node.data.formula;
|
|
28
|
+
var dom = window.MathJax.tex2svg(formula);
|
|
29
|
+
|
|
30
|
+
_this.formulaContainer.appendChild(dom);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return _this;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_createClass(ViewerFormula, [{
|
|
37
|
+
key: "componentDidMount",
|
|
38
|
+
value: function componentDidMount() {
|
|
39
|
+
var node = this.props.node;
|
|
40
|
+
if (!node.data.formula) return;
|
|
41
|
+
this.renderFormula();
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "render",
|
|
45
|
+
value: function render() {
|
|
46
|
+
var _this2 = this;
|
|
47
|
+
|
|
48
|
+
var _this$props = this.props,
|
|
49
|
+
attributes = _this$props.attributes,
|
|
50
|
+
children = _this$props.children;
|
|
51
|
+
return /*#__PURE__*/React.createElement("span", Object.assign({
|
|
52
|
+
className: 'block-formula'
|
|
53
|
+
}, attributes), /*#__PURE__*/React.createElement("span", {
|
|
54
|
+
contentEditable: false,
|
|
55
|
+
ref: function ref(_ref) {
|
|
56
|
+
return _this2.formulaContainer = _ref;
|
|
57
|
+
}
|
|
58
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
59
|
+
contentEditable: false
|
|
60
|
+
}, children));
|
|
61
|
+
}
|
|
62
|
+
}]);
|
|
63
|
+
|
|
64
|
+
return ViewerFormula;
|
|
65
|
+
}(React.Component);
|
|
66
|
+
|
|
67
|
+
export default ViewerFormula;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import Modal from '../components/modal-portal';
|
|
7
|
+
|
|
8
|
+
var ViewerImage = /*#__PURE__*/function (_React$Component) {
|
|
9
|
+
_inherits(ViewerImage, _React$Component);
|
|
10
|
+
|
|
11
|
+
var _super = _createSuper(ViewerImage);
|
|
12
|
+
|
|
13
|
+
function ViewerImage(props) {
|
|
14
|
+
var _this;
|
|
15
|
+
|
|
16
|
+
_classCallCheck(this, ViewerImage);
|
|
17
|
+
|
|
18
|
+
_this = _super.call(this, props);
|
|
19
|
+
|
|
20
|
+
_this.toggleBigImage = function (event) {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
|
|
23
|
+
_this.setState({
|
|
24
|
+
isShowBigImage: !_this.state.isShowBigImage
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
_this.renderBigImage = function (src) {
|
|
29
|
+
return /*#__PURE__*/React.createElement(BigImage, {
|
|
30
|
+
src: src,
|
|
31
|
+
toggleBigImage: _this.toggleBigImage
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
_this.state = {
|
|
36
|
+
isShowBigImage: false
|
|
37
|
+
};
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_createClass(ViewerImage, [{
|
|
42
|
+
key: "render",
|
|
43
|
+
value: function render() {
|
|
44
|
+
var _this$props = this.props,
|
|
45
|
+
attributes = _this$props.attributes,
|
|
46
|
+
node = _this$props.node;
|
|
47
|
+
var data = node.data;
|
|
48
|
+
var isShowBigImage = this.state.isShowBigImage;
|
|
49
|
+
var src = data.src;
|
|
50
|
+
var dom = /*#__PURE__*/React.createElement("span", {
|
|
51
|
+
className: "seafile-ed-image seafile-ed-image-viwer"
|
|
52
|
+
}, /*#__PURE__*/React.createElement("img", Object.assign({
|
|
53
|
+
draggable: false,
|
|
54
|
+
src: src,
|
|
55
|
+
alt: ""
|
|
56
|
+
}, attributes, {
|
|
57
|
+
width: data.width,
|
|
58
|
+
height: data.height
|
|
59
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
60
|
+
onClick: this.toggleBigImage,
|
|
61
|
+
className: "image-full-button"
|
|
62
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
63
|
+
className: 'iconfont icon-fullscreen'
|
|
64
|
+
})), isShowBigImage && this.renderBigImage(src));
|
|
65
|
+
return src ? dom : /*#__PURE__*/React.createElement("span", attributes, "Loading...");
|
|
66
|
+
}
|
|
67
|
+
}]);
|
|
68
|
+
|
|
69
|
+
return ViewerImage;
|
|
70
|
+
}(React.Component);
|
|
71
|
+
|
|
72
|
+
var BigImage = function BigImage(props) {
|
|
73
|
+
return /*#__PURE__*/React.createElement(Modal, null, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
className: 'big-image-cover',
|
|
75
|
+
onClick: function onClick(event) {
|
|
76
|
+
return props.toggleBigImage(event);
|
|
77
|
+
}
|
|
78
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
className: 'big-image-container'
|
|
80
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
81
|
+
src: props.src,
|
|
82
|
+
alt: ""
|
|
83
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
onClick: function onClick(event) {
|
|
85
|
+
return props.toggleBigImage(event);
|
|
86
|
+
},
|
|
87
|
+
className: 'image-container-close'
|
|
88
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
89
|
+
className: 'iconfont icon-close'
|
|
90
|
+
}))));
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export { ViewerImage };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
var OutlineItem = /*#__PURE__*/function (_React$Component) {
|
|
9
|
+
_inherits(OutlineItem, _React$Component);
|
|
10
|
+
|
|
11
|
+
var _super = _createSuper(OutlineItem);
|
|
12
|
+
|
|
13
|
+
function OutlineItem() {
|
|
14
|
+
var _this;
|
|
15
|
+
|
|
16
|
+
_classCallCheck(this, OutlineItem);
|
|
17
|
+
|
|
18
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
|
+
args[_key] = arguments[_key];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
23
|
+
|
|
24
|
+
_this.onClick = function (event) {
|
|
25
|
+
_this.props.viewer.scrollToNode(_this.props.node);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return _this;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_createClass(OutlineItem, [{
|
|
32
|
+
key: "render",
|
|
33
|
+
value: function render() {
|
|
34
|
+
var node = this.props.node;
|
|
35
|
+
var c;
|
|
36
|
+
|
|
37
|
+
if (node.depth === 2) {
|
|
38
|
+
c = 'seafile-md-viewer-outline-heading2';
|
|
39
|
+
} else if (node.depth === 3) {
|
|
40
|
+
c = 'seafile-md-viewer-outline-heading3';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: c,
|
|
45
|
+
onClick: this.onClick
|
|
46
|
+
}, node.text);
|
|
47
|
+
}
|
|
48
|
+
}]);
|
|
49
|
+
|
|
50
|
+
return OutlineItem;
|
|
51
|
+
}(React.Component);
|
|
52
|
+
|
|
53
|
+
var OutlineView = /*#__PURE__*/function (_React$Component2) {
|
|
54
|
+
_inherits(OutlineView, _React$Component2);
|
|
55
|
+
|
|
56
|
+
var _super2 = _createSuper(OutlineView);
|
|
57
|
+
|
|
58
|
+
function OutlineView() {
|
|
59
|
+
_classCallCheck(this, OutlineView);
|
|
60
|
+
|
|
61
|
+
return _super2.apply(this, arguments);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_createClass(OutlineView, [{
|
|
65
|
+
key: "render",
|
|
66
|
+
value: function render() {
|
|
67
|
+
var _this2 = this;
|
|
68
|
+
|
|
69
|
+
var root = this.props.treeRoot;
|
|
70
|
+
|
|
71
|
+
if (root == null) {
|
|
72
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "seafile-viewer-outline"
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var headingList = root.children.filter(function (node) {
|
|
78
|
+
return node.type === 'heading' && (node.depth === 2 || node.depth === 3);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
for (var i = 0; i < headingList.length; i++) {
|
|
82
|
+
var _iterator = _createForOfIteratorHelper(headingList[i].children),
|
|
83
|
+
_step;
|
|
84
|
+
|
|
85
|
+
try {
|
|
86
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
87
|
+
var child = _step.value;
|
|
88
|
+
|
|
89
|
+
if (child.type === 'text') {
|
|
90
|
+
headingList[i].text = child.value;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
} catch (err) {
|
|
95
|
+
_iterator.e(err);
|
|
96
|
+
} finally {
|
|
97
|
+
_iterator.f();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
headingList[i].key = i;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
104
|
+
className: "seafile-viewer-outline"
|
|
105
|
+
}, headingList.map(function (node) {
|
|
106
|
+
return /*#__PURE__*/React.createElement(OutlineItem, {
|
|
107
|
+
key: node.key,
|
|
108
|
+
viewer: _this2.props.viewer,
|
|
109
|
+
node: node
|
|
110
|
+
});
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
}]);
|
|
114
|
+
|
|
115
|
+
return OutlineView;
|
|
116
|
+
}(React.Component);
|
|
117
|
+
|
|
118
|
+
export default OutlineView;
|
package/package.json
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@seafile/seafile-editor",
|
|
3
|
+
"version": "0.3.76",
|
|
4
|
+
"private": false,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@seafile/slate-react": "^0.54.13",
|
|
7
|
+
"codemirror": "^5.37.0",
|
|
8
|
+
"crypto-js": "^3.1.9-1",
|
|
9
|
+
"deep-equal": "^1.0.1",
|
|
10
|
+
"deepmerge": "^2.1.0",
|
|
11
|
+
"detect-indent": "^4.0.0",
|
|
12
|
+
"detect-newline": "^2.1.0",
|
|
13
|
+
"ends-with": "^0.2.0",
|
|
14
|
+
"glamor": "^2.20.40",
|
|
15
|
+
"hast-util-sanitize": "^1.1.2",
|
|
16
|
+
"i18next": "^17.0.13",
|
|
17
|
+
"i18next-browser-languagedetector": "^3.0.3",
|
|
18
|
+
"i18next-xhr-backend": "^3.1.2",
|
|
19
|
+
"is-data-uri": "^0.1.0",
|
|
20
|
+
"is-hotkey": "^0.1.3",
|
|
21
|
+
"is-url": "^1.2.4",
|
|
22
|
+
"jszip": "^3.2.1",
|
|
23
|
+
"lodash": "4.17.21",
|
|
24
|
+
"mdast-util-definitions": "^1.2.2",
|
|
25
|
+
"moment": "^2.22.2",
|
|
26
|
+
"object-assign": "4.1.1",
|
|
27
|
+
"prismjs": "1.23.0",
|
|
28
|
+
"promise": "8.0.1",
|
|
29
|
+
"prop-types": "^15.6.1",
|
|
30
|
+
"react": "^16.8.6",
|
|
31
|
+
"react-dom": "^16.8.6",
|
|
32
|
+
"react-i18next": "^10.12.2",
|
|
33
|
+
"react-mentions": "^3.0.2",
|
|
34
|
+
"react-select": "^2.4.2",
|
|
35
|
+
"reactstrap": "^5.0.0-beta.3",
|
|
36
|
+
"rehype-format": "^2.2.0",
|
|
37
|
+
"rehype-mathjax": "^2.0.0",
|
|
38
|
+
"rehype-raw": "^2.0.0",
|
|
39
|
+
"rehype-stringify": "^3.0.0",
|
|
40
|
+
"remark": "^9.0.0",
|
|
41
|
+
"remark-breaks": "^1.0.0",
|
|
42
|
+
"remark-math": "^3.0.0",
|
|
43
|
+
"remark-parse": "^5.0.0",
|
|
44
|
+
"remark-rehype": "^3.0.0",
|
|
45
|
+
"remark-slug": "^5.0.0",
|
|
46
|
+
"request": "^2.88.0",
|
|
47
|
+
"seafile-js": "0.2.168",
|
|
48
|
+
"seafile-ui": "^0.1.10",
|
|
49
|
+
"slate": "^0.54.2",
|
|
50
|
+
"slate-history": "^0.54.2",
|
|
51
|
+
"slate-hotkeys": "0.2.3",
|
|
52
|
+
"slate-html-serializer": "^0.7.2",
|
|
53
|
+
"slate-schema-violations": "^0.1.39",
|
|
54
|
+
"toggle-selection": "^1.0.6",
|
|
55
|
+
"url-parse": "^1.4.3",
|
|
56
|
+
"xtend": "^4.0.1"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"clean": "rm -rf dist && mkdir dist",
|
|
60
|
+
"start": "node scripts/start.js",
|
|
61
|
+
"build": "node scripts/build.js",
|
|
62
|
+
"pub:dist": "export BABEL_ENV=production && ./node_modules/.bin/babel src --out-dir dist --copy-files",
|
|
63
|
+
"pub:optimized": "rm dist/config.js dist/i18n.js dist/index.js",
|
|
64
|
+
"prepublishOnly": "npm run clean && npm run pub:dist && npm run pub:optimized",
|
|
65
|
+
"test": "node scripts/test.js --env=jsdom"
|
|
66
|
+
},
|
|
67
|
+
"jest": {
|
|
68
|
+
"collectCoverageFrom": [
|
|
69
|
+
"src/**/*.{js,jsx,mjs}"
|
|
70
|
+
],
|
|
71
|
+
"setupFiles": [
|
|
72
|
+
"<rootDir>/config/polyfills.js"
|
|
73
|
+
],
|
|
74
|
+
"testMatch": [
|
|
75
|
+
"<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}",
|
|
76
|
+
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}"
|
|
77
|
+
],
|
|
78
|
+
"testEnvironment": "node",
|
|
79
|
+
"testURL": "http://localhost",
|
|
80
|
+
"transform": {
|
|
81
|
+
"^.+\\.(js|jsx|mjs)$": "<rootDir>/node_modules/babel-jest",
|
|
82
|
+
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
|
|
83
|
+
"^(?!.*\\.(js|jsx|mjs|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
|
|
84
|
+
},
|
|
85
|
+
"transformIgnorePatterns": [
|
|
86
|
+
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
|
|
87
|
+
],
|
|
88
|
+
"moduleNameMapper": {
|
|
89
|
+
"^react-native$": "react-native-web"
|
|
90
|
+
},
|
|
91
|
+
"moduleFileExtensions": [
|
|
92
|
+
"web.js",
|
|
93
|
+
"mjs",
|
|
94
|
+
"js",
|
|
95
|
+
"json",
|
|
96
|
+
"web.jsx",
|
|
97
|
+
"jsx",
|
|
98
|
+
"node"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"babel": {
|
|
102
|
+
"presets": [
|
|
103
|
+
[
|
|
104
|
+
"react-app",
|
|
105
|
+
{
|
|
106
|
+
"absoluteRuntime": false
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
],
|
|
110
|
+
"plugins": [
|
|
111
|
+
"@babel/plugin-proposal-object-rest-spread"
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"eslintConfig": {
|
|
115
|
+
"extends": "react-app"
|
|
116
|
+
},
|
|
117
|
+
"files": [
|
|
118
|
+
"dist/",
|
|
119
|
+
"public/",
|
|
120
|
+
"TODO.md"
|
|
121
|
+
],
|
|
122
|
+
"devDependencies": {
|
|
123
|
+
"@babel/cli": "7.13.14",
|
|
124
|
+
"@babel/core": "^7.10.2",
|
|
125
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.9.6",
|
|
126
|
+
"@babel/runtime": "^7.10.2",
|
|
127
|
+
"@reach/router": "1.3.4",
|
|
128
|
+
"@svgr/webpack": "4.3.2",
|
|
129
|
+
"@typescript-eslint/eslint-plugin": "^2.2.0",
|
|
130
|
+
"@typescript-eslint/parser": "^2.2.0",
|
|
131
|
+
"autoprefixer": "7.1.6",
|
|
132
|
+
"babel-eslint": "10.0.3",
|
|
133
|
+
"babel-jest": "^24.9.0",
|
|
134
|
+
"babel-loader": "8.0.6",
|
|
135
|
+
"babel-plugin-named-asset-import": "^0.3.4",
|
|
136
|
+
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
|
137
|
+
"babel-preset-react-app": "^9.0.2",
|
|
138
|
+
"browserslist": "^4.8.0",
|
|
139
|
+
"camelcase": "^5.2.0",
|
|
140
|
+
"case-sensitive-paths-webpack-plugin": "2.2.0",
|
|
141
|
+
"css-loader": "^3.2.1",
|
|
142
|
+
"dotenv": "6.2.0",
|
|
143
|
+
"dotenv-expand": "5.1.0",
|
|
144
|
+
"enzyme": "^3.10.0",
|
|
145
|
+
"enzyme-adapter-react-16": "^1.15.1",
|
|
146
|
+
"eslint": "^6.1.0",
|
|
147
|
+
"eslint-config-react-app": "^5.0.2",
|
|
148
|
+
"eslint-loader": "3.0.2",
|
|
149
|
+
"eslint-plugin-flowtype": "3.13.0",
|
|
150
|
+
"eslint-plugin-import": "2.18.2",
|
|
151
|
+
"eslint-plugin-jsx-a11y": "6.2.3",
|
|
152
|
+
"eslint-plugin-react": "7.14.3",
|
|
153
|
+
"eslint-plugin-react-hooks": "^1.6.1",
|
|
154
|
+
"extract-text-webpack-plugin": "3.0.2",
|
|
155
|
+
"file-loader": "3.0.1",
|
|
156
|
+
"fs-extra": "7.0.1",
|
|
157
|
+
"html-webpack-plugin": "^4.0.0-beta.5",
|
|
158
|
+
"identity-obj-proxy": "3.0.0",
|
|
159
|
+
"is-wsl": "^1.1.0",
|
|
160
|
+
"jest": "24.9.0",
|
|
161
|
+
"jest-environment-jsdom-fourteen": "0.1.0",
|
|
162
|
+
"jest-resolve": "24.9.0",
|
|
163
|
+
"jest-watch-typeahead": "0.4.0",
|
|
164
|
+
"mini-css-extract-plugin": "^0.5.0",
|
|
165
|
+
"optimize-css-assets-webpack-plugin": "5.0.3",
|
|
166
|
+
"pnp-webpack-plugin": "1.5.0",
|
|
167
|
+
"postcss": "^7.0.0",
|
|
168
|
+
"postcss-flexbugs-fixes": "^4.1.0",
|
|
169
|
+
"postcss-loader": "^3.0.0",
|
|
170
|
+
"postcss-normalize": "7.0.1",
|
|
171
|
+
"postcss-preset-env": "6.7.0",
|
|
172
|
+
"postcss-safe-parser": "4.0.1",
|
|
173
|
+
"raf": "3.4.0",
|
|
174
|
+
"react": "^16.12.0",
|
|
175
|
+
"react-app-polyfill": "^1.0.4",
|
|
176
|
+
"react-dev-utils": "^9.1.0",
|
|
177
|
+
"react-dom": "^16.12.0",
|
|
178
|
+
"resolve": "1.12.0",
|
|
179
|
+
"resolve-url-loader": "3.1.2",
|
|
180
|
+
"sass-loader": "7.2.0",
|
|
181
|
+
"semver": "6.3.0",
|
|
182
|
+
"style-loader": "^1.0.1",
|
|
183
|
+
"terser-webpack-plugin": "4.2.3",
|
|
184
|
+
"ts-pnp": "1.1.4",
|
|
185
|
+
"url-loader": "2.1.0",
|
|
186
|
+
"webpack": "4.41.0",
|
|
187
|
+
"webpack-dev-server": "3.11.2",
|
|
188
|
+
"webpack-manifest-plugin": "2.1.1",
|
|
189
|
+
"workbox-webpack-plugin": "4.3.1"
|
|
190
|
+
},
|
|
191
|
+
"description": "This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).",
|
|
192
|
+
"main": "dist/editor/editor.js",
|
|
193
|
+
"repository": {
|
|
194
|
+
"type": "git",
|
|
195
|
+
"url": "git+https://github.com/seafileltd/seafile-editor.git"
|
|
196
|
+
},
|
|
197
|
+
"author": "Seafile Ltd",
|
|
198
|
+
"license": "ISC",
|
|
199
|
+
"bugs": {
|
|
200
|
+
"url": "https://github.com/seafileltd/seafile-editor/issues"
|
|
201
|
+
},
|
|
202
|
+
"homepage": "https://github.com/seafileltd/seafile-editor#readme",
|
|
203
|
+
"browserslist": {
|
|
204
|
+
"production": [
|
|
205
|
+
">0.2%",
|
|
206
|
+
"not dead",
|
|
207
|
+
"not op_mini all"
|
|
208
|
+
],
|
|
209
|
+
"development": [
|
|
210
|
+
"last 1 chrome version",
|
|
211
|
+
"last 1 firefox version",
|
|
212
|
+
"last 1 safari version"
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
6
|
+
<meta name="theme-color" content="#000000">
|
|
7
|
+
|
|
8
|
+
<!--
|
|
9
|
+
manifest.json provides metadata used when your web app is added to the
|
|
10
|
+
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
|
|
11
|
+
-->
|
|
12
|
+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
|
|
13
|
+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
|
|
14
|
+
|
|
15
|
+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
16
|
+
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%/media/seafile-editor-font.css" />
|
|
17
|
+
<link rel="stylesheet" type="text/css" href="%PUBLIC_URL%/media/seafile-ui.css" />
|
|
18
|
+
<!--
|
|
19
|
+
Notice the use of %PUBLIC_URL% in the tags above.
|
|
20
|
+
It will be replaced with the URL of the `public` folder during the build.
|
|
21
|
+
Only files inside the `public` folder can be referenced from the HTML.
|
|
22
|
+
|
|
23
|
+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
24
|
+
work correctly both with client-side routing and a non-root public URL.
|
|
25
|
+
Learn how to configure a non-root public URL by running `npm run build`.
|
|
26
|
+
-->
|
|
27
|
+
<title>React App</title>
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<noscript>
|
|
31
|
+
You need to enable JavaScript to run this app.
|
|
32
|
+
</noscript>
|
|
33
|
+
<div id="root"></div>
|
|
34
|
+
<!--
|
|
35
|
+
This HTML file is a template.
|
|
36
|
+
If you open it directly in the browser, you will see an empty page.
|
|
37
|
+
|
|
38
|
+
You can add webfonts, meta tags, or analytics to this file.
|
|
39
|
+
The build step will place the bundled scripts into the <body> tag.
|
|
40
|
+
|
|
41
|
+
To begin the development, run `npm start` or `yarn start`.
|
|
42
|
+
To create a production bundle, use `npm run build` or `yarn build`.
|
|
43
|
+
-->
|
|
44
|
+
</body>
|
|
45
|
+
</html>
|