@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.
Files changed (156) hide show
  1. package/README.md +119 -0
  2. package/TODO.md +55 -0
  3. package/dist/components/add-formula-dialog.js +135 -0
  4. package/dist/components/add-image-dialog.js +78 -0
  5. package/dist/components/add-link-dialog.js +148 -0
  6. package/dist/components/comment-dialog.js +107 -0
  7. package/dist/components/comment-panel.js +452 -0
  8. package/dist/components/context-menu.js +112 -0
  9. package/dist/components/detail-list-view.js +119 -0
  10. package/dist/components/generate-share-link.js +412 -0
  11. package/dist/components/internal-link-dialog.js +96 -0
  12. package/dist/components/loading.js +32 -0
  13. package/dist/components/markdown-lint.js +87 -0
  14. package/dist/components/modal-portal.js +46 -0
  15. package/dist/components/outline.js +130 -0
  16. package/dist/components/participants-list.js +126 -0
  17. package/dist/components/related-files-list.js +75 -0
  18. package/dist/components/shortcut-dialog.js +167 -0
  19. package/dist/components/side-panel.js +175 -0
  20. package/dist/components/toast/alert.js +150 -0
  21. package/dist/components/toast/index.js +3 -0
  22. package/dist/components/toast/toast.js +179 -0
  23. package/dist/components/toast/toastManager.js +158 -0
  24. package/dist/components/toast/toaster.js +76 -0
  25. package/dist/components/toolbar.js +235 -0
  26. package/dist/components/topbar-component/button-group.js +31 -0
  27. package/dist/components/topbar-component/editor-toolbar.js +545 -0
  28. package/dist/components/topbar-component/file-info.js +65 -0
  29. package/dist/components/topbar-component/header-list.js +128 -0
  30. package/dist/components/topbar-component/icon-button.js +99 -0
  31. package/dist/components/topbar-component/insert-file.js +67 -0
  32. package/dist/components/topbar-component/table-toolbar.js +175 -0
  33. package/dist/components/topbar-component/upload-img.js +122 -0
  34. package/dist/components/user-help.js +205 -0
  35. package/dist/css/diff-viewer.css +105 -0
  36. package/dist/css/history-viewer.css +104 -0
  37. package/dist/css/keyboard-shortcuts.css +59 -0
  38. package/dist/css/layout.css +110 -0
  39. package/dist/css/markdown-viewer-slate/file-tags-list.css +76 -0
  40. package/dist/css/markdown-viewer.css +69 -0
  41. package/dist/css/plaineditor/markdown-editor.css +12 -0
  42. package/dist/css/react-mentions-default-style.js +72 -0
  43. package/dist/css/related-files-list.css +56 -0
  44. package/dist/css/richeditor/comments-list.css +184 -0
  45. package/dist/css/richeditor/detail-list-view.css +114 -0
  46. package/dist/css/richeditor/document-info.css +57 -0
  47. package/dist/css/richeditor/formula.css +19 -0
  48. package/dist/css/richeditor/image.css +141 -0
  49. package/dist/css/richeditor/link.css +7 -0
  50. package/dist/css/richeditor/navbar-imgbutton.css +79 -0
  51. package/dist/css/richeditor/participants-list.css +22 -0
  52. package/dist/css/richeditor/rich-editor-main.css +42 -0
  53. package/dist/css/richeditor/right-panel.css +84 -0
  54. package/dist/css/richeditor/side-panel.css +190 -0
  55. package/dist/css/richeditor/table.css +57 -0
  56. package/dist/css/richeditor/textlink-hovermenu.css +47 -0
  57. package/dist/css/richeditor/tree-view.css +67 -0
  58. package/dist/css/topbar.css +400 -0
  59. package/dist/editor/code-highlight-package.js +27 -0
  60. package/dist/editor/controller/block-element-controller.js +376 -0
  61. package/dist/editor/controller/inline-element-controller.js +129 -0
  62. package/dist/editor/controller/normalize-controller.js +107 -0
  63. package/dist/editor/controller/shortcut-controller.js +394 -0
  64. package/dist/editor/controller/void-element-controller.js +12 -0
  65. package/dist/editor/custom/custom.js +17 -0
  66. package/dist/editor/custom/get-event-transfer.js +34 -0
  67. package/dist/editor/custom/getNodesByTypeAtRange.js +69 -0
  68. package/dist/editor/custom/insertNodes.js +140 -0
  69. package/dist/editor/custom/is-empty-paragraph.js +13 -0
  70. package/dist/editor/custom/set-event-transfer.js +31 -0
  71. package/dist/editor/custom/split-nodes-at-point.js +162 -0
  72. package/dist/editor/custom/unwrap-node-by-type-at-range.js +81 -0
  73. package/dist/editor/editor-component/check-list-item.js +64 -0
  74. package/dist/editor/editor-component/code-block.js +150 -0
  75. package/dist/editor/editor-component/formula.js +79 -0
  76. package/dist/editor/editor-component/image.js +215 -0
  77. package/dist/editor/editor-component/link.js +11 -0
  78. package/dist/editor/editor-component/table.js +172 -0
  79. package/dist/editor/editor-component/textlink-hovermenu.js +136 -0
  80. package/dist/editor/editor-plugin.js +249 -0
  81. package/dist/editor/editor-utils/block-element-utils/blockquote-utils.js +96 -0
  82. package/dist/editor/editor-utils/block-element-utils/code-utils.js +162 -0
  83. package/dist/editor/editor-utils/block-element-utils/formula-utils.js +58 -0
  84. package/dist/editor/editor-utils/block-element-utils/index.js +38 -0
  85. package/dist/editor/editor-utils/block-element-utils/list-utils.js +398 -0
  86. package/dist/editor/editor-utils/block-element-utils/table-utils.js +418 -0
  87. package/dist/editor/editor-utils/common-editor-utils.js +587 -0
  88. package/dist/editor/editor-utils/inline-element-utils/index.js +95 -0
  89. package/dist/editor/editor-utils/mark-utils.js +25 -0
  90. package/dist/editor/editor-utils/range-utils.js +9 -0
  91. package/dist/editor/editor-utils/selection-utils.js +33 -0
  92. package/dist/editor/editor-utils/text-utils.js +130 -0
  93. package/dist/editor/editor.js +66 -0
  94. package/dist/editor/element-model/blockquote.js +16 -0
  95. package/dist/editor/element-model/image.js +19 -0
  96. package/dist/editor/element-model/link.js +19 -0
  97. package/dist/editor/element-model/table.js +50 -0
  98. package/dist/editor/element-model/text.js +13 -0
  99. package/dist/editor/load-script.js +83 -0
  100. package/dist/editor/plain-markdown-editor.js +324 -0
  101. package/dist/editor/rich-markdown-editor.js +580 -0
  102. package/dist/editor/seafile-editor.js +326 -0
  103. package/dist/editor/simple-editor.js +245 -0
  104. package/dist/editor-api.js +261 -0
  105. package/dist/index.css +97 -0
  106. package/dist/lib/slate-hyperscript/creators.js +263 -0
  107. package/dist/lib/slate-hyperscript/hyperscript.js +92 -0
  108. package/dist/lib/slate-hyperscript/index.js +3 -0
  109. package/dist/lib/slate-hyperscript/tokens.js +102 -0
  110. package/dist/lib/unified/index.js +470 -0
  111. package/dist/lib/vfile/core.js +172 -0
  112. package/dist/lib/vfile/index.js +48 -0
  113. package/dist/seafile-editor-chooser.js +45 -0
  114. package/dist/seafile-markdown-editor.js +301 -0
  115. package/dist/seafile-markdown-viewer.js +79 -0
  116. package/dist/seafile-simple-editor.js +56 -0
  117. package/dist/utils/copy-to-clipboard.js +47 -0
  118. package/dist/utils/deserialize-html.js +282 -0
  119. package/dist/utils/diff/compare-strings.js +46 -0
  120. package/dist/utils/diff/diff.js +855 -0
  121. package/dist/utils/diff/index.js +2 -0
  122. package/dist/utils/render-slate.js +219 -0
  123. package/dist/utils/seafile-markdown2html.js +62 -0
  124. package/dist/utils/slate2markdown/deserialize.js +689 -0
  125. package/dist/utils/slate2markdown/index.js +3 -0
  126. package/dist/utils/slate2markdown/serialize.js +407 -0
  127. package/dist/utils/utils.js +28 -0
  128. package/dist/viewer/diff-viewer.js +98 -0
  129. package/dist/viewer/markdown-viewer.js +139 -0
  130. package/dist/viewer/slate-viewer.js +73 -0
  131. package/dist/viewer/viewer-formula.js +67 -0
  132. package/dist/viewer/viewer-image.js +93 -0
  133. package/dist/viewer/viewer-outline.js +118 -0
  134. package/package.json +215 -0
  135. package/public/favicon.ico +0 -0
  136. package/public/index.html +45 -0
  137. package/public/locales/cs/seafile-editor.json +169 -0
  138. package/public/locales/de/seafile-editor.json +169 -0
  139. package/public/locales/en/seafile-editor.json +222 -0
  140. package/public/locales/es/seafile-editor.json +169 -0
  141. package/public/locales/es-AR/seafile-editor.json +169 -0
  142. package/public/locales/es-MX/seafile-editor.json +169 -0
  143. package/public/locales/fr/seafile-editor.json +169 -0
  144. package/public/locales/it/seafile-editor.json +169 -0
  145. package/public/locales/ru/seafile-editor.json +169 -0
  146. package/public/locales/zh-CN/seafile-editor.json +219 -0
  147. package/public/manifest.json +15 -0
  148. package/public/media/scripts/mathjax/tex-svg.js +1 -0
  149. package/public/media/seafile-editor-font/iconfont.eot +0 -0
  150. package/public/media/seafile-editor-font/iconfont.svg +164 -0
  151. package/public/media/seafile-editor-font/iconfont.ttf +0 -0
  152. package/public/media/seafile-editor-font/iconfont.woff +0 -0
  153. package/public/media/seafile-editor-font/iconfont.woff2 +0 -0
  154. package/public/media/seafile-editor-font.css +201 -0
  155. package/public/media/seafile-logo.png +0 -0
  156. package/public/media/seafile-ui.css +11169 -0
@@ -0,0 +1,235 @@
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 HeaderList from '../components/topbar-component/header-list';
7
+ import ButtonGroup from '../components/topbar-component/button-group';
8
+ import IconButton from '../components/topbar-component/icon-button';
9
+ import { withTranslation } from 'react-i18next';
10
+ import AddLinkDialog from './add-link-dialog';
11
+ import AddImageDialog from './add-image-dialog';
12
+ import AddFormulaDialog from './add-formula-dialog';
13
+ import TableToolBar from './topbar-component/table-toolbar';
14
+ import { EditorUtils } from '../editor/editor-utils/common-editor-utils';
15
+ import UploadImg from './topbar-component/upload-img'; // import InsertFile from './topbarcomponent/insertFile';
16
+
17
+ var ToolBar = /*#__PURE__*/function (_React$Component) {
18
+ _inherits(ToolBar, _React$Component);
19
+
20
+ var _super = _createSuper(ToolBar);
21
+
22
+ function ToolBar(props) {
23
+ var _this;
24
+
25
+ _classCallCheck(this, ToolBar);
26
+
27
+ _this = _super.call(this, props);
28
+
29
+ _this.onToggleLink = function (event) {
30
+ event.preventDefault();
31
+
32
+ var isLinkActive = _this.editorUtils.isLinkActive();
33
+
34
+ if (!isLinkActive) {
35
+ _this.props.onToggleLinkDialog();
36
+
37
+ return;
38
+ } else {
39
+ _this.editorUtils.unwrapLink();
40
+ }
41
+ };
42
+
43
+ _this.editor = window.editor;
44
+ _this.editorUtils = new EditorUtils(_this.editor);
45
+ return _this;
46
+ }
47
+
48
+ _createClass(ToolBar, [{
49
+ key: "render",
50
+ value: function render() {
51
+ var _this2 = this;
52
+
53
+ var t = this.props.t;
54
+ var toolbarStatus = this.props.toolbarStatus;
55
+ var readOnly = this.props.readOnly;
56
+ var isTableActive = toolbarStatus.isTableActive,
57
+ isHeadActive = toolbarStatus.isHeadActive,
58
+ isCodeActive = toolbarStatus.isCodeActive,
59
+ isBoldActive = toolbarStatus.isBoldActive,
60
+ isItalicActive = toolbarStatus.isItalicActive,
61
+ isInlineCodeActive = toolbarStatus.isInlineCodeActive,
62
+ isLinkActive = toolbarStatus.isLinkActive,
63
+ isBlockquoteActive = toolbarStatus.isBlockquoteActive,
64
+ isOrderedListActive = toolbarStatus.isOrderedListActive,
65
+ isUnorderedListActive = toolbarStatus.isUnorderedListActive,
66
+ isCheckListActive = toolbarStatus.isCheckListActive,
67
+ isFormulaActive = toolbarStatus.isFormulaActive;
68
+ var isListActive = isOrderedListActive || isUnorderedListActive || isCheckListActive;
69
+ return /*#__PURE__*/React.createElement("div", {
70
+ className: 'sf-editor-rich-menu ' + (this.props.isSimpleEditor ? '' : 'rich-menu')
71
+ }, /*#__PURE__*/React.createElement("div", {
72
+ className: 'button-container'
73
+ }, !readOnly && /*#__PURE__*/React.createElement("div", {
74
+ className: 'header-list-container'
75
+ }, /*#__PURE__*/React.createElement(HeaderList, {
76
+ disabled: isFormulaActive || isCodeActive || isTableActive,
77
+ headerType: toolbarStatus.headerType,
78
+ onClickHeader: this.editorUtils.onClickHeader
79
+ })), /*#__PURE__*/React.createElement(ButtonGroup, {
80
+ className: 'editor-btn-group'
81
+ }, /*#__PURE__*/React.createElement(IconButton, {
82
+ disabled: isFormulaActive || isCodeActive || isHeadActive,
83
+ isRichEditor: true,
84
+ text: t('bold'),
85
+ id: 'BOLDButton',
86
+ icon: 'iconfont icon-bold',
87
+ isActive: isBoldActive,
88
+ onMouseDown: function onMouseDown(event) {
89
+ return _this2.editorUtils.onClickMark(event, 'BOLD');
90
+ }
91
+ }), /*#__PURE__*/React.createElement(IconButton, {
92
+ disabled: isFormulaActive || isCodeActive || isHeadActive,
93
+ isRichEditor: true,
94
+ text: t('italic'),
95
+ id: 'ITALICButton',
96
+ icon: 'iconfont icon-italic',
97
+ isActive: isItalicActive,
98
+ onMouseDown: function onMouseDown(event) {
99
+ return _this2.editorUtils.onClickMark(event, 'ITALIC');
100
+ }
101
+ }), /*#__PURE__*/React.createElement(IconButton, {
102
+ disabled: isFormulaActive || isCodeActive || isHeadActive,
103
+ isRichEditor: true,
104
+ text: t('code'),
105
+ id: 'CODEButton',
106
+ icon: 'iconfont icon-code',
107
+ isActive: isInlineCodeActive,
108
+ onMouseDown: function onMouseDown(event) {
109
+ return _this2.editorUtils.onClickMark(event, 'CODE');
110
+ }
111
+ }), /*#__PURE__*/React.createElement(IconButton, {
112
+ disabled: isFormulaActive || isCodeActive || isHeadActive,
113
+ isRichEditor: true,
114
+ text: t('insert_link'),
115
+ id: 'linkButton',
116
+ icon: 'iconfont icon-link',
117
+ isActive: isLinkActive,
118
+ onMouseDown: this.onToggleLink
119
+ })), /*#__PURE__*/React.createElement(ButtonGroup, {
120
+ className: 'editor-btn-group'
121
+ }, /*#__PURE__*/React.createElement(IconButton, {
122
+ disabled: isFormulaActive || isTableActive || isCodeActive || isHeadActive,
123
+ isRichEditor: true,
124
+ text: t('quote'),
125
+ id: 'block-quoteButton',
126
+ icon: 'iconfont icon-quote-left',
127
+ isActive: isBlockquoteActive,
128
+ onMouseDown: function onMouseDown(event) {
129
+ return _this2.editorUtils.onClickBlock(event, 'blockquote');
130
+ }
131
+ }), /*#__PURE__*/React.createElement(IconButton, {
132
+ disabled: isFormulaActive || isTableActive || isCodeActive || isHeadActive,
133
+ isRichEditor: true,
134
+ text: t('ordered_list'),
135
+ id: 'ordered_listButton',
136
+ icon: 'iconfont icon-list-ol',
137
+ isActive: isOrderedListActive,
138
+ onMouseDown: function onMouseDown(event) {
139
+ return _this2.editorUtils.onClickBlock(event, 'ordered_list');
140
+ }
141
+ }), /*#__PURE__*/React.createElement(IconButton, {
142
+ disabled: isFormulaActive || isTableActive || isCodeActive || isHeadActive,
143
+ isRichEditor: true,
144
+ text: t('unordered_list'),
145
+ id: 'unordered_listButton',
146
+ icon: 'iconfont icon-list-ul',
147
+ isActive: isUnorderedListActive,
148
+ onMouseDown: function onMouseDown(event) {
149
+ return _this2.editorUtils.onClickBlock(event, 'unordered_list');
150
+ }
151
+ }), /*#__PURE__*/React.createElement(IconButton, {
152
+ disabled: isFormulaActive || isTableActive || isCodeActive || isHeadActive,
153
+ isRichEditor: true,
154
+ text: t('check_list_item'),
155
+ id: 'checkListItemButton',
156
+ icon: 'iconfont icon-check-square',
157
+ isActive: isCheckListActive,
158
+ onMouseDown: this.editorUtils.onToggleCheckItem
159
+ })), /*#__PURE__*/React.createElement(ButtonGroup, {
160
+ className: 'editor-btn-group'
161
+ }, /*#__PURE__*/React.createElement(IconButton, {
162
+ disabled: isFormulaActive || isTableActive || isHeadActive,
163
+ isRichEditor: true,
164
+ text: t('code_block'),
165
+ id: 'codeButton',
166
+ icon: 'iconfont icon-code-block',
167
+ onMouseDown: function onMouseDown(event) {
168
+ return _this2.editorUtils.onClickBlock(event, 'code_block');
169
+ },
170
+ isActive: isCodeActive && !readOnly
171
+ }), /*#__PURE__*/React.createElement(IconButton, {
172
+ disabled: isFormulaActive || isCodeActive || isTableActive || isHeadActive,
173
+ isRichEditor: true,
174
+ text: t('insert_table'),
175
+ id: 'tableButton',
176
+ icon: 'iconfont icon-table',
177
+ onMouseDown: this.editorUtils.onAddTable
178
+ }), window.canInsertFormula && /*#__PURE__*/React.createElement(IconButton, {
179
+ disabled: isFormulaActive || isCodeActive || isTableActive || isHeadActive || isListActive,
180
+ isRichEditor: true,
181
+ text: t('insert_formula'),
182
+ id: 'formulaButton',
183
+ icon: 'iconfont icon-formula',
184
+ onMouseDown: this.props.onToggleFormulaDialog
185
+ }), /*#__PURE__*/React.createElement(UploadImg, {
186
+ disabled: isFormulaActive || isCodeActive || isHeadActive,
187
+ text: 'insert_image',
188
+ id: 'insertImageButton',
189
+ insertRepoFile: this.props.insertRepoFile,
190
+ isSimpleEditor: this.props.isSimpleEditor,
191
+ onInsertImage: this.editorUtils.insertImage,
192
+ toolbarStatus: this.props.toolbarStatus,
193
+ onToggleImageDialog: this.props.onToggleImageDialog
194
+ })), isTableActive && !readOnly && /*#__PURE__*/React.createElement(TableToolBar, {
195
+ onRemoveTable: this.editorUtils.onRemoveTable,
196
+ onInsertColumn: this.editorUtils.onInsertColumn,
197
+ onRemoveColumn: this.editorUtils.onRemoveColumn,
198
+ onInsertRow: this.editorUtils.onInsertRow,
199
+ onRemoveRow: this.editorUtils.onRemoveRow,
200
+ onSetAlign: this.editorUtils.onSetAlign
201
+ })), this.props.hasSidePanel && /*#__PURE__*/React.createElement("div", {
202
+ className: "button-container"
203
+ }, !this.props.isShowSidePanel && /*#__PURE__*/React.createElement(ButtonGroup, {
204
+ className: "editor-btn-group position-absolute dropdown-menu-right"
205
+ }, /*#__PURE__*/React.createElement(IconButton, {
206
+ isRichEditor: true,
207
+ text: t('Show_side_panel'),
208
+ id: "showSidepanel",
209
+ icon: "iconfont icon-angle-double-left",
210
+ isActive: false,
211
+ onMouseDown: this.props.toggleSidePanel
212
+ })), this.props.isShowSidePanel && /*#__PURE__*/React.createElement(ButtonGroup, {
213
+ className: "editor-btn-group position-absolute dropdown-menu-right"
214
+ }, /*#__PURE__*/React.createElement(IconButton, {
215
+ isRichEditor: true,
216
+ text: t('Hide_side_panel'),
217
+ id: "hideSidepanel",
218
+ icon: "iconfont icon-angle-double-right",
219
+ isActive: false,
220
+ onMouseDown: this.props.toggleSidePanel
221
+ }))), this.props.isShowLinkDialog && /*#__PURE__*/React.createElement(AddLinkDialog, {
222
+ toggleLinkDialog: this.props.onToggleLinkDialog
223
+ }), this.props.isShowFormulaDialog && /*#__PURE__*/React.createElement(AddFormulaDialog, {
224
+ toggleFormulaDialog: this.props.onToggleFormulaDialog
225
+ }), this.props.isShowImageDialog && /*#__PURE__*/React.createElement(AddImageDialog, {
226
+ onToggleImageDialog: this.props.onToggleImageDialog,
227
+ insertImage: this.editorUtils.insertImage
228
+ }));
229
+ }
230
+ }]);
231
+
232
+ return ToolBar;
233
+ }(React.Component);
234
+
235
+ export default withTranslation('seafile-editor')(ToolBar);
@@ -0,0 +1,31 @@
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
+
7
+ var ButtonGroup = /*#__PURE__*/function (_React$PureComponent) {
8
+ _inherits(ButtonGroup, _React$PureComponent);
9
+
10
+ var _super = _createSuper(ButtonGroup);
11
+
12
+ function ButtonGroup() {
13
+ _classCallCheck(this, ButtonGroup);
14
+
15
+ return _super.apply(this, arguments);
16
+ }
17
+
18
+ _createClass(ButtonGroup, [{
19
+ key: "render",
20
+ value: function render() {
21
+ return /*#__PURE__*/React.createElement("div", {
22
+ className: 'btn-group ' + this.props.className,
23
+ role: 'group'
24
+ }, this.props.children);
25
+ }
26
+ }]);
27
+
28
+ return ButtonGroup;
29
+ }(React.PureComponent);
30
+
31
+ export default ButtonGroup;