@seafile/seafile-editor 0.3.99 → 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 (90) 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 +1 -1
  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 +5 -13
  81. package/dist/components/generate-share-link.js +0 -412
  82. package/dist/components/internal-link-dialog.js +0 -96
  83. package/dist/components/outline.js +0 -130
  84. package/dist/components/topbar-component/icon-button.js +0 -99
  85. package/dist/components/topbar-component/insert-file.js +0 -67
  86. package/dist/components/topbar-component/table-toolbar.js +0 -175
  87. package/dist/css/layout.css +0 -111
  88. package/dist/css/markdown-viewer-slate/file-tags-list.css +0 -76
  89. package/dist/css/richeditor/rich-editor-main.css +0 -32
  90. 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
 
@@ -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;
@@ -0,0 +1,82 @@
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 ButtonGroup from './widgets/button-group';
8
+ import ButtonItem from './widgets/button-item';
9
+ import DropList from './widgets/drop-list';
10
+
11
+ var InsertTable = /*#__PURE__*/function (_React$PureComponent) {
12
+ _inherits(InsertTable, _React$PureComponent);
13
+
14
+ var _super = _createSuper(InsertTable);
15
+
16
+ function InsertTable() {
17
+ _classCallCheck(this, InsertTable);
18
+
19
+ return _super.apply(this, arguments);
20
+ }
21
+
22
+ _createClass(InsertTable, [{
23
+ key: "render",
24
+ value: function render() {
25
+ var _this = this;
26
+
27
+ return /*#__PURE__*/React.createElement(ButtonGroup, {
28
+ className: 'editor-btn-group'
29
+ }, /*#__PURE__*/React.createElement(DropList, {
30
+ icon: 'iconfont icon-left-alignment',
31
+ items: [{
32
+ handle: function handle(e) {
33
+ _this.props.onSetAlign(e, 'left');
34
+ },
35
+ icon: 'iconfont icon-left-alignment',
36
+ text: this.props.t('left')
37
+ }, {
38
+ handle: function handle(e) {
39
+ _this.props.onSetAlign(e, 'center');
40
+ },
41
+ icon: 'iconfont icon-center-horizontally',
42
+ text: this.props.t('center')
43
+ }, {
44
+ handle: function handle(e) {
45
+ _this.props.onSetAlign(e, 'right');
46
+ },
47
+ icon: 'icon icon-align-right',
48
+ text: this.props.t('right')
49
+ }]
50
+ }), /*#__PURE__*/React.createElement(DropList, {
51
+ icon: 'iconfont icon-column',
52
+ items: [{
53
+ handle: this.props.onInsertColumn,
54
+ text: this.props.t('Insert_Column')
55
+ }, {
56
+ handle: this.props.onRemoveColumn,
57
+ text: this.props.t('Remove_Column')
58
+ }]
59
+ }), /*#__PURE__*/React.createElement(DropList, {
60
+ icon: 'iconfont icon-row',
61
+ items: [{
62
+ handle: this.props.onInsertRow,
63
+ text: this.props.t('Insert_Row')
64
+ }, {
65
+ handle: this.props.onRemoveRow,
66
+ text: this.props.t('Remove_Row')
67
+ }]
68
+ }), /*#__PURE__*/React.createElement(ButtonItem, {
69
+ disabled: false,
70
+ isRichEditor: true,
71
+ text: this.props.t('remove_table'),
72
+ id: 'removeTable',
73
+ icon: 'iconfont icon-delete-table',
74
+ onMouseDown: this.props.onRemoveTable
75
+ }));
76
+ }
77
+ }]);
78
+
79
+ return InsertTable;
80
+ }(React.PureComponent);
81
+
82
+ export default withTranslation('seafile-editor')(InsertTable);