@seafile/seafile-editor 0.3.99 → 0.3.102

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 (85) hide show
  1. package/README.md +42 -110
  2. package/dist/assets/css/comment-dialog.css +50 -0
  3. package/dist/{css → assets/css}/diff-viewer.css +0 -0
  4. package/dist/{css/richeditor → assets/css}/formula.css +0 -0
  5. package/dist/{css → assets/css}/history-viewer.css +0 -0
  6. package/dist/{css/richeditor → assets/css}/image.css +0 -0
  7. package/dist/assets/css/issue-card.css +43 -0
  8. package/dist/{css → assets/css}/keyboard-shortcuts.css +0 -0
  9. package/dist/{css/richeditor → assets/css}/link.css +0 -0
  10. package/dist/{css/plaineditor → assets/css}/markdown-editor.css +0 -0
  11. package/dist/{css → assets/css}/markdown-viewer.css +0 -0
  12. package/dist/{css/richeditor → assets/css}/navbar-imgbutton.css +0 -0
  13. package/dist/assets/css/outline.css +29 -0
  14. package/dist/{css/richeditor → assets/css}/table.css +0 -0
  15. package/dist/{css/richeditor → assets/css}/textlink-hovermenu.css +0 -0
  16. package/dist/{css → assets/css}/topbar.css +38 -146
  17. package/dist/{css/richeditor → assets/css}/tree-view.css +0 -0
  18. package/dist/{css/richeditor/right-panel.css → assets/css/user-help.css} +9 -9
  19. package/dist/assets/editor/plain-editor.css +30 -0
  20. package/dist/assets/editor/simple-editor.css +77 -0
  21. package/dist/components/add-formula-dialog.js +6 -4
  22. package/dist/components/add-image-dialog.js +3 -1
  23. package/dist/components/add-link-dialog.js +4 -3
  24. package/dist/components/comment-dialog.js +12 -6
  25. package/dist/components/markdown-lint.js +1 -0
  26. package/dist/components/outline/index.js +104 -0
  27. package/dist/components/outline/outline-item.js +70 -0
  28. package/dist/components/shortcut-dialog.js +1 -1
  29. package/dist/components/{topbar-component → toolbar}/header-list.js +0 -0
  30. package/dist/components/toolbar/help-group.js +40 -0
  31. package/dist/components/toolbar/index.js +4 -0
  32. package/dist/components/{topbar-component/upload-img.js → toolbar/insert-image.js} +18 -15
  33. package/dist/components/toolbar/insert-table.js +155 -0
  34. package/dist/components/toolbar/table-group.js +82 -0
  35. package/dist/components/{toolbar.js → toolbar/toolbar.js} +102 -64
  36. package/dist/components/{topbar-component → toolbar/widgets}/button-group.js +0 -0
  37. package/dist/components/toolbar/widgets/button-item.js +144 -0
  38. package/dist/components/toolbar/widgets/drop-list.js +101 -0
  39. package/dist/components/user-help.js +16 -10
  40. package/dist/editor/controller/block-element-controller.js +6 -2
  41. package/dist/editor/controller/inline-element-controller.js +6 -2
  42. package/dist/editor/editor-builder.js +107 -0
  43. package/dist/editor/editor-component/formula.js +4 -2
  44. package/dist/editor/editor-component/image.js +10 -6
  45. package/dist/editor/editor-component/table.js +1 -1
  46. package/dist/editor/editor-plugin.js +3 -1
  47. package/dist/editor/editor.js +1 -32
  48. package/dist/editor/index.js +97 -0
  49. package/dist/editor/markdown-editor.js +323 -0
  50. package/dist/editor/plain-markdown-editor.js +5 -4
  51. package/dist/editor/simple-editor.js +44 -78
  52. package/dist/index.js +9 -0
  53. package/dist/utils/slate2markdown/serialize.js +12 -1
  54. package/dist/viewer/diff-viewer.js +1 -1
  55. package/dist/viewer/markdown-viewer.js +16 -15
  56. package/dist/viewer/slate-viewer.js +40 -28
  57. package/dist/viewer/viewer-formula.js +1 -1
  58. package/package.json +18 -17
  59. package/dist/components/comment-panel.js +0 -431
  60. package/dist/components/detail-list-view.js +0 -104
  61. package/dist/components/generate-share-link.js +0 -412
  62. package/dist/components/internal-link-dialog.js +0 -96
  63. package/dist/components/outline.js +0 -130
  64. package/dist/components/participants-list.js +0 -126
  65. package/dist/components/side-panel.js +0 -174
  66. package/dist/components/topbar-component/icon-button.js +0 -99
  67. package/dist/components/topbar-component/insert-file.js +0 -67
  68. package/dist/components/topbar-component/table-toolbar.js +0 -175
  69. package/dist/css/layout.css +0 -111
  70. package/dist/css/markdown-viewer-slate/file-tags-list.css +0 -76
  71. package/dist/css/react-mentions-default-style.js +0 -76
  72. package/dist/css/richeditor/comments-list.css +0 -184
  73. package/dist/css/richeditor/detail-list-view.css +0 -105
  74. package/dist/css/richeditor/document-info.css +0 -57
  75. package/dist/css/richeditor/participants-list.css +0 -22
  76. package/dist/css/richeditor/rich-editor-main.css +0 -32
  77. package/dist/css/richeditor/side-panel.css +0 -183
  78. package/dist/editor/rich-markdown-editor.js +0 -521
  79. package/dist/editor/seafile-editor.js +0 -325
  80. package/dist/editor-api.js +0 -256
  81. package/dist/index.css +0 -97
  82. package/dist/seafile-editor-chooser.js +0 -45
  83. package/dist/seafile-markdown-editor.js +0 -289
  84. package/dist/seafile-markdown-viewer.js +0 -78
  85. package/dist/seafile-simple-editor.js +0 -56
@@ -0,0 +1,144 @@
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 { Tooltip } from 'reactstrap';
7
+ import { withTranslation } from 'react-i18next';
8
+
9
+ var ButtonItem = /*#__PURE__*/function (_React$Component) {
10
+ _inherits(ButtonItem, _React$Component);
11
+
12
+ var _super = _createSuper(ButtonItem);
13
+
14
+ function ButtonItem(props) {
15
+ var _this;
16
+
17
+ _classCallCheck(this, ButtonItem);
18
+
19
+ _this = _super.call(this, props);
20
+
21
+ _this.toggle = function () {
22
+ var disabled = _this.props.disabled;
23
+ if (disabled) return;
24
+ var _this$state = _this.state,
25
+ isFreezed = _this$state.isFreezed,
26
+ tooltipOpen = _this$state.tooltipOpen;
27
+ if (isFreezed && !tooltipOpen) return;
28
+
29
+ _this.setState({
30
+ tooltipOpen: !tooltipOpen,
31
+ isFreezed: true
32
+ });
33
+
34
+ _this.timer = setTimeout(function () {
35
+ _this.setState({
36
+ isFreezed: false
37
+ });
38
+ }, 100);
39
+ };
40
+
41
+ _this.onClick = function (event) {
42
+ if (!_this.props.disabled) {
43
+ _this.props.onClick && _this.props.onClick(event);
44
+ }
45
+ };
46
+
47
+ _this.onMouseDown = function (event) {
48
+ if (!_this.props.disabled) {
49
+ _this.props.onMouseDown(event);
50
+ }
51
+ };
52
+
53
+ _this.getClassName = function () {
54
+ var _this$props = _this.props,
55
+ isRichEditor = _this$props.isRichEditor,
56
+ className = _this$props.className,
57
+ disabled = _this$props.disabled;
58
+ var itemClass = 'btn btn-icon btn-secondary btn-active';
59
+ if (!isRichEditor) return itemClass + ' ' + className;
60
+ itemClass = "rich-icon-btn ".concat(disabled ? 'rich-icon-btn-disabled' : 'rich-icon-btn-hover');
61
+ return itemClass + ' ' + className;
62
+ };
63
+
64
+ _this.state = {
65
+ tooltipOpen: false,
66
+ isFreezed: false
67
+ };
68
+ return _this;
69
+ }
70
+
71
+ _createClass(ButtonItem, [{
72
+ key: "componentWillUnmount",
73
+ value: function componentWillUnmount() {
74
+ this.timer && clearTimeout(this.timer);
75
+ }
76
+ }, {
77
+ key: "shouldComponentUpdate",
78
+ value: function shouldComponentUpdate(nextProps, nextState) {
79
+ var disabled = nextProps.disabled,
80
+ isActive = nextProps.isActive;
81
+ var _this$props2 = this.props,
82
+ oldDisabled = _this$props2.disabled,
83
+ oldIsActive = _this$props2.isActive;
84
+
85
+ if (disabled !== oldDisabled) {
86
+ this.setState({
87
+ tooltipOpen: false
88
+ });
89
+ return true;
90
+ } // only render iconButton when the button is active or show show tooltip
91
+
92
+
93
+ var tooltipOpen = nextState.tooltipOpen;
94
+ var oldTooltipOpen = this.state.tooltipOpen;
95
+
96
+ if (tooltipOpen === oldTooltipOpen && isActive === oldIsActive) {
97
+ return false;
98
+ }
99
+
100
+ return true;
101
+ }
102
+ }, {
103
+ key: "render",
104
+ value: function render() {
105
+ var tooltipOpen = this.state.tooltipOpen;
106
+ var _this$props3 = this.props,
107
+ id = _this$props3.id,
108
+ isActive = _this$props3.isActive,
109
+ disabled = _this$props3.disabled,
110
+ icon = _this$props3.icon,
111
+ text = _this$props3.text;
112
+ var className = this.getClassName();
113
+ var delay = {
114
+ show: 0,
115
+ hide: 0
116
+ };
117
+ return /*#__PURE__*/React.createElement("button", {
118
+ type: "button",
119
+ id: id,
120
+ className: className,
121
+ "data-active": isActive,
122
+ disabled: disabled,
123
+ onClick: this.onClick,
124
+ onMouseDown: this.onMouseDown
125
+ }, /*#__PURE__*/React.createElement("i", {
126
+ className: icon
127
+ }), /*#__PURE__*/React.createElement(Tooltip, {
128
+ target: id,
129
+ isOpen: tooltipOpen,
130
+ delay: delay,
131
+ placement: "bottom",
132
+ toggle: this.toggle
133
+ }, text));
134
+ }
135
+ }]);
136
+
137
+ return ButtonItem;
138
+ }(React.Component);
139
+
140
+ ButtonItem.defaultProps = {
141
+ className: '',
142
+ isActive: false
143
+ };
144
+ export default withTranslation('seafile-editor')(ButtonItem);
@@ -0,0 +1,101 @@
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 ReactDOM from 'react-dom';
7
+
8
+ var DropList = /*#__PURE__*/function (_React$PureComponent) {
9
+ _inherits(DropList, _React$PureComponent);
10
+
11
+ var _super = _createSuper(DropList);
12
+
13
+ function DropList(props) {
14
+ var _this;
15
+
16
+ _classCallCheck(this, DropList);
17
+
18
+ _this = _super.call(this, props);
19
+
20
+ _this.handleClick = function (event) {
21
+ if (_this.props.disabled) return;
22
+
23
+ var container = _this.getContainer();
24
+
25
+ if (container.contains(event.target)) {
26
+ _this.toggle();
27
+ } else {
28
+ if (_this.state.dropdownOpen) {
29
+ _this.setState({
30
+ dropdownOpen: !_this.state.dropdownOpen
31
+ });
32
+ }
33
+ }
34
+ };
35
+
36
+ _this.toggle = function () {
37
+ _this.setState({
38
+ dropdownOpen: !_this.state.dropdownOpen
39
+ });
40
+ };
41
+
42
+ _this.state = {
43
+ dropdownOpen: false
44
+ };
45
+ return _this;
46
+ }
47
+
48
+ _createClass(DropList, [{
49
+ key: "getContainer",
50
+ value: function getContainer() {
51
+ return ReactDOM.findDOMNode(this);
52
+ }
53
+ }, {
54
+ key: "componentDidMount",
55
+ value: function componentDidMount() {
56
+ document.addEventListener('click', this.handleClick);
57
+ }
58
+ }, {
59
+ key: "componentWillUnmount",
60
+ value: function componentWillUnmount() {
61
+ document.removeEventListener('click', this.handleClick);
62
+ }
63
+ }, {
64
+ key: "render",
65
+ value: function render() {
66
+ var items = [];
67
+ this.props.items.forEach(function (item, index) {
68
+ items.push( /*#__PURE__*/React.createElement("button", {
69
+ key: 'dropdown-item' + index,
70
+ onMouseDown: item.handle,
71
+ className: 'dropdown-item'
72
+ }, item.icon ? /*#__PURE__*/React.createElement("i", {
73
+ className: item.icon,
74
+ style: {
75
+ marginRight: '6px'
76
+ }
77
+ }) : null, item.text));
78
+ });
79
+ return /*#__PURE__*/React.createElement("div", {
80
+ className: 'custom-dropdown-list'
81
+ }, /*#__PURE__*/React.createElement("div", {
82
+ id: 'list_toggle',
83
+ className: 'dropdown-list-toggle'
84
+ }, /*#__PURE__*/React.createElement("i", {
85
+ className: this.props.icon,
86
+ style: {
87
+ marginRight: '3px'
88
+ }
89
+ }), /*#__PURE__*/React.createElement("i", {
90
+ className: this.state.dropdownOpen ? 'iconfont icon-caret-up' : 'iconfont icon-drop-down'
91
+ })), this.state.dropdownOpen && /*#__PURE__*/React.createElement("div", {
92
+ role: 'menu',
93
+ className: 'custom-dropdown-menu dropdown-menu'
94
+ }, items));
95
+ }
96
+ }]);
97
+
98
+ return DropList;
99
+ }(React.PureComponent);
100
+
101
+ export default DropList;
@@ -3,6 +3,8 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
+ import { withTranslation } from 'react-i18next';
7
+ import '../assets/css/user-help.css';
6
8
 
7
9
  var ShortCut = /*#__PURE__*/function (_React$Component) {
8
10
  _inherits(ShortCut, _React$Component);
@@ -162,34 +164,38 @@ var HelpShortcutList = /*#__PURE__*/function (_React$PureComponent2) {
162
164
  return HelpShortcutList;
163
165
  }(React.PureComponent);
164
166
 
165
- var UserHelpDialog = /*#__PURE__*/function (_React$PureComponent3) {
166
- _inherits(UserHelpDialog, _React$PureComponent3);
167
+ var UserHelp = /*#__PURE__*/function (_React$PureComponent3) {
168
+ _inherits(UserHelp, _React$PureComponent3);
167
169
 
168
- var _super4 = _createSuper(UserHelpDialog);
170
+ var _super4 = _createSuper(UserHelp);
169
171
 
170
- function UserHelpDialog() {
171
- _classCallCheck(this, UserHelpDialog);
172
+ function UserHelp() {
173
+ _classCallCheck(this, UserHelp);
172
174
 
173
175
  return _super4.apply(this, arguments);
174
176
  }
175
177
 
176
- _createClass(UserHelpDialog, [{
178
+ _createClass(UserHelp, [{
177
179
  key: "render",
178
180
  value: function render() {
181
+ var t = this.props.t;
182
+ var userHelp = t('userHelp', {
183
+ returnObjects: true
184
+ });
179
185
  return /*#__PURE__*/React.createElement("div", {
180
186
  className: 'seafile-editor-help align-self-end'
181
187
  }, /*#__PURE__*/React.createElement("div", {
182
188
  className: 'help-header d-flex'
183
189
  }, /*#__PURE__*/React.createElement("div", {
184
190
  className: 'help-title'
185
- }, this.props.userHelp.title), /*#__PURE__*/React.createElement("div", {
191
+ }, userHelp.title), /*#__PURE__*/React.createElement("div", {
186
192
  className: 'help-close',
187
193
  onClick: this.props.hideHelpDialog
188
194
  }, /*#__PURE__*/React.createElement("i", {
189
195
  className: 'iconfont icon-times-circle'
190
196
  }))), /*#__PURE__*/React.createElement("div", {
191
197
  className: 'help-content'
192
- }, this.props.userHelp.userHelpData.map(function (item, index) {
198
+ }, userHelp.userHelpData.map(function (item, index) {
193
199
  return /*#__PURE__*/React.createElement(HelpShortcutList, {
194
200
  key: 'help-list' + index,
195
201
  index: index,
@@ -199,7 +205,7 @@ var UserHelpDialog = /*#__PURE__*/function (_React$PureComponent3) {
199
205
  }
200
206
  }]);
201
207
 
202
- return UserHelpDialog;
208
+ return UserHelp;
203
209
  }(React.PureComponent);
204
210
 
205
- export default UserHelpDialog;
211
+ export default withTranslation('seafile-editor')(UserHelp);
@@ -14,6 +14,7 @@ import generateLinkElement from '../element-model/link';
14
14
  import generateImageElement from '../element-model/image';
15
15
  import isUrl from 'is-url';
16
16
  import { SfEditor } from '../custom/custom';
17
+ import EditorBuilder from '../editor-builder';
17
18
 
18
19
  var withBlock = function withBlock(editor) {
19
20
  var exec = editor.exec;
@@ -58,7 +59,10 @@ var withBlock = function withBlock(editor) {
58
59
  return;
59
60
  }
60
61
 
61
- if (window.editor.editorApi.isInternalFileLink(text)) {
62
+ var _EditorBuilder$getEdi = EditorBuilder.getEditor(),
63
+ editorApi = _EditorBuilder$getEdi.editorApi;
64
+
65
+ if (editorApi.isInternalFileLink(text)) {
62
66
  var index = text.lastIndexOf('/');
63
67
 
64
68
  if (index > 0) {
@@ -78,7 +82,7 @@ var withBlock = function withBlock(editor) {
78
82
  }
79
83
  }
80
84
 
81
- if (window.editor.editorApi.isInternalDirLink(text)) {
85
+ if (editorApi.isInternalDirLink(text)) {
82
86
  var _index = text.lastIndexOf('/');
83
87
 
84
88
  if (_index > 0) {
@@ -2,6 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import { Editor, Range } from 'slate';
3
3
  import generateLinkElement from '../element-model/link';
4
4
  import generateImageElement from '../element-model/image';
5
+ import EditorBuilder from '../editor-builder';
5
6
 
6
7
  var withInline = function withInline(editor) {
7
8
  var exec = editor.exec,
@@ -102,8 +103,11 @@ var withInline = function withInline(editor) {
102
103
  break;
103
104
 
104
105
  case 'insert_data':
105
- if (data.types.includes('Files') && data.files[0].type.includes('image') && window.editor.editorApi.uploadLocalImage) {
106
- window.editor.editorApi.uploadLocalImage(command.data.files[0]).then(function (res) {
106
+ var _EditorBuilder$getEdi = EditorBuilder.getEditor(),
107
+ editorApi = _EditorBuilder$getEdi.editorApi;
108
+
109
+ if (data.types.includes('Files') && data.files[0].type.includes('image') && editorApi.uploadLocalImage) {
110
+ editorApi.uploadLocalImage(command.data.files[0]).then(function (res) {
107
111
  var img = generateImageElement({
108
112
  data: {
109
113
  src: res
@@ -0,0 +1,107 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import { createEditor } from 'slate';
4
+ import { withHistory } from 'slate-history';
5
+ import { withReact } from '@seafile/slate-react';
6
+ import withInline from './controller/inline-element-controller';
7
+ import withBlock from './controller/block-element-controller';
8
+ import withVoid from './controller/void-element-controller';
9
+ import withMarkdownShortcut from './controller/shortcut-controller';
10
+ import normalizeNode from './controller/normalize-controller';
11
+ import { EditorUtils } from './editor-utils/common-editor-utils';
12
+ import TableUtils from './editor-utils/block-element-utils/table-utils';
13
+ import Plugin from './editor-plugin';
14
+
15
+ var EditorBuilder = /*#__PURE__*/function () {
16
+ function EditorBuilder() {
17
+ _classCallCheck(this, EditorBuilder);
18
+
19
+ this.editor = null;
20
+ this.plugin = null;
21
+ this.tableUtils = null;
22
+ this.editorUtils = null;
23
+ }
24
+
25
+ _createClass(EditorBuilder, null, [{
26
+ key: "getEditor",
27
+ value: function getEditor(options) {
28
+ if (this.editor && options) {
29
+ if (options && options.onSave) {
30
+ this.editor.onSave = options.onSave;
31
+ }
32
+
33
+ if (options && options.editorApi) {
34
+ this.editor.editorApi = options.editorApi;
35
+ }
36
+ }
37
+
38
+ if (this.editor) return this.editor;
39
+ this.editor = normalizeNode(withMarkdownShortcut(withVoid(withBlock(withInline(withHistory(withReact(createEditor())))))));
40
+
41
+ if (options && options.onSave) {
42
+ this.editor.onSave = options.onSave;
43
+ }
44
+
45
+ if (options && options.editorApi) {
46
+ this.editor.editorApi = options.editorApi;
47
+ }
48
+
49
+ return this.editor;
50
+ }
51
+ }, {
52
+ key: "getSlateEditor",
53
+ value: function getSlateEditor() {
54
+ if (this.editor) this.editor = null;
55
+ this.editor = withInline(withVoid(withReact(createEditor())));
56
+ return this.editor;
57
+ }
58
+ }, {
59
+ key: "resetEditor",
60
+ value: function resetEditor() {
61
+ this.editor = null;
62
+ this.plugin = null;
63
+ this.editorUtils = null;
64
+ this.tableUtils = null;
65
+ }
66
+ }, {
67
+ key: "getEditorRef",
68
+ value: function getEditorRef() {
69
+ var editorRef = window.abcdef_editor;
70
+ return editorRef;
71
+ }
72
+ }, {
73
+ key: "getToolbarRef",
74
+ value: function getToolbarRef() {
75
+ var toolbarRef = window.abcdef_editorToolbar;
76
+ return toolbarRef;
77
+ }
78
+ }, {
79
+ key: "getEditorUtils",
80
+ value: function getEditorUtils() {
81
+ if (this.editorUtils) return this.editorUtils;
82
+ if (!this.editor) this.getEditor();
83
+ this.editorUtils = new EditorUtils(this.editor);
84
+ return this.editorUtils;
85
+ }
86
+ }, {
87
+ key: "getTableUtils",
88
+ value: function getTableUtils() {
89
+ if (this.tableUtils) return this.tableUtils;
90
+ if (!this.editor) this.getEditor();
91
+ this.tableUtils = new TableUtils(this.editor);
92
+ return this.tableUtils;
93
+ }
94
+ }, {
95
+ key: "getPlugin",
96
+ value: function getPlugin() {
97
+ if (this.plugin) return this.plugin;
98
+ if (!this.editor) this.getEditor();
99
+ this.plugin = new Plugin(this.editor);
100
+ return this.plugin;
101
+ }
102
+ }]);
103
+
104
+ return EditorBuilder;
105
+ }();
106
+
107
+ export default EditorBuilder;
@@ -3,7 +3,8 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import '../../css/richeditor/formula.css';
6
+ import '../../assets/css/formula.css';
7
+ import EditorBuilder from '../editor-builder';
7
8
 
8
9
  var Formula = /*#__PURE__*/function (_React$Component) {
9
10
  _inherits(Formula, _React$Component);
@@ -22,7 +23,8 @@ var Formula = /*#__PURE__*/function (_React$Component) {
22
23
  _this = _super.call.apply(_super, [this].concat(args));
23
24
 
24
25
  _this.toggleFormulaEditor = function () {
25
- window.richMarkdownEditor.onToggleFormulaDialog();
26
+ var toolbarRef = EditorBuilder.getToolbarRef();
27
+ toolbarRef.onToggleFormulaDialog();
26
28
  };
27
29
 
28
30
  _this.renderFormula = function () {
@@ -8,6 +8,7 @@ import { withTranslation } from 'react-i18next';
8
8
  import Lightbox from '@seafile/react-image-lightbox';
9
9
  import { Utils } from '../../utils/utils';
10
10
  import InlineElementUtils from '../editor-utils/inline-element-utils';
11
+ import EditorBuilder from '../editor-builder';
11
12
  import '@seafile/react-image-lightbox/style.css';
12
13
 
13
14
  var Image = /*#__PURE__*/function (_React$Component) {
@@ -100,7 +101,8 @@ var Image = /*#__PURE__*/function (_React$Component) {
100
101
  isResizing: false,
101
102
  isShowBigImage: false
102
103
  };
103
- _this.inlineElementUtils = new InlineElementUtils(window.editor);
104
+ var editor = EditorBuilder.getEditor();
105
+ _this.inlineElementUtils = new InlineElementUtils(editor);
104
106
  return _this;
105
107
  }
106
108
 
@@ -128,10 +130,11 @@ var Image = /*#__PURE__*/function (_React$Component) {
128
130
  var src = data.src;
129
131
 
130
132
  if (/^\.\.\/*/.test(src) || /^\.\/*/.test(src)) {
131
- var _window$editor$editor = window.editor.editorApi,
132
- filePath = _window$editor$editor.filePath,
133
- serviceUrl = _window$editor$editor.serviceUrl,
134
- repoID = _window$editor$editor.repoID;
133
+ var editor = EditorBuilder.getEditor();
134
+ var _editor$editorApi = editor.editorApi,
135
+ filePath = _editor$editorApi.filePath,
136
+ serviceUrl = _editor$editorApi.serviceUrl,
137
+ repoID = _editor$editorApi.repoID;
135
138
  var originalPath = filePath.slice(0, filePath.lastIndexOf('/')) + '/' + src;
136
139
  src = serviceUrl + '/lib/' + repoID + '/file/' + Utils.pathNormalize(originalPath) + '?raw=1';
137
140
  }
@@ -221,7 +224,8 @@ var ImagePreviewer = /*#__PURE__*/function (_React$Component2) {
221
224
  });
222
225
  };
223
226
 
224
- _this2.images = _this2.getImageNodes(window.editor.children);
227
+ var editor = EditorBuilder.getEditor();
228
+ _this2.images = _this2.getImageNodes(editor.children);
225
229
  _this2.state = {
226
230
  imageIndex: _this2.images.findIndex(function (item) {
227
231
  return item === props.imageUrl;
@@ -4,7 +4,7 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import ReactDOM from 'react-dom';
7
- import '../../css/richeditor/table.css';
7
+ import '../../assets/css/table.css';
8
8
 
9
9
  var TableContainer = /*#__PURE__*/function (_React$PureComponent) {
10
10
  _inherits(TableContainer, _React$PureComponent);
@@ -7,6 +7,7 @@ import CodeUtils from './editor-utils/block-element-utils/code-utils';
7
7
  import TableUtils from './editor-utils/block-element-utils/table-utils';
8
8
  import setEventTransfer from './custom/set-event-transfer';
9
9
  import { SfEditor } from '../editor/custom/custom';
10
+ import EditorBuilder from './editor-builder';
10
11
 
11
12
  var Plugin = function Plugin(_editor) {
12
13
  var _this = this;
@@ -143,7 +144,8 @@ var Plugin = function Plugin(_editor) {
143
144
  byKey: true
144
145
  })(event)) {
145
146
  event.preventDefault();
146
- window.richMarkdownEditor.onToggleFormulaDialog();
147
+ var toolbarRef = EditorBuilder.getToolbarRef();
148
+ toolbarRef.onToggleFormulaDialog();
147
149
  return;
148
150
  } // compate chrome: in chrome press backspace would not exec delete_backward command
149
151
 
@@ -4,8 +4,6 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import SimpleEditor from './simple-editor';
7
- import SeafileEditor from './seafile-editor';
8
- import LoadScript from './load-script';
9
7
 
10
8
  var SimpleEditorWithErrorBoundary = /*#__PURE__*/function (_React$Component) {
11
9
  _inherits(SimpleEditorWithErrorBoundary, _React$Component);
@@ -34,33 +32,4 @@ var SimpleEditorWithErrorBoundary = /*#__PURE__*/function (_React$Component) {
34
32
  return SimpleEditorWithErrorBoundary;
35
33
  }(React.Component);
36
34
 
37
- var SeafileEditorWithErrorBundary = /*#__PURE__*/function (_React$Component2) {
38
- _inherits(SeafileEditorWithErrorBundary, _React$Component2);
39
-
40
- var _super2 = _createSuper(SeafileEditorWithErrorBundary);
41
-
42
- function SeafileEditorWithErrorBundary() {
43
- _classCallCheck(this, SeafileEditorWithErrorBundary);
44
-
45
- return _super2.apply(this, arguments);
46
- }
47
-
48
- _createClass(SeafileEditorWithErrorBundary, [{
49
- key: "componentDidCatch",
50
- value: function componentDidCatch(error) {
51
- console.error(error);
52
- this.forceUpdate();
53
- }
54
- }, {
55
- key: "render",
56
- value: function render() {
57
- return /*#__PURE__*/React.createElement(LoadScript, {
58
- scriptSource: this.props.scriptSource
59
- }, /*#__PURE__*/React.createElement(SeafileEditor, this.props));
60
- }
61
- }]);
62
-
63
- return SeafileEditorWithErrorBundary;
64
- }(React.Component);
65
-
66
- export { SimpleEditorWithErrorBoundary as SimpleEditor, SeafileEditorWithErrorBundary as SeafileEditor };
35
+ export { SimpleEditorWithErrorBoundary as SimpleEditor };