@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,219 @@
|
|
|
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 CheckListItem from '../editor/editor-component/check-list-item';
|
|
7
|
+
import Formula from '../viewer/viewer-formula';
|
|
8
|
+
import { ViewerImage } from '../viewer/viewer-image';
|
|
9
|
+
|
|
10
|
+
function renderNode(_ref) {
|
|
11
|
+
var attributes = _ref.attributes,
|
|
12
|
+
children = _ref.children,
|
|
13
|
+
element = _ref.element;
|
|
14
|
+
var node = element;
|
|
15
|
+
var data = node.data ? node.data : {};
|
|
16
|
+
var checked = data.checked;
|
|
17
|
+
var align = data.align;
|
|
18
|
+
var href = data.href;
|
|
19
|
+
var diffClass = data.diff_state;
|
|
20
|
+
var diffIndex = data.new_index;
|
|
21
|
+
align = ['left', 'right', 'center'].indexOf(align) === -1 ? 'left' : align;
|
|
22
|
+
|
|
23
|
+
switch (node.type) {
|
|
24
|
+
case 'paragraph':
|
|
25
|
+
return /*#__PURE__*/React.createElement("p", Object.assign({
|
|
26
|
+
className: diffClass ? diffClass + ' ' + (data['paragraph_state'] ? data['paragraph_state'] : '') : ''
|
|
27
|
+
}, attributes), children);
|
|
28
|
+
|
|
29
|
+
case 'blockquote':
|
|
30
|
+
return /*#__PURE__*/React.createElement("blockquote", attributes, children);
|
|
31
|
+
|
|
32
|
+
case 'header_one':
|
|
33
|
+
return /*#__PURE__*/React.createElement("h1", Object.assign({}, attributes, {
|
|
34
|
+
id: 'user-content-' + node.children[0].text
|
|
35
|
+
}), children);
|
|
36
|
+
|
|
37
|
+
case 'header_two':
|
|
38
|
+
return /*#__PURE__*/React.createElement("h2", Object.assign({}, attributes, {
|
|
39
|
+
id: 'user-content-' + node.children[0].text
|
|
40
|
+
}), children);
|
|
41
|
+
|
|
42
|
+
case 'header_three':
|
|
43
|
+
return /*#__PURE__*/React.createElement("h3", Object.assign({}, attributes, {
|
|
44
|
+
id: 'user-content-' + node.children[0].text
|
|
45
|
+
}), children);
|
|
46
|
+
|
|
47
|
+
case 'header_four':
|
|
48
|
+
return /*#__PURE__*/React.createElement("h4", attributes, children);
|
|
49
|
+
|
|
50
|
+
case 'header_five':
|
|
51
|
+
return /*#__PURE__*/React.createElement("h5", attributes, children);
|
|
52
|
+
|
|
53
|
+
case 'header_six':
|
|
54
|
+
return /*#__PURE__*/React.createElement("h6", attributes, children);
|
|
55
|
+
|
|
56
|
+
case 'list_item':
|
|
57
|
+
if (checked === undefined) return /*#__PURE__*/React.createElement("li", Object.assign({
|
|
58
|
+
value: diffIndex ? diffIndex >= 0 ? diffIndex + 1 : data['old_index'] + 1 : '',
|
|
59
|
+
className: diffClass ? diffClass : ''
|
|
60
|
+
}, attributes), children);
|
|
61
|
+
return /*#__PURE__*/React.createElement(CheckListItem, {
|
|
62
|
+
className: diffClass ? diffClass : '',
|
|
63
|
+
attributes: attributes,
|
|
64
|
+
children: children,
|
|
65
|
+
element: element
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
case 'unordered_list':
|
|
69
|
+
return /*#__PURE__*/React.createElement("ul", Object.assign({
|
|
70
|
+
className: diffClass ? diffClass : ''
|
|
71
|
+
}, attributes), children);
|
|
72
|
+
|
|
73
|
+
case 'ordered_list':
|
|
74
|
+
return /*#__PURE__*/React.createElement("ol", Object.assign({
|
|
75
|
+
className: diffClass ? diffClass : ''
|
|
76
|
+
}, attributes), children);
|
|
77
|
+
|
|
78
|
+
case 'image':
|
|
79
|
+
return /*#__PURE__*/React.createElement(ViewerImage, {
|
|
80
|
+
attributes: attributes,
|
|
81
|
+
children: children,
|
|
82
|
+
node: node
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
case 'code_block':
|
|
86
|
+
return /*#__PURE__*/React.createElement("pre", {
|
|
87
|
+
className: 'code-container'
|
|
88
|
+
}, /*#__PURE__*/React.createElement("code", Object.assign({
|
|
89
|
+
className: 'code'
|
|
90
|
+
}, attributes), children), /*#__PURE__*/React.createElement(LanguageSet, {
|
|
91
|
+
disabled: true,
|
|
92
|
+
lang: node.data.syntax
|
|
93
|
+
}));
|
|
94
|
+
|
|
95
|
+
case 'code_line':
|
|
96
|
+
return /*#__PURE__*/React.createElement("p", attributes, children);
|
|
97
|
+
|
|
98
|
+
case 'table':
|
|
99
|
+
return /*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("tbody", attributes, children));
|
|
100
|
+
|
|
101
|
+
case 'table_row':
|
|
102
|
+
return /*#__PURE__*/React.createElement("tr", Object.assign({
|
|
103
|
+
className: diffClass ? diffClass : ''
|
|
104
|
+
}, attributes), children);
|
|
105
|
+
|
|
106
|
+
case 'table_cell':
|
|
107
|
+
return /*#__PURE__*/React.createElement("td", Object.assign({
|
|
108
|
+
className: diffClass ? diffClass : '',
|
|
109
|
+
style: {
|
|
110
|
+
textAlign: align
|
|
111
|
+
}
|
|
112
|
+
}, attributes), children);
|
|
113
|
+
|
|
114
|
+
case 'link':
|
|
115
|
+
return /*#__PURE__*/React.createElement("a", Object.assign({
|
|
116
|
+
className: diffClass ? diffClass : ''
|
|
117
|
+
}, attributes, {
|
|
118
|
+
href: href
|
|
119
|
+
}), children);
|
|
120
|
+
|
|
121
|
+
case 'hr':
|
|
122
|
+
return /*#__PURE__*/React.createElement("hr", attributes);
|
|
123
|
+
|
|
124
|
+
case 'formula':
|
|
125
|
+
return /*#__PURE__*/React.createElement(Formula, Object.assign({
|
|
126
|
+
className: diffClass ? diffClass : '',
|
|
127
|
+
node: node,
|
|
128
|
+
children: children
|
|
129
|
+
}, attributes));
|
|
130
|
+
|
|
131
|
+
default:
|
|
132
|
+
return /*#__PURE__*/React.createElement("p", attributes, children);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
var renderLeaf = function renderLeaf(_ref2) {
|
|
137
|
+
var attributes = _ref2.attributes,
|
|
138
|
+
children = _ref2.children,
|
|
139
|
+
leaf = _ref2.leaf;
|
|
140
|
+
|
|
141
|
+
if (leaf.BOLD) {
|
|
142
|
+
children = /*#__PURE__*/React.createElement("strong", null, children);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (leaf.CODE) {
|
|
146
|
+
children = /*#__PURE__*/React.createElement("code", null, children);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (leaf.ITALIC) {
|
|
150
|
+
children = /*#__PURE__*/React.createElement("i", null, children);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (leaf.DELETE) {
|
|
154
|
+
children = /*#__PURE__*/React.createElement("del", null, children);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (leaf.ADD) {
|
|
158
|
+
children = /*#__PURE__*/React.createElement("ins", null, children);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (leaf.decoration) {
|
|
162
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
163
|
+
className: "token ".concat(leaf.type)
|
|
164
|
+
}, children);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return /*#__PURE__*/React.createElement("span", attributes, children);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
var LanguageSet = /*#__PURE__*/function (_React$PureComponent) {
|
|
171
|
+
_inherits(LanguageSet, _React$PureComponent);
|
|
172
|
+
|
|
173
|
+
var _super = _createSuper(LanguageSet);
|
|
174
|
+
|
|
175
|
+
function LanguageSet() {
|
|
176
|
+
_classCallCheck(this, LanguageSet);
|
|
177
|
+
|
|
178
|
+
return _super.apply(this, arguments);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
_createClass(LanguageSet, [{
|
|
182
|
+
key: "render",
|
|
183
|
+
value: function render() {
|
|
184
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
185
|
+
className: "language-type"
|
|
186
|
+
}, /*#__PURE__*/React.createElement("select", {
|
|
187
|
+
value: this.props.lang,
|
|
188
|
+
disabled: true,
|
|
189
|
+
name: "language"
|
|
190
|
+
}, /*#__PURE__*/React.createElement("option", {
|
|
191
|
+
value: "none"
|
|
192
|
+
}, "Text"), /*#__PURE__*/React.createElement("option", {
|
|
193
|
+
value: "html"
|
|
194
|
+
}, "HTML"), /*#__PURE__*/React.createElement("option", {
|
|
195
|
+
value: "css"
|
|
196
|
+
}, "CSS"), /*#__PURE__*/React.createElement("option", {
|
|
197
|
+
value: "javascript"
|
|
198
|
+
}, "Javascript"), /*#__PURE__*/React.createElement("option", {
|
|
199
|
+
value: "c"
|
|
200
|
+
}, "C"), /*#__PURE__*/React.createElement("option", {
|
|
201
|
+
value: "cpp"
|
|
202
|
+
}, "C++"), /*#__PURE__*/React.createElement("option", {
|
|
203
|
+
value: "csharp"
|
|
204
|
+
}, "C#"), /*#__PURE__*/React.createElement("option", {
|
|
205
|
+
value: "java"
|
|
206
|
+
}, "Java"), /*#__PURE__*/React.createElement("option", {
|
|
207
|
+
value: "python"
|
|
208
|
+
}, "Python"), /*#__PURE__*/React.createElement("option", {
|
|
209
|
+
value: "sql"
|
|
210
|
+
}, "Sql"), /*#__PURE__*/React.createElement("option", {
|
|
211
|
+
value: "swift"
|
|
212
|
+
}, "Swift")));
|
|
213
|
+
}
|
|
214
|
+
}]);
|
|
215
|
+
|
|
216
|
+
return LanguageSet;
|
|
217
|
+
}(React.PureComponent);
|
|
218
|
+
|
|
219
|
+
export { renderNode, renderLeaf };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var unified = require('../lib/unified');
|
|
2
|
+
|
|
3
|
+
var markdown = require('remark-parse');
|
|
4
|
+
|
|
5
|
+
var slug = require('remark-slug');
|
|
6
|
+
|
|
7
|
+
var breaks = require('remark-breaks');
|
|
8
|
+
|
|
9
|
+
var remark2rehype = require('remark-rehype');
|
|
10
|
+
|
|
11
|
+
var format = require('rehype-format');
|
|
12
|
+
|
|
13
|
+
var raw = require('rehype-raw');
|
|
14
|
+
|
|
15
|
+
var xtend = require('xtend');
|
|
16
|
+
|
|
17
|
+
var toHTML = require('hast-util-to-html');
|
|
18
|
+
|
|
19
|
+
var sanitize = require('hast-util-sanitize');
|
|
20
|
+
|
|
21
|
+
var gh = require('hast-util-sanitize/lib/github');
|
|
22
|
+
|
|
23
|
+
var deepmerge = require('deepmerge').default;
|
|
24
|
+
|
|
25
|
+
var mathjax = require('rehype-mathjax/browser');
|
|
26
|
+
|
|
27
|
+
var math = require('remark-math/block');
|
|
28
|
+
|
|
29
|
+
function stringify(config) {
|
|
30
|
+
var settings = xtend(config, this.data('settings'));
|
|
31
|
+
var schema = deepmerge(gh, {
|
|
32
|
+
'attributes': {
|
|
33
|
+
'input': ['type'],
|
|
34
|
+
'li': ['className'],
|
|
35
|
+
'code': ['className'],
|
|
36
|
+
'span': ['className'],
|
|
37
|
+
'div': ['className']
|
|
38
|
+
},
|
|
39
|
+
'tagNames': ['input', 'code', 'span', 'div']
|
|
40
|
+
});
|
|
41
|
+
this.Compiler = compiler;
|
|
42
|
+
|
|
43
|
+
function compiler(tree) {
|
|
44
|
+
// use sanity to remove dangerous html, the default is
|
|
45
|
+
// GitHub style sanitation
|
|
46
|
+
var hast = sanitize(tree, schema);
|
|
47
|
+
return toHTML(hast, settings);
|
|
48
|
+
}
|
|
49
|
+
} // markdown -> mdast -> html AST -> html
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
var processor = unified().use(markdown, {
|
|
53
|
+
commonmark: true
|
|
54
|
+
}).use(math).use(breaks).use(slug).use(remark2rehype, {
|
|
55
|
+
allowDangerousHTML: true
|
|
56
|
+
}).use(mathjax, {
|
|
57
|
+
displayMath: ['$$', '$$']
|
|
58
|
+
}).use(raw).use(format).use(stringify);
|
|
59
|
+
var processorGetAST = unified().use(markdown, {
|
|
60
|
+
commonmark: true
|
|
61
|
+
}).use(slug);
|
|
62
|
+
export { processor, processorGetAST };
|