@seafile/seafile-editor 0.3.97 → 0.3.100

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 (92) hide show
  1. package/dist/_i18n/index.js +20 -0
  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/{index.css → assets/css/index.css} +0 -0
  8. package/dist/assets/css/issue-card.css +43 -0
  9. package/dist/{css → assets/css}/keyboard-shortcuts.css +0 -0
  10. package/dist/{css/richeditor → assets/css}/link.css +0 -0
  11. package/dist/{css/plaineditor → assets/css}/markdown-editor.css +0 -0
  12. package/dist/{css → assets/css}/markdown-viewer.css +0 -0
  13. package/dist/{css/richeditor → assets/css}/navbar-imgbutton.css +0 -0
  14. package/dist/assets/css/outline.css +29 -0
  15. package/dist/{css/richeditor → assets/css}/table.css +0 -0
  16. package/dist/{css/richeditor → assets/css}/textlink-hovermenu.css +0 -0
  17. package/dist/{css → assets/css}/topbar.css +19 -33
  18. package/dist/{css/richeditor → assets/css}/tree-view.css +0 -0
  19. package/dist/{css/richeditor/right-panel.css → assets/css/user-help.css} +9 -9
  20. package/dist/assets/editor/plain-editor.css +30 -0
  21. package/dist/assets/editor/rich-editor.css +104 -0
  22. package/dist/assets/editor/simple-editor.css +77 -0
  23. package/dist/{css/richeditor → assets/rich-editor}/document-info.css +0 -0
  24. package/dist/components/add-formula-dialog.js +6 -4
  25. package/dist/components/add-image-dialog.js +3 -1
  26. package/dist/components/add-link-dialog.js +4 -3
  27. package/dist/components/comment-dialog.js +12 -6
  28. package/dist/components/markdown-lint.js +1 -0
  29. package/dist/components/outline/index.js +97 -0
  30. package/dist/components/outline/outline-item.js +70 -0
  31. package/dist/components/shortcut-dialog.js +26 -51
  32. package/dist/components/{topbar-component → toolbar}/header-list.js +0 -0
  33. package/dist/components/toolbar/help-group.js +40 -0
  34. package/dist/components/toolbar/index.js +4 -0
  35. package/dist/components/{topbar-component/upload-img.js → toolbar/insert-image.js} +18 -15
  36. package/dist/components/toolbar/insert-table.js +155 -0
  37. package/dist/components/toolbar/table-group.js +82 -0
  38. package/dist/components/{toolbar.js → toolbar/toolbar.js} +102 -64
  39. package/dist/components/{topbar-component → toolbar/widgets}/button-group.js +0 -0
  40. package/dist/components/toolbar/widgets/button-item.js +144 -0
  41. package/dist/components/toolbar/widgets/drop-list.js +101 -0
  42. package/dist/components/user-help.js +16 -10
  43. package/dist/editor/controller/block-element-controller.js +6 -2
  44. package/dist/editor/controller/inline-element-controller.js +6 -2
  45. package/dist/editor/editor-builder.js +107 -0
  46. package/dist/editor/editor-component/formula.js +4 -2
  47. package/dist/editor/editor-component/image.js +10 -6
  48. package/dist/editor/editor-component/table.js +1 -1
  49. package/dist/editor/editor-plugin.js +3 -1
  50. package/dist/editor/editor.js +1 -32
  51. package/dist/editor/index.js +97 -0
  52. package/dist/editor/markdown-editor.js +323 -0
  53. package/dist/editor/plain-markdown-editor.js +5 -4
  54. package/dist/editor/rich-markdown-editor.js +70 -149
  55. package/dist/editor/simple-editor.js +44 -78
  56. package/dist/{css/richeditor → example/assets/css}/comments-list.css +0 -45
  57. package/dist/{css/richeditor → example/assets/css}/detail-list-view.css +0 -0
  58. package/dist/{css/richeditor → example/assets/css}/participants-list.css +0 -0
  59. package/dist/{css → example/assets/css}/react-mentions-default-style.js +0 -0
  60. package/dist/example/assets/css/seafile-editor-main.css +125 -0
  61. package/dist/example/assets/css/seafile-editor-side.css +89 -0
  62. package/dist/example/assets/css/side-panel.css +81 -0
  63. package/dist/{components → example/components}/comment-panel.js +12 -6
  64. package/dist/{components → example/components}/detail-list-view.js +1 -1
  65. package/dist/{components → example/components}/participants-list.js +1 -1
  66. package/dist/{components → example/components}/side-panel.js +5 -7
  67. package/dist/example/seafile-editor.js +137 -0
  68. package/dist/index.js +9 -0
  69. package/dist/index.local.js +58 -0
  70. package/dist/pages/seafile-editor/index.js +38 -0
  71. package/dist/{editor → pages/seafile-editor}/seafile-editor.js +19 -35
  72. package/dist/{seafile-editor-chooser.js → pages/seafile-editor-chooser.js} +0 -0
  73. package/dist/{seafile-markdown-editor.js → pages/seafile-markdown-editor.js} +5 -5
  74. package/dist/{seafile-markdown-viewer.js → pages/seafile-markdown-viewer.js} +3 -3
  75. package/dist/{seafile-simple-editor.js → pages/seafile-simple-editor.js} +5 -2
  76. package/dist/viewer/diff-viewer.js +1 -1
  77. package/dist/viewer/markdown-viewer.js +14 -15
  78. package/dist/viewer/slate-viewer.js +9 -24
  79. package/dist/viewer/viewer-formula.js +1 -1
  80. package/package.json +6 -14
  81. package/public/locales/zh-CN/seafile-editor.json +15 -13
  82. package/dist/components/generate-share-link.js +0 -412
  83. package/dist/components/internal-link-dialog.js +0 -96
  84. package/dist/components/outline.js +0 -130
  85. package/dist/components/topbar-component/icon-button.js +0 -99
  86. package/dist/components/topbar-component/insert-file.js +0 -67
  87. package/dist/components/topbar-component/table-toolbar.js +0 -175
  88. package/dist/config-0.js +0 -15
  89. package/dist/css/layout.css +0 -111
  90. package/dist/css/markdown-viewer-slate/file-tags-list.css +0 -76
  91. package/dist/css/richeditor/rich-editor-main.css +0 -32
  92. package/dist/css/richeditor/side-panel.css +0 -183
@@ -0,0 +1,97 @@
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
+ var editorRef = EditorBuilder.getEditorRef();
25
+ editorRef.scrollToNode(node);
26
+ };
27
+
28
+ _this.getHeaderList = function (document) {
29
+ var headerList = [];
30
+ document.forEach(function (node, index) {
31
+ if (node.type === 'header_two' || node.type === 'header_three') {
32
+ headerList.push(Object.assign({}, node, {
33
+ path: [index]
34
+ }));
35
+ }
36
+ });
37
+
38
+ _this.setState({
39
+ headerList: headerList
40
+ });
41
+ };
42
+
43
+ _this.state = {
44
+ headerList: null
45
+ };
46
+ return _this;
47
+ }
48
+
49
+ _createClass(OutlineView, [{
50
+ key: "componentDidMount",
51
+ value: function componentDidMount() {
52
+ this.getHeaderList(this.props.document);
53
+ }
54
+ }, {
55
+ key: "componentWillReceiveProps",
56
+ value: function componentWillReceiveProps(nextProps) {
57
+ if (this.props.document !== nextProps.document) {
58
+ this.getHeaderList(nextProps.document);
59
+ }
60
+ }
61
+ }, {
62
+ key: "render",
63
+ value: function render() {
64
+ var _this2 = this;
65
+
66
+ var _this$props = this.props,
67
+ isViewer = _this$props.isViewer,
68
+ t = _this$props.t;
69
+ var headerList = this.state.headerList;
70
+
71
+ if (!headerList || headerList.length === 0) {
72
+ return /*#__PURE__*/React.createElement("div", {
73
+ className: "seafile-editor-outline py-2 pr-4"
74
+ }, isViewer && null, !isViewer && /*#__PURE__*/React.createElement("div", {
75
+ className: "size-panel-no-content"
76
+ }, t('no_out_line')));
77
+ }
78
+
79
+ var activeTitleIndex = this.props.activeTitleIndex;
80
+ return /*#__PURE__*/React.createElement("div", {
81
+ className: "seafile-editor-outline py-2 pr-4"
82
+ }, headerList.map(function (node, index) {
83
+ var isActive = index === activeTitleIndex;
84
+ return /*#__PURE__*/React.createElement(OutlineItem, {
85
+ key: index,
86
+ node: node,
87
+ isActive: isActive,
88
+ scrollToNode: _this2.scrollToNode
89
+ });
90
+ }));
91
+ }
92
+ }]);
93
+
94
+ return OutlineView;
95
+ }(React.PureComponent);
96
+
97
+ 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
 
@@ -14,12 +14,16 @@ var KeyboardShortcuts = /*#__PURE__*/function (_React$PureComponent) {
14
14
 
15
15
  var _super = _createSuper(KeyboardShortcuts);
16
16
 
17
- function KeyboardShortcuts(props) {
17
+ function KeyboardShortcuts() {
18
18
  var _this;
19
19
 
20
20
  _classCallCheck(this, KeyboardShortcuts);
21
21
 
22
- _this = _super.call(this, props);
22
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
23
+ args[_key] = arguments[_key];
24
+ }
25
+
26
+ _this = _super.call.apply(_super, [this].concat(args));
23
27
 
24
28
  _this.renderShortcut = function (keys) {
25
29
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("span", {
@@ -41,39 +45,6 @@ var KeyboardShortcuts = /*#__PURE__*/function (_React$PureComponent) {
41
45
  }, description));
42
46
  };
43
47
 
44
- _this.shortcutData = [{
45
- 'Make_list': [['*', 'space'], ['-', 'space']],
46
- 'Make_ordered_list': [['1.', 'space']],
47
- 'Insert_new_item': [['Enter']],
48
- 'Insert_child_in_item': [['Shift', 'Enter']],
49
- 'Increase_depth': [['Tab']]
50
- }, {
51
- 'Heading_1': [['#', 'space']],
52
- 'Heading_2': [['##', 'space']],
53
- 'Heading_3': [['###', 'space']],
54
- 'Heading_4': [['####', 'space']],
55
- 'Heading_5': [['#####', 'space']],
56
- 'Heading_6': [['######', 'space']]
57
- }, {
58
- 'Make_code_block': [['```'], ['space*4']],
59
- 'Insert_new_line': [['Enter']],
60
- 'Escape_code_block': [[controlKey, 'Enter']],
61
- 'Insert_indent': [['Tab']]
62
- }, {
63
- 'Make_Block_quote': [['>', 'space']],
64
- 'Escape_Block_quote': [['Enter']]
65
- }, {
66
- 'Insert_Table_Row': [['Enter']],
67
- 'Escape_table': [[controlKey, 'Enter']]
68
- }, {
69
- 'Bold': [['**bold**', 'space'], ['__bold__', 'space']],
70
- 'Italic': [['*italic*', 'space'], ['_italic_', 'space']],
71
- 'Italic_Bold': [['***italic***', 'space'], ['___italic___', 'space']],
72
- 'Inline_code': [['`code`', 'space']]
73
- }, {
74
- 'Paste_screen_shot': [[controlKey, 'v']],
75
- 'Drag_image_from_anywhere_to_upload_it': []
76
- }];
77
48
  return _this;
78
49
  }
79
50
 
@@ -97,7 +68,7 @@ var KeyboardShortcuts = /*#__PURE__*/function (_React$PureComponent) {
97
68
  className: "pb-2"
98
69
  }, /*#__PURE__*/React.createElement("div", {
99
70
  className: "keyboard-shortcut-title pb-1"
100
- }, t(userHelpData[1]['shortcutType'])), this.renderContainer(this.shortcutData[1]['Heading_1'][0], t(userHelpData[1].shortcutData['Heading_1'])), this.renderContainer(this.shortcutData[1]['Heading_2'][0], t(userHelpData[1].shortcutData['Heading_2'])), this.renderContainer(this.shortcutData[1]['Heading_3'][0], t(userHelpData[1].shortcutData['Heading_3'])), this.renderContainer(this.shortcutData[1]['Heading_4'][0], t(userHelpData[1].shortcutData['Heading_4'])), this.renderContainer(this.shortcutData[1]['Heading_5'][0], t(userHelpData[1].shortcutData['Heading_5'])), this.renderContainer(this.shortcutData[1]['Heading_6'][0], t(userHelpData[1].shortcutData['Heading_6']))), /*#__PURE__*/React.createElement("div", {
71
+ }, t(userHelpData[1]['shortcutType'])), this.renderContainer(['#', 'space'], t(userHelpData[1].shortcutData['Heading_1'])), this.renderContainer(['##', 'space'], t(userHelpData[1].shortcutData['Heading_2'])), this.renderContainer(['###', 'space'], t(userHelpData[1].shortcutData['Heading_3'])), this.renderContainer(['####', 'space'], t(userHelpData[1].shortcutData['Heading_4'])), this.renderContainer(['#####', 'space'], t(userHelpData[1].shortcutData['Heading_5'])), this.renderContainer(['######', 'space'], t(userHelpData[1].shortcutData['Heading_6']))), /*#__PURE__*/React.createElement("div", {
101
72
  className: "pb-2"
102
73
  }, /*#__PURE__*/React.createElement("div", {
103
74
  className: "keyboard-shortcut-title pb-1"
@@ -105,15 +76,15 @@ var KeyboardShortcuts = /*#__PURE__*/function (_React$PureComponent) {
105
76
  className: "keyboard-shortcut-container"
106
77
  }, /*#__PURE__*/React.createElement("div", {
107
78
  className: "col-4"
108
- }, this.renderShortcut(this.shortcutData[0]['Make_list'][0]), this.renderShortcut(this.shortcutData[0]['Make_list'][1])), /*#__PURE__*/React.createElement("div", {
79
+ }, this.renderShortcut(['*', 'space']), this.renderShortcut(['-', 'space'])), /*#__PURE__*/React.createElement("div", {
109
80
  className: "col-8"
110
81
  }, t(userHelpData[0].shortcutData['Make_list']))), /*#__PURE__*/React.createElement("div", {
111
82
  className: "keyboard-shortcut-container"
112
83
  }, /*#__PURE__*/React.createElement("div", {
113
84
  className: "col-4"
114
- }, this.renderShortcut(this.shortcutData[0]['Make_ordered_list'][0])), /*#__PURE__*/React.createElement("div", {
85
+ }, this.renderShortcut(['1.', 'space'])), /*#__PURE__*/React.createElement("div", {
115
86
  className: "col-8"
116
- }, t(userHelpData[0].shortcutData['Make_ordered_list']))), this.renderContainer(this.shortcutData[0]['Increase_depth'][0], t(userHelpData[0].shortcutData['Increase_depth'])), this.renderContainer(this.shortcutData[0]['Insert_child_in_item'][0], t(userHelpData[0].shortcutData['Insert_child_in_item'])), this.renderContainer(this.shortcutData[0]['Insert_new_item'][0], t(userHelpData[0].shortcutData['Insert_new_item']))), /*#__PURE__*/React.createElement("div", {
87
+ }, t(userHelpData[0].shortcutData['Make_ordered_list']))), this.renderContainer(['Tab'], t(userHelpData[0].shortcutData['Increase_depth'])), this.renderContainer(['Shift', 'Enter'], t(userHelpData[0].shortcutData['Insert_child_in_item'])), this.renderContainer(['Enter'], t(userHelpData[0].shortcutData['Insert_new_item']))), /*#__PURE__*/React.createElement("div", {
117
88
  className: "pb-2"
118
89
  }, /*#__PURE__*/React.createElement("div", {
119
90
  className: "keyboard-shortcut-title pb-1"
@@ -121,21 +92,21 @@ var KeyboardShortcuts = /*#__PURE__*/function (_React$PureComponent) {
121
92
  className: "keyboard-shortcut-container"
122
93
  }, /*#__PURE__*/React.createElement("div", {
123
94
  className: "col-4"
124
- }, this.renderShortcut(this.shortcutData[5]['Bold'][0]), this.renderShortcut(this.shortcutData[5]['Bold'][1])), /*#__PURE__*/React.createElement("div", {
95
+ }, this.renderShortcut(['**bold**', 'space']), this.renderShortcut(['__bold__', 'space'])), /*#__PURE__*/React.createElement("div", {
125
96
  className: "col-8"
126
- }, t(userHelpData[5].shortcutData['Bold']))), /*#__PURE__*/React.createElement("div", {
97
+ }, t(userHelpData[6].shortcutData['Bold']))), /*#__PURE__*/React.createElement("div", {
127
98
  className: "keyboard-shortcut-container"
128
99
  }, /*#__PURE__*/React.createElement("div", {
129
100
  className: "col-4"
130
- }, this.renderShortcut(this.shortcutData[5]['Italic'][0]), this.renderShortcut(this.shortcutData[5]['Italic'][1])), /*#__PURE__*/React.createElement("div", {
101
+ }, this.renderShortcut(['*italic*', 'space']), this.renderShortcut(['_italic_', 'space'])), /*#__PURE__*/React.createElement("div", {
131
102
  className: "col-8"
132
- }, t(userHelpData[5].shortcutData['Italic']))), /*#__PURE__*/React.createElement("div", {
103
+ }, t(userHelpData[6].shortcutData['Italic']))), /*#__PURE__*/React.createElement("div", {
133
104
  className: "keyboard-shortcut-container"
134
105
  }, /*#__PURE__*/React.createElement("div", {
135
106
  className: "col-4"
136
- }, this.renderShortcut(this.shortcutData[5]['Italic_Bold'][0]), this.renderShortcut(this.shortcutData[5]['Italic_Bold'][1])), /*#__PURE__*/React.createElement("div", {
107
+ }, this.renderShortcut(['***italic***', 'space']), this.renderShortcut(['___italic___', 'space'])), /*#__PURE__*/React.createElement("div", {
137
108
  className: "col-8"
138
- }, t(userHelpData[5].shortcutData['Italic_Bold']))), this.renderContainer(this.shortcutData[5]['Inline_code'][0], t(userHelpData[5].shortcutData['Inline_code']))), /*#__PURE__*/React.createElement("div", {
109
+ }, t(userHelpData[6].shortcutData['Italic_Bold']))), this.renderContainer(['`code`', 'space'], t(userHelpData[6].shortcutData['Inline_code']))), /*#__PURE__*/React.createElement("div", {
139
110
  className: "pb-2"
140
111
  }, /*#__PURE__*/React.createElement("div", {
141
112
  className: "keyboard-shortcut-title pb-1"
@@ -143,21 +114,25 @@ var KeyboardShortcuts = /*#__PURE__*/function (_React$PureComponent) {
143
114
  className: "keyboard-shortcut-container"
144
115
  }, /*#__PURE__*/React.createElement("div", {
145
116
  className: "col-4"
146
- }, this.renderShortcut(this.shortcutData[2]['Make_code_block'][0]), this.renderShortcut(this.shortcutData[2]['Make_code_block'][1])), /*#__PURE__*/React.createElement("div", {
117
+ }, this.renderShortcut(['```']), this.renderShortcut(['space*4'])), /*#__PURE__*/React.createElement("div", {
147
118
  className: "col-8"
148
- }, t(userHelpData[2].shortcutData['Make_code_block']))), this.renderContainer(this.shortcutData[2]['Insert_indent'][0], t(userHelpData[2].shortcutData['Insert_indent'])), this.renderContainer(this.shortcutData[2]['Insert_new_line'][0], t(userHelpData[2].shortcutData['Insert_new_line'])), this.renderContainer(this.shortcutData[2]['Escape_code_block'][0], t(userHelpData[2].shortcutData['Escape_code_block']))), /*#__PURE__*/React.createElement("div", {
119
+ }, t(userHelpData[2].shortcutData['Make_code_block']))), this.renderContainer(['Tab'], t(userHelpData[2].shortcutData['Insert_indent'])), this.renderContainer(['Enter'], t(userHelpData[2].shortcutData['Insert_new_line'])), this.renderContainer([controlKey, 'Enter'], t(userHelpData[2].shortcutData['Escape_code_block']))), /*#__PURE__*/React.createElement("div", {
120
+ className: "pb-2"
121
+ }, /*#__PURE__*/React.createElement("div", {
122
+ className: "keyboard-shortcut-title pb-1"
123
+ }, t(userHelpData[3]['shortcutType'])), this.renderContainer(['>', 'space'], t(userHelpData[3].shortcutData['Make_Block_quote'])), this.renderContainer(['Enter'], t(userHelpData[3].shortcutData['Escape_Block_quote']))), /*#__PURE__*/React.createElement("div", {
149
124
  className: "pb-2"
150
125
  }, /*#__PURE__*/React.createElement("div", {
151
126
  className: "keyboard-shortcut-title pb-1"
152
- }, t(userHelpData[3]['shortcutType'])), this.renderContainer(this.shortcutData[3]['Make_Block_quote'][0], t(userHelpData[3].shortcutData['Make_Block_quote'])), this.renderContainer(this.shortcutData[3]['Escape_Block_quote'][0], t(userHelpData[3].shortcutData['Escape_Block_quote']))), /*#__PURE__*/React.createElement("div", {
127
+ }, t(userHelpData[4]['shortcutType'])), this.renderContainer(['Enter'], t(userHelpData[4].shortcutData['Insert_Table_Row'])), this.renderContainer([controlKey, 'Enter'], t(userHelpData[4].shortcutData['Escape_table']))), /*#__PURE__*/React.createElement("div", {
153
128
  className: "pb-2"
154
129
  }, /*#__PURE__*/React.createElement("div", {
155
130
  className: "keyboard-shortcut-title pb-1"
156
- }, t(userHelpData[4]['shortcutType'])), this.renderContainer(this.shortcutData[4]['Insert_Table_Row'][0], t(userHelpData[4].shortcutData['Insert_Table_Row'])), this.renderContainer(this.shortcutData[4]['Escape_table'][0], t(userHelpData[4].shortcutData['Escape_table']))), /*#__PURE__*/React.createElement("div", {
131
+ }, t(userHelpData[7]['shortcutType'])), this.renderContainer([controlKey, 's'], t(userHelpData[7].shortcutData['Save_file']))), /*#__PURE__*/React.createElement("div", {
157
132
  className: "pb-2"
158
133
  }, /*#__PURE__*/React.createElement("div", {
159
134
  className: "keyboard-shortcut-title pb-1"
160
- }, t(userHelpData[7]['shortcutType'])), this.renderContainer(this.shortcutData[6]['Paste_screen_shot'][0], t(userHelpData[7].shortcutData['Paste_screen_shot']))))));
135
+ }, t(userHelpData[8]['shortcutType'])), this.renderContainer([controlKey, 'v'], t(userHelpData[8].shortcutData['Paste_screen_shot']))))));
161
136
  }
162
137
  }]);
163
138
 
@@ -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);
@@ -0,0 +1,155 @@
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, { Component } from 'react';
6
+ import ClickOutside from '../click-outside';
7
+ import ButtonItem from './widgets/button-item';
8
+
9
+ var InsertTable = /*#__PURE__*/function (_Component) {
10
+ _inherits(InsertTable, _Component);
11
+
12
+ var _super = _createSuper(InsertTable);
13
+
14
+ function InsertTable(props) {
15
+ var _this;
16
+
17
+ _classCallCheck(this, InsertTable);
18
+
19
+ _this = _super.call(this, props);
20
+
21
+ _this.toggleCard = function () {
22
+ _this.setState({
23
+ showCard: !_this.state.showCard,
24
+ columnCount: -1,
25
+ rowCount: -1
26
+ });
27
+ };
28
+
29
+ _this.createTableCells = function () {
30
+ var rows = [];
31
+ var _this$state = _this.state,
32
+ columnCount = _this$state.columnCount,
33
+ rowCount = _this$state.rowCount,
34
+ currentMaxColumnCount = _this$state.currentMaxColumnCount,
35
+ currentMaxRowCount = _this$state.currentMaxRowCount;
36
+
37
+ var _loop = function _loop(rowIndex) {
38
+ var cells = [];
39
+
40
+ var _loop2 = function _loop2(columnIndex) {
41
+ var isActive = columnIndex <= columnCount - 1 && rowIndex <= rowCount - 1;
42
+ var vDom = /*#__PURE__*/React.createElement("div", {
43
+ onMouseEnter: function onMouseEnter() {
44
+ return _this.onTableCellMouseEnter(rowIndex, columnIndex);
45
+ },
46
+ key: "table-row-".concat(rowIndex, "-").concat(columnIndex),
47
+ className: "sf-editor-table-card-cell ".concat(isActive ? 'sf-editor-table-card-active-cell' : '')
48
+ });
49
+ cells.push(vDom);
50
+ };
51
+
52
+ for (var columnIndex = 0; columnIndex < currentMaxColumnCount; columnIndex++) {
53
+ _loop2(columnIndex);
54
+ }
55
+
56
+ var row = /*#__PURE__*/React.createElement("div", {
57
+ key: "table-row-".concat(rowIndex),
58
+ className: "sf-editor-table-card-row"
59
+ }, cells);
60
+ rows.push(row);
61
+ };
62
+
63
+ for (var rowIndex = 0; rowIndex < currentMaxRowCount; rowIndex++) {
64
+ _loop(rowIndex);
65
+ }
66
+
67
+ return /*#__PURE__*/React.createElement("div", {
68
+ onClick: function onClick(event) {
69
+ return _this.onAddTable(event, rowCount, columnCount);
70
+ },
71
+ className: "sf-editor-table-card"
72
+ }, rows);
73
+ };
74
+
75
+ _this.onAddTable = function (event, rowCount, columnCount) {
76
+ _this.props.onAddTable(event, rowCount, columnCount);
77
+
78
+ _this.toggleCard();
79
+ };
80
+
81
+ _this.onTableCellMouseEnter = function (rowIndex, columnIndex) {
82
+ var columnCount = columnIndex + 1,
83
+ rowCount = rowIndex + 1;
84
+ var currentMaxRowCount = rowCount + 1,
85
+ currentMaxColumnCount = columnCount + 1;
86
+
87
+ if (currentMaxColumnCount > 10) {
88
+ currentMaxColumnCount = 10;
89
+ } else if (currentMaxColumnCount < 4) {
90
+ currentMaxColumnCount = 4;
91
+ }
92
+
93
+ if (currentMaxRowCount > 10) {
94
+ currentMaxRowCount = 10;
95
+ } else if (currentMaxRowCount < 4) {
96
+ currentMaxRowCount = 4;
97
+ }
98
+
99
+ _this.setState({
100
+ columnCount: columnCount,
101
+ rowCount: rowCount,
102
+ currentMaxColumnCount: currentMaxColumnCount,
103
+ currentMaxRowCount: currentMaxRowCount
104
+ });
105
+ };
106
+
107
+ _this.state = {
108
+ showCard: false,
109
+ currentMaxColumnCount: 4,
110
+ currentMaxRowCount: 4,
111
+ columnCount: -1,
112
+ rowCount: -1
113
+ };
114
+ return _this;
115
+ }
116
+
117
+ _createClass(InsertTable, [{
118
+ key: "createTableScaleCard",
119
+ value: function createTableScaleCard(props) {
120
+ var _this$state2 = this.state,
121
+ columnCount = _this$state2.columnCount,
122
+ rowCount = _this$state2.rowCount;
123
+ return /*#__PURE__*/React.createElement("div", {
124
+ className: "sf-editor-table-count-card"
125
+ }, /*#__PURE__*/React.createElement("div", {
126
+ className: "sf-editor-table-cells-header"
127
+ }, "".concat(columnCount < 0 ? 0 : columnCount, " x ").concat(rowCount < 0 ? 0 : rowCount)), this.createTableCells());
128
+ }
129
+ }, {
130
+ key: "render",
131
+ value: function render() {
132
+ var _this$props = this.props,
133
+ disabled = _this$props.disabled,
134
+ isRichEditor = _this$props.isRichEditor,
135
+ text = _this$props.text;
136
+ var showCard = this.state.showCard;
137
+ return /*#__PURE__*/React.createElement("div", {
138
+ className: "sf-editor-table-btn-wrapper"
139
+ }, /*#__PURE__*/React.createElement(ButtonItem, {
140
+ disabled: disabled,
141
+ isRichEditor: isRichEditor,
142
+ text: text,
143
+ id: 'tableButton',
144
+ icon: 'iconfont icon-table',
145
+ onMouseDown: this.toggleCard
146
+ }), showCard && /*#__PURE__*/React.createElement(ClickOutside, {
147
+ clickOutside: this.toggleCard
148
+ }, this.createTableScaleCard()));
149
+ }
150
+ }]);
151
+
152
+ return InsertTable;
153
+ }(Component);
154
+
155
+ export default InsertTable;