@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,77 @@
1
+ .seafile-simple-editor {
2
+ flex: 1;
3
+ display: flex;
4
+ flex-direction: column;
5
+ height: 100%;
6
+ min-width: 768px;
7
+ overflow: hidden;
8
+ border: 1px solid #e5e5e5;
9
+ }
10
+
11
+ .seafile-simple-editor .seafile-editor-topbar {
12
+ width: 100%;
13
+ background-color: #fff;
14
+ border-bottom: 1px solid #e5e5e5;
15
+ box-shadow: 0 3px 2px -2px rgba(200,200,200,.15);
16
+ user-select: none;
17
+ position: relative;
18
+ z-index: 3;
19
+ display: flex;
20
+ justify-content: space-between;
21
+ }
22
+
23
+ .seafile-simple-editor .seafile-editor-topbar .use-help-icon {
24
+ background-color: #fff;
25
+ box-sizing: border-box;
26
+ }
27
+
28
+ .seafile-simple-editor .seafile-editor-topbar .editor-btn-group {
29
+ height: 100%;
30
+ padding: 5px 0 5px 5px;
31
+ font-size: 0.75rem;
32
+ border-right: 1px solid #e5e5e5;
33
+ color: #555555;
34
+ }
35
+
36
+ .seafile-simple-editor .header-list-container {
37
+ border-left: 0;
38
+ }
39
+
40
+ .seafile-simple-editor .editor {
41
+ margin: 0;
42
+ padding: 10px;
43
+ height: 100%;
44
+ border: none;
45
+ }
46
+
47
+ /*set scroll bar*/
48
+ .seafile-simple-editor ::-webkit-scrollbar{
49
+ width: 8px;
50
+ height: 8px;
51
+ }
52
+
53
+ .seafile-simple-editor ::-webkit-scrollbar-button {
54
+ display: none;
55
+ }
56
+
57
+ .seafile-simple-editor ::-webkit-scrollbar-thumb {
58
+ background-color: rgb(206, 206, 212);
59
+ border-radius: 10px;
60
+ }
61
+
62
+ .editor-container {
63
+ /* this container is needed to show the scroll bar */
64
+ height: 100%;
65
+ overflow-y: auto;
66
+ flex: 1 1 auto;
67
+ position: relative;
68
+ }
69
+
70
+ .editor {
71
+ min-height: calc(100% - 40px);
72
+ background: #fff;
73
+ padding: 40px 60px;
74
+ margin: 20px 40px;
75
+ border: 1px solid rgb(230,230,221);
76
+ overflow-x: hidden;
77
+ }
@@ -6,7 +6,7 @@ import React, { Fragment } from 'react';
6
6
  import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Input } from 'reactstrap';
7
7
  import { withTranslation } from 'react-i18next';
8
8
  import { Editor } from 'slate';
9
- import { EditorUtils } from '../editor/editor-utils/common-editor-utils';
9
+ import EditorBuilder from '../editor/editor-builder';
10
10
 
11
11
  var AddFormulaDialog = /*#__PURE__*/function (_React$PureComponent) {
12
12
  _inherits(AddFormulaDialog, _React$PureComponent);
@@ -21,7 +21,8 @@ var AddFormulaDialog = /*#__PURE__*/function (_React$PureComponent) {
21
21
  _this = _super.call(this, props);
22
22
 
23
23
  _this.setInitialValue = function () {
24
- var nodes = Editor.match(window.editor, window.editor.selection, {
24
+ var editor = EditorBuilder.getEditor();
25
+ var nodes = Editor.match(editor, editor.selection, {
25
26
  type: 'formula'
26
27
  });
27
28
 
@@ -70,7 +71,7 @@ var AddFormulaDialog = /*#__PURE__*/function (_React$PureComponent) {
70
71
  _this.props.toggleFormulaDialog();
71
72
  };
72
73
 
73
- _this.editorUtils = new EditorUtils(window.editor);
74
+ _this.editorUtils = EditorBuilder.getEditorUtils();
74
75
  _this.state = {
75
76
  formula: ''
76
77
  };
@@ -82,7 +83,8 @@ var AddFormulaDialog = /*#__PURE__*/function (_React$PureComponent) {
82
83
  _createClass(AddFormulaDialog, [{
83
84
  key: "componentDidMount",
84
85
  value: function componentDidMount() {
85
- this.editorSelection = window.editor.selection;
86
+ var editor = EditorBuilder.getEditor();
87
+ this.editorSelection = editor.selection;
86
88
 
87
89
  if (this.formulaNode) {
88
90
  this.renderFormula(this.state.formula);
@@ -5,6 +5,7 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Form, FormGroup, Label, Input } from 'reactstrap';
7
7
  import { withTranslation } from 'react-i18next';
8
+ import EditorBuilder from '../editor/editor-builder';
8
9
 
9
10
  var AddImageDialog = /*#__PURE__*/function (_React$PureComponent) {
10
11
  _inherits(AddImageDialog, _React$PureComponent);
@@ -43,7 +44,8 @@ var AddImageDialog = /*#__PURE__*/function (_React$PureComponent) {
43
44
  _createClass(AddImageDialog, [{
44
45
  key: "componentDidMount",
45
46
  value: function componentDidMount() {
46
- this.editorSelection = window.editor.selection;
47
+ var editor = EditorBuilder.getEditor();
48
+ this.editorSelection = editor.selection;
47
49
  }
48
50
  }, {
49
51
  key: "render",
@@ -5,7 +5,7 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Fragment } from 'react';
6
6
  import { Button, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
7
7
  import { withTranslation } from 'react-i18next';
8
- import { EditorUtils } from '../editor/editor-utils/common-editor-utils';
8
+ import EditorBuilder from '../editor/editor-builder';
9
9
 
10
10
  var AddLinkDialog = /*#__PURE__*/function (_React$PureComponent) {
11
11
  _inherits(AddLinkDialog, _React$PureComponent);
@@ -76,7 +76,7 @@ var AddLinkDialog = /*#__PURE__*/function (_React$PureComponent) {
76
76
  }
77
77
  };
78
78
 
79
- _this.editorUtils = new EditorUtils(window.editor);
79
+ _this.editorUtils = EditorBuilder.getEditorUtils();
80
80
  _this.isLinkActive = _this.editorUtils.isLinkActive();
81
81
  _this.editorSelection = null;
82
82
  _this.state = {
@@ -89,7 +89,8 @@ var AddLinkDialog = /*#__PURE__*/function (_React$PureComponent) {
89
89
  _createClass(AddLinkDialog, [{
90
90
  key: "componentDidMount",
91
91
  value: function componentDidMount() {
92
- this.editorSelection = window.editor.selection;
92
+ var editor = EditorBuilder.getEditor();
93
+ this.editorSelection = editor.selection;
93
94
  }
94
95
  }, {
95
96
  key: "componentWillMount",
@@ -3,8 +3,10 @@ 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';
6
7
  import { Button } from 'reactstrap';
7
8
  import { processor } from '../utils/seafile-markdown2html';
9
+ import '../assets/css/comment-dialog.css';
8
10
 
9
11
  var CommentDialog = /*#__PURE__*/function (_React$Component) {
10
12
  _inherits(CommentDialog, _React$Component);
@@ -74,16 +76,20 @@ var CommentDialog = /*#__PURE__*/function (_React$Component) {
74
76
  }, {
75
77
  key: "render",
76
78
  value: function render() {
79
+ var t = this.props.t;
80
+ var _this$state = this.state,
81
+ comment = _this$state.comment,
82
+ quote = _this$state.quote;
77
83
  return /*#__PURE__*/React.createElement("div", {
78
- className: "comment-dialog"
84
+ className: "seafile-editor-comment comment-dialog"
79
85
  }, /*#__PURE__*/React.createElement("div", null, this.props.editorApi.name), /*#__PURE__*/React.createElement("blockquote", {
80
86
  className: "comment-dialog-quote"
81
87
  }, /*#__PURE__*/React.createElement("div", {
82
88
  dangerouslySetInnerHTML: {
83
- __html: this.state.quote
89
+ __html: quote
84
90
  }
85
91
  })), /*#__PURE__*/React.createElement("textarea", {
86
- value: this.state.comment,
92
+ value: comment,
87
93
  onChange: this.handleCommentChange
88
94
  }), /*#__PURE__*/React.createElement("div", {
89
95
  className: "button-group"
@@ -91,11 +97,11 @@ var CommentDialog = /*#__PURE__*/function (_React$Component) {
91
97
  size: "sm",
92
98
  color: "primary",
93
99
  onClick: this.submitComment
94
- }, this.props.t('submit')), /*#__PURE__*/React.createElement(Button, {
100
+ }, t('submit')), /*#__PURE__*/React.createElement(Button, {
95
101
  size: "sm",
96
102
  color: "secondary",
97
103
  onClick: this.props.toggleCommentDialog
98
- }, this.props.t('cancel'))), /*#__PURE__*/React.createElement("span", {
104
+ }, t('cancel'))), /*#__PURE__*/React.createElement("span", {
99
105
  className: "comment-dialog-triangle"
100
106
  }));
101
107
  }
@@ -104,4 +110,4 @@ var CommentDialog = /*#__PURE__*/function (_React$Component) {
104
110
  return CommentDialog;
105
111
  }(React.Component);
106
112
 
107
- export default CommentDialog;
113
+ export default withTranslation('seafile-editor')(CommentDialog);
@@ -3,6 +3,7 @@ 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 '../assets/css/issue-card.css';
6
7
 
7
8
  var MarkdownLint = /*#__PURE__*/function (_React$PureComponent) {
8
9
  _inherits(MarkdownLint, _React$PureComponent);
@@ -0,0 +1,104 @@
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 { withTranslation } from 'react-i18next';
7
+ import EditorBuilder from '../../editor/editor-builder';
8
+ import OutlineItem from './outline-item';
9
+ import '../../assets/css/outline.css';
10
+
11
+ var OutlineView = /*#__PURE__*/function (_React$PureComponent) {
12
+ _inherits(OutlineView, _React$PureComponent);
13
+
14
+ var _super = _createSuper(OutlineView);
15
+
16
+ function OutlineView(props) {
17
+ var _this;
18
+
19
+ _classCallCheck(this, OutlineView);
20
+
21
+ _this = _super.call(this, props);
22
+
23
+ _this.scrollToNode = function (node) {
24
+ // wiki module
25
+ if (_this.props.scrollToNode) {
26
+ _this.props.scrollToNode(node);
27
+
28
+ return;
29
+ }
30
+
31
+ var editorRef = EditorBuilder.getEditorRef();
32
+ editorRef.scrollToNode(node);
33
+ };
34
+
35
+ _this.getHeaderList = function (document) {
36
+ var headerList = [];
37
+ document.forEach(function (node, index) {
38
+ if (node.type === 'header_two' || node.type === 'header_three') {
39
+ headerList.push(Object.assign({}, node, {
40
+ path: [index]
41
+ }));
42
+ }
43
+ });
44
+
45
+ _this.setState({
46
+ headerList: headerList
47
+ });
48
+ };
49
+
50
+ _this.state = {
51
+ headerList: null
52
+ };
53
+ return _this;
54
+ }
55
+
56
+ _createClass(OutlineView, [{
57
+ key: "componentDidMount",
58
+ value: function componentDidMount() {
59
+ this.getHeaderList(this.props.document);
60
+ }
61
+ }, {
62
+ key: "componentWillReceiveProps",
63
+ value: function componentWillReceiveProps(nextProps) {
64
+ if (this.props.document !== nextProps.document) {
65
+ this.getHeaderList(nextProps.document);
66
+ }
67
+ }
68
+ }, {
69
+ key: "render",
70
+ value: function render() {
71
+ var _this2 = this;
72
+
73
+ var _this$props = this.props,
74
+ isViewer = _this$props.isViewer,
75
+ t = _this$props.t;
76
+ var headerList = this.state.headerList;
77
+
78
+ if (!headerList || headerList.length === 0) {
79
+ return /*#__PURE__*/React.createElement("div", {
80
+ className: "seafile-editor-outline py-2 pr-4"
81
+ }, isViewer && null, !isViewer && /*#__PURE__*/React.createElement("div", {
82
+ className: "size-panel-no-content"
83
+ }, t('no_out_line')));
84
+ }
85
+
86
+ var activeTitleIndex = this.props.activeTitleIndex;
87
+ return /*#__PURE__*/React.createElement("div", {
88
+ className: "seafile-editor-outline py-2 pr-4"
89
+ }, headerList.map(function (node, index) {
90
+ var isActive = index === activeTitleIndex;
91
+ return /*#__PURE__*/React.createElement(OutlineItem, {
92
+ key: index,
93
+ node: node,
94
+ isActive: isActive,
95
+ scrollToNode: _this2.scrollToNode
96
+ });
97
+ }));
98
+ }
99
+ }]);
100
+
101
+ return OutlineView;
102
+ }(React.PureComponent);
103
+
104
+ export default withTranslation('seafile-editor')(OutlineView);
@@ -0,0 +1,70 @@
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 OutlineItem = /*#__PURE__*/function (_React$PureComponent) {
8
+ _inherits(OutlineItem, _React$PureComponent);
9
+
10
+ var _super = _createSuper(OutlineItem);
11
+
12
+ function OutlineItem() {
13
+ var _this;
14
+
15
+ _classCallCheck(this, OutlineItem);
16
+
17
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
18
+ args[_key] = arguments[_key];
19
+ }
20
+
21
+ _this = _super.call.apply(_super, [this].concat(args));
22
+
23
+ _this.onClick = function (event) {
24
+ var _this$props = _this.props,
25
+ scrollToNode = _this$props.scrollToNode,
26
+ node = _this$props.node;
27
+ scrollToNode && scrollToNode(node);
28
+ };
29
+
30
+ return _this;
31
+ }
32
+
33
+ _createClass(OutlineItem, [{
34
+ key: "componentDidMount",
35
+ value: function componentDidMount() {
36
+ var hash = decodeURI(window.location.hash);
37
+ hash = hash.substring(1, hash.length);
38
+ var _this$props2 = this.props,
39
+ node = _this$props2.node,
40
+ scrollToNode = _this$props2.scrollToNode;
41
+
42
+ if (hash && node && hash === node.text) {
43
+ scrollToNode && scrollToNode(node);
44
+ }
45
+ }
46
+ }, {
47
+ key: "render",
48
+ value: function render() {
49
+ var _this$props3 = this.props,
50
+ node = _this$props3.node,
51
+ isActive = _this$props3.isActive;
52
+ var className = isActive ? 'active' : '';
53
+
54
+ if (node.type === 'header_two') {
55
+ className = 'outline-h2 ' + className;
56
+ } else if (node.type === 'header_three') {
57
+ className = 'outline-h3 ' + className;
58
+ }
59
+
60
+ return /*#__PURE__*/React.createElement("div", {
61
+ className: className,
62
+ onClick: this.onClick
63
+ }, node.children[0].text);
64
+ }
65
+ }]);
66
+
67
+ return OutlineItem;
68
+ }(React.PureComponent);
69
+
70
+ export default OutlineItem;
@@ -5,7 +5,7 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Fragment } from 'react';
6
6
  import { Modal, ModalHeader, ModalBody } from 'reactstrap';
7
7
  import { withTranslation } from 'react-i18next';
8
- import '../css/keyboard-shortcuts.css';
8
+ import '../assets/css/keyboard-shortcuts.css';
9
9
  var isMac = window.navigator.platform.indexOf('Win') < 0 ? true : false;
10
10
  var controlKey = isMac ? '⌘' : 'CTRL';
11
11
 
@@ -0,0 +1,40 @@
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 { withTranslation } from 'react-i18next';
7
+ import ButtonItem from './widgets/button-item';
8
+
9
+ var HelpGroup = /*#__PURE__*/function (_React$Component) {
10
+ _inherits(HelpGroup, _React$Component);
11
+
12
+ var _super = _createSuper(HelpGroup);
13
+
14
+ function HelpGroup() {
15
+ _classCallCheck(this, HelpGroup);
16
+
17
+ return _super.apply(this, arguments);
18
+ }
19
+
20
+ _createClass(HelpGroup, [{
21
+ key: "render",
22
+ value: function render() {
23
+ var t = this.props.t;
24
+ return /*#__PURE__*/React.createElement("div", {
25
+ className: 'btn-group editor-btn-group'
26
+ }, /*#__PURE__*/React.createElement(ButtonItem, {
27
+ isRichEditor: true,
28
+ text: t('Shortcut_help'),
29
+ id: 'helpIcon',
30
+ className: 'use-help-icon',
31
+ icon: 'iconfont icon-use-help',
32
+ onMouseDown: this.props.onHelpToggle
33
+ }));
34
+ }
35
+ }]);
36
+
37
+ return HelpGroup;
38
+ }(React.Component);
39
+
40
+ export default withTranslation('seafile-editor')(HelpGroup);
@@ -0,0 +1,4 @@
1
+ import Toolbar from './toolbar';
2
+ import HelpGroup from './help-group';
3
+ export default Toolbar;
4
+ export { HelpGroup };
@@ -5,16 +5,17 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem, Tooltip, Label, Input } from 'reactstrap';
7
7
  import { withTranslation } from 'react-i18next';
8
+ import EditorBuilder from '../../editor/editor-builder';
8
9
 
9
- var UploadImg = /*#__PURE__*/function (_React$Component) {
10
- _inherits(UploadImg, _React$Component);
10
+ var InsertImage = /*#__PURE__*/function (_React$Component) {
11
+ _inherits(InsertImage, _React$Component);
11
12
 
12
- var _super = _createSuper(UploadImg);
13
+ var _super = _createSuper(InsertImage);
13
14
 
14
- function UploadImg() {
15
+ function InsertImage() {
15
16
  var _this;
16
17
 
17
- _classCallCheck(this, UploadImg);
18
+ _classCallCheck(this, InsertImage);
18
19
 
19
20
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
21
  args[_key] = arguments[_key];
@@ -26,7 +27,7 @@ var UploadImg = /*#__PURE__*/function (_React$Component) {
26
27
  tooltipOpen: false
27
28
  };
28
29
 
29
- _this.imgtoggle = function () {
30
+ _this.imgToggle = function () {
30
31
  _this.setState({
31
32
  dropdownOpen: !_this.state.dropdownOpen
32
33
  });
@@ -47,8 +48,10 @@ var UploadImg = /*#__PURE__*/function (_React$Component) {
47
48
  };
48
49
 
49
50
  _this.uploadLocalImage = function (event) {
50
- if (window.editor.editorApi.uploadLocalImage) {
51
- window.editor.editorApi.uploadLocalImage(event.target.files[0]).then(function (res) {
51
+ var editor = EditorBuilder.getEditor();
52
+
53
+ if (editor.editorApi.uploadLocalImage) {
54
+ editor.editorApi.uploadLocalImage(event.target.files[0]).then(function (res) {
52
55
  _this.props.onInsertImage({
53
56
  url: res
54
57
  });
@@ -73,13 +76,13 @@ var UploadImg = /*#__PURE__*/function (_React$Component) {
73
76
  return _this;
74
77
  }
75
78
 
76
- _createClass(UploadImg, [{
79
+ _createClass(InsertImage, [{
77
80
  key: "render",
78
81
  value: function render() {
79
82
  var t = this.props.t;
80
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dropdown, {
83
+ return /*#__PURE__*/React.createElement(Dropdown, {
81
84
  isOpen: this.state.dropdownOpen,
82
- toggle: this.imgtoggle,
85
+ toggle: this.imgToggle,
83
86
  className: this.props.disabled ? 'upload-localimg upload-localimg-disabled' : 'upload-localimg upload-localimg-hover'
84
87
  }, /*#__PURE__*/React.createElement(DropdownToggle, {
85
88
  id: this.props.id,
@@ -97,7 +100,7 @@ var UploadImg = /*#__PURE__*/function (_React$Component) {
97
100
  isOpen: this.state.tooltipOpen
98
101
  }, t('insert_image'))), /*#__PURE__*/React.createElement(DropdownMenu, null, /*#__PURE__*/React.createElement(DropdownItem, {
99
102
  onClick: this.props.onToggleImageDialog
100
- }, t('insert_network_image')), !this.props.isSimpleEditor && /*#__PURE__*/React.createElement(DropdownItem, {
103
+ }, t('insert_network_image')), !!this.props.insertRepoFile && /*#__PURE__*/React.createElement(DropdownItem, {
101
104
  onMouseDown: this.props.insertRepoFile
102
105
  }, t('Insert_library_image')), /*#__PURE__*/React.createElement(DropdownItem, {
103
106
  className: "image-uploader-btn"
@@ -112,11 +115,11 @@ var UploadImg = /*#__PURE__*/function (_React$Component) {
112
115
  onClick: this.onInputFile,
113
116
  className: "image-uploader",
114
117
  id: "image-uploader"
115
- })))));
118
+ }))));
116
119
  }
117
120
  }]);
118
121
 
119
- return UploadImg;
122
+ return InsertImage;
120
123
  }(React.Component);
121
124
 
122
- export default withTranslation('seafile-editor')(UploadImg);
125
+ export default withTranslation('seafile-editor')(InsertImage);