@seafile/sdoc-editor 0.3.1 → 0.3.3

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 (37) hide show
  1. package/dist/assets/css/collaborator-popover.css +0 -2
  2. package/dist/basic-sdk/comment/comment-decorate.js +1 -0
  3. package/dist/basic-sdk/comment/components/comment-item-wrapper.js +2 -0
  4. package/dist/basic-sdk/comment/utils/notification-utils.js +1 -1
  5. package/dist/basic-sdk/extension/plugins/header/menu/index.js +1 -1
  6. package/dist/basic-sdk/extension/plugins/table/constants/index.js +6 -0
  7. package/dist/basic-sdk/extension/plugins/table/helpers.js +37 -5
  8. package/dist/basic-sdk/extension/plugins/table/menu/table-menu/index.js +2 -8
  9. package/dist/basic-sdk/extension/plugins/table/popover/table-size-popover/index.css +11 -4
  10. package/dist/basic-sdk/extension/plugins/table/popover/table-size-popover/index.js +20 -12
  11. package/dist/basic-sdk/extension/plugins/table/popover/table-template/index.css +35 -0
  12. package/dist/basic-sdk/extension/plugins/table/popover/table-template/index.js +33 -0
  13. package/dist/basic-sdk/extension/plugins/table/popover/table-template/sample-table.js +33 -0
  14. package/dist/basic-sdk/extension/plugins/table/render/alternate-color.css +37 -0
  15. package/dist/basic-sdk/extension/plugins/table/render/index.js +5 -3
  16. package/dist/basic-sdk/extension/toolbar/side-toolbar/insert-block-menu.js +2 -11
  17. package/dist/components/doc-info/index.css +45 -0
  18. package/dist/components/doc-info/index.js +12 -2
  19. package/dist/components/doc-operations/style.css +0 -26
  20. package/dist/components/toast/alert.js +8 -0
  21. package/dist/utils/date-utils.js +1 -1
  22. package/dist/utils/local-storage-utils.js +1 -1
  23. package/package.json +1 -1
  24. package/public/locales/cs/sdoc-editor.json +3 -1
  25. package/public/locales/de/sdoc-editor.json +3 -1
  26. package/public/locales/en/sdoc-editor.json +3 -1
  27. package/public/locales/es/sdoc-editor.json +3 -1
  28. package/public/locales/fr/sdoc-editor.json +3 -1
  29. package/public/locales/it/sdoc-editor.json +3 -1
  30. package/public/locales/ru/sdoc-editor.json +3 -1
  31. package/public/locales/zh_CN/sdoc-editor.json +3 -1
  32. package/public/media/sdoc-editor-font/iconfont.eot +0 -0
  33. package/public/media/sdoc-editor-font/iconfont.svg +6 -0
  34. package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
  35. package/public/media/sdoc-editor-font/iconfont.woff +0 -0
  36. package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
  37. package/public/media/sdoc-editor-font.css +18 -6
@@ -72,5 +72,3 @@
72
72
  text-overflow: ellipsis;
73
73
  color: #212529;
74
74
  }
75
-
76
-
@@ -22,6 +22,7 @@ export var commentDecorate = function commentDecorate(editor) {
22
22
  offset: Node.string(node).length
23
23
  }
24
24
  };
25
+
25
26
  // rgba prevents occlusion of the cursor
26
27
  decoration['computed_background_color'] = 'rgba(129, 237, 247, 0.5)';
27
28
  decoration['comment_count'] = unresolvedComments === null || unresolvedComments === void 0 ? void 0 : unresolvedComments.length;
@@ -219,6 +219,7 @@ export default function CommentItemWrapper(_ref) {
219
219
  var insertContent = useCallback(function (content) {
220
220
  var user = context.getUserInfo();
221
221
  var replies = [];
222
+
222
223
  // The comment has already been resolved, when adding a new reply, resubmit the comment
223
224
  if (comment.resolved) {
224
225
  var _time = dayjs().format('YYYY-MM-DD HH:mm:ss');
@@ -343,6 +344,7 @@ export default function CommentItemWrapper(_ref) {
343
344
  onDeleteComment: onDeleteComment
344
345
  }), comment.replies && comment.replies.length > 0 && comment.replies.map(function (reply) {
345
346
  var type = reply.type;
347
+
346
348
  // type is reply | comment
347
349
  if (type === 'reply') {
348
350
  var props = {
@@ -6,7 +6,7 @@ var PERMISSION_GRANTED = 'granted';
6
6
  var notify = function notify($title, $options) {
7
7
  var notification = new Notification($title, $options);
8
8
 
9
- //auto clear notifications
9
+ // auto clear notifications
10
10
  var timer = setTimeout(notification.close.bind(notification), 5000);
11
11
  notification.onshow = function (event) {
12
12
  var _context$getSetting = context.getSetting('mediaUrl'),
@@ -83,7 +83,7 @@ var HeaderMenu = /*#__PURE__*/function (_React$Component) {
83
83
  _this.menu = ref;
84
84
  };
85
85
  _this.getToolTip = function (type) {
86
- //chrome in Mac: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
86
+ // chrome in Mac: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
87
87
  var isMac = window.navigator.userAgent.indexOf('Macintosh') !== -1;
88
88
  return isMac ? MAC_HOTKEYS[type] : WIN_HOTKEYS[type];
89
89
  };
@@ -28,4 +28,10 @@ export var TABLE_CELL_STYLE = {
28
28
  };
29
29
  export var TABLE_ROW_STYLE = {
30
30
  MIN_HEIGHT: 'min_height'
31
+ };
32
+ export var TABLE_ALTERNATE_HIGHLIGHT_CLASS_MAP = {
33
+ '#3f495d': 'sdoc-table-3f495d',
34
+ '#2367f2': 'sdoc-table-2367f2',
35
+ '#f77d21': 'sdoc-table-f77d21',
36
+ '#0099f4': 'sdoc-table-0099f4'
31
37
  };
@@ -67,8 +67,20 @@ export var generateTableRow = function generateTableRow(colsCount) {
67
67
  style: _defineProperty({}, TABLE_ROW_STYLE.MIN_HEIGHT, TABLE_ROW_MIN_HEIGHT)
68
68
  };
69
69
  };
70
- export var generateEmptyTable = function generateEmptyTable(editor) {
71
- var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0];
70
+
71
+ /**
72
+ * @param {Editor} editor
73
+ * @param {Object} tableProps
74
+ * @param {[number,number]} tableProps.size - table size, [row,column]
75
+ * @param {Boolean} tableProps.alternate_highlight - is alternate highlight
76
+ * @param {string} tableProps.alternate_highlight_color - table alternate highlight color
77
+ */
78
+ export var generateEmptyTable = function generateEmptyTable(editor, tableProps) {
79
+ var _tableProps$size = tableProps.size,
80
+ size = _tableProps$size === void 0 ? [0, 0] : _tableProps$size,
81
+ _tableProps$alternate = tableProps.alternate_highlight,
82
+ alternate_highlight = _tableProps$alternate === void 0 ? false : _tableProps$alternate,
83
+ alternate_highlight_color = tableProps.alternate_highlight_color;
72
84
  var rowsCount = size[0];
73
85
  var colsCount = size[1];
74
86
  var children = [];
@@ -87,7 +99,11 @@ export var generateEmptyTable = function generateEmptyTable(editor) {
87
99
  id: slugid.nice(),
88
100
  type: ELEMENT_TYPE.TABLE,
89
101
  children: children,
90
- columns: columns
102
+ columns: columns,
103
+ style: {
104
+ alternate_highlight: alternate_highlight,
105
+ alternate_highlight_color: alternate_highlight_color
106
+ }
91
107
  };
92
108
  };
93
109
  export var insertTable = function insertTable(editor, size, selection) {
@@ -96,7 +112,9 @@ export var insertTable = function insertTable(editor, size, selection) {
96
112
  if (position !== INSERT_POSITION.AFTER) {
97
113
  if (isTableMenuDisabled(editor)) return;
98
114
  }
99
- var tableNode = generateEmptyTable(editor, size);
115
+ var tableNode = generateEmptyTable(editor, {
116
+ size: size
117
+ });
100
118
  var validSelection = selection || editor.selection;
101
119
  var path = Editor.path(editor, validSelection);
102
120
  if (position === INSERT_POSITION.AFTER) {
@@ -926,7 +944,9 @@ var normalizeTableCell = function normalizeTableCell(cell) {
926
944
  export var normalizeTableELement = function normalizeTableELement(editor, element) {
927
945
  if (element.type !== ELEMENT_TYPE.TABLE) {
928
946
  var size = [element.children.length, element.children[0].children.length];
929
- return generateEmptyTable(editor, size);
947
+ return generateEmptyTable(editor, {
948
+ size: size
949
+ });
930
950
  }
931
951
  var newElement = _objectSpread({}, element);
932
952
  for (var i = 0; i < element.children.length; i++) {
@@ -937,4 +957,16 @@ export var normalizeTableELement = function normalizeTableELement(editor, elemen
937
957
  newElement.children[i] = row;
938
958
  }
939
959
  return newElement;
960
+ };
961
+ export var insertTableByTemplate = function insertTableByTemplate(editor, alternateColor) {
962
+ var size = [4, 4];
963
+ var tableNode = generateEmptyTable(editor, {
964
+ size: size,
965
+ alternate_highlight_color: alternateColor,
966
+ alternate_highlight: true
967
+ });
968
+ var path = Editor.path(editor, editor.selection);
969
+ Transforms.insertNodes(editor, tableNode, {
970
+ at: [path[0]]
971
+ });
940
972
  };
@@ -4,7 +4,6 @@ import { insertTable, isTableMenuDisabled } from '../../helpers';
4
4
  import { MENUS_CONFIG_MAP, ELEMENT_TYPE, INSERT_POSITION } from '../../../../constants';
5
5
  import TableSizePopover from '../../popover/table-size-popover';
6
6
  import ElementDropdownMenuItem from '../../../../commons/dropdown-menu-item';
7
- import { INTERNAL_EVENT } from '../../../../../constants';
8
7
  var TableMenu = function TableMenu(_ref) {
9
8
  var editor = _ref.editor,
10
9
  readonly = _ref.readonly,
@@ -14,11 +13,6 @@ var TableMenu = function TableMenu(_ref) {
14
13
  var createTable = useCallback(function (size) {
15
14
  insertTable(editor, size, editor.selection, INSERT_POSITION.CURRENT);
16
15
  }, [editor]);
17
- var openDialog = useCallback(function () {
18
- eventBus.dispatch(INTERNAL_EVENT.INSERT_ELEMENT, {
19
- type: ELEMENT_TYPE.TABLE
20
- });
21
- }, [eventBus]);
22
16
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ElementDropdownMenuItem, {
23
17
  disabled: disabled,
24
18
  menuConfig: menuConfig,
@@ -26,11 +20,11 @@ var TableMenu = function TableMenu(_ref) {
26
20
  }, !disabled && /*#__PURE__*/React.createElement("i", {
27
21
  className: "sdocfont sdoc-right-slide sdoc-dropdown-item-right-icon"
28
22
  })), !disabled && /*#__PURE__*/React.createElement(TableSizePopover, {
23
+ editor: editor,
29
24
  target: menuConfig.id,
30
25
  trigger: "hover",
31
26
  placement: "right-start",
32
- createTable: createTable,
33
- openDialog: openDialog
27
+ createTable: createTable
34
28
  }));
35
29
  };
36
30
  export default withTranslation('sdoc-editor')(TableMenu);
@@ -45,13 +45,20 @@
45
45
  margin-top: 5px;
46
46
  }
47
47
 
48
+ .sdoc-selected-table-size-container .sdoc-selected-table-tools-container {
49
+ padding: 10px 0;
50
+ margin-bottom: 10px;
51
+ border-bottom: 1px solid #dedede;
52
+ }
53
+
48
54
  .sdoc-selected-table-size-popover .sdoc-selected-table-size-custom {
49
- min-height: 40px;
50
- margin-top: 10px;
51
- border-top: 1px solid #dedede;
52
- padding: 8px 10px;
55
+ display: flex;
56
+ justify-content: space-between;
57
+ padding: 5px 10px 0;
58
+ min-height: 32px;
53
59
  }
54
60
 
55
61
  .sdoc-selected-table-size-popover .sdoc-selected-table-size-custom:hover {
56
62
  cursor: pointer;
63
+ background: #f5f5f5;
57
64
  }
@@ -3,25 +3,26 @@ import React, { useCallback, useRef, useState } from 'react';
3
3
  import classnames from 'classnames';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { UncontrolledPopover } from 'reactstrap';
6
+ import TableTemplate from '../table-template';
6
7
  import './index.css';
7
8
  var TableSizePopover = function TableSizePopover(_ref) {
8
- var target = _ref.target,
9
+ var editor = _ref.editor,
10
+ target = _ref.target,
9
11
  _ref$trigger = _ref.trigger,
10
12
  trigger = _ref$trigger === void 0 ? 'legacy' : _ref$trigger,
11
13
  _ref$placement = _ref.placement,
12
14
  placement = _ref$placement === void 0 ? 'bottom-start' : _ref$placement,
13
15
  popperClassName = _ref.popperClassName,
14
- createTable = _ref.createTable,
15
- openDialog = _ref.openDialog;
16
- var minSize = [4, 4];
16
+ createTable = _ref.createTable;
17
+ var minSize = [5, 10];
17
18
  var maxSize = [10, 10];
18
19
  var _useTranslation = useTranslation(),
19
20
  t = _useTranslation.t;
20
- var _useState = useState([4, 4]),
21
+ var _useState = useState([5, 10]),
21
22
  _useState2 = _slicedToArray(_useState, 2),
22
23
  displaySize = _useState2[0],
23
24
  setDisplaySize = _useState2[1];
24
- var _useState3 = useState([0, 0]),
25
+ var _useState3 = useState([1, 1]),
25
26
  _useState4 = _slicedToArray(_useState3, 2),
26
27
  selectedSize = _useState4[0],
27
28
  setSelectedSize = _useState4[1];
@@ -85,7 +86,7 @@ var TableSizePopover = function TableSizePopover(_ref) {
85
86
  }, [displaySize, selectedSize]);
86
87
  return /*#__PURE__*/React.createElement(UncontrolledPopover, {
87
88
  target: target,
88
- className: "sdoc-selected-table-size-popover sdoc-sub-dropdown-menu",
89
+ className: "sdoc-selected-table-size-popover sdoc-sub-dropdown-menu sdoc-dropdown-menu",
89
90
  trigger: trigger,
90
91
  placement: placement,
91
92
  hideArrow: true,
@@ -95,12 +96,19 @@ var TableSizePopover = function TableSizePopover(_ref) {
95
96
  }, /*#__PURE__*/React.createElement("div", {
96
97
  className: "sdoc-selected-table-size-container w-100 h-100 d-flex flex-column"
97
98
  }, /*#__PURE__*/React.createElement("div", {
98
- className: "sdoc-selected-table-size-tip w-100 "
99
- }, "".concat(selectedSize[0], " x ").concat(selectedSize[1])), /*#__PURE__*/React.createElement("div", {
99
+ className: "sdoc-selected-table-tools-container"
100
+ }, /*#__PURE__*/React.createElement("div", {
101
+ id: "sdoc-table-template-review-btn",
102
+ className: "sdoc-selected-table-size-custom"
103
+ }, /*#__PURE__*/React.createElement("span", null, t('Table_template')), /*#__PURE__*/React.createElement("i", {
104
+ className: "sdocfont sdoc-right-slide sdoc-dropdown-item-right-icon"
105
+ }))), /*#__PURE__*/React.createElement("div", {
100
106
  className: "sdoc-table-size-select"
101
107
  }, renderTableSize()), /*#__PURE__*/React.createElement("div", {
102
- className: "sdoc-selected-table-size-custom",
103
- onClick: openDialog
104
- }, t('Customize_the_number_of_rows_and_columns'))));
108
+ className: "sdoc-selected-table-size-tip w-100 "
109
+ }, "".concat(selectedSize[0], " x ").concat(selectedSize[1])), /*#__PURE__*/React.createElement(TableTemplate, {
110
+ editor: editor,
111
+ targetId: "sdoc-table-template-review-btn"
112
+ })));
105
113
  };
106
114
  export default TableSizePopover;
@@ -0,0 +1,35 @@
1
+ .sdoc-table-template-inner-popover {
2
+ display: flex;
3
+ flex-wrap: wrap;
4
+ padding: 20px;
5
+ width: 430px;
6
+ height: 100%;
7
+ background-color: #fff;
8
+ }
9
+
10
+ .sdoc-table-template-view-table {
11
+ padding: 10px;
12
+ margin: 10px 5px;
13
+ border: 1px solid #e2e3e6;
14
+ cursor: pointer;
15
+ }
16
+
17
+ .sdoc-table-template-view-table .sdoc-table-template-row .sdoc-table-template-cell {
18
+ width: 40px;
19
+ height: 20px;
20
+ border-left: 1px solid #e2e3e6;
21
+ border-right: 1px solid #e2e3e6;
22
+ }
23
+
24
+ .sdoc-table-template-view-table .sdoc-table-template-row {
25
+ display: flex;
26
+ }
27
+
28
+ .sdoc-table-template-view-table .sdoc-table-template-row:first-child .sdoc-table-template-cell {
29
+ border: none;
30
+ border-top: 1px solid #e2e3e6;
31
+ }
32
+
33
+ .sdoc-table-template-view-table .sdoc-table-template-row:last-child .sdoc-table-template-cell {
34
+ border-bottom: 1px solid #e2e3e6;
35
+ }
@@ -0,0 +1,33 @@
1
+ import React, { useCallback, useMemo } from 'react';
2
+ import { UncontrolledPopover } from 'reactstrap';
3
+ import { TABLE_ALTERNATE_HIGHLIGHT_CLASS_MAP } from '../../constants';
4
+ import SmapleTable from './sample-table';
5
+ import { insertTableByTemplate } from '../../helpers';
6
+ import './index.css';
7
+ import '../../render/alternate-color.css';
8
+ var TableTemplate = function TableTemplate(_ref) {
9
+ var editor = _ref.editor,
10
+ targetId = _ref.targetId;
11
+ var tableTemplatePreviewList = useMemo(function () {
12
+ return Reflect.ownKeys(TABLE_ALTERNATE_HIGHLIGHT_CLASS_MAP);
13
+ }, []);
14
+ var handleClickTemplate = useCallback(function (e, alternateColor) {
15
+ insertTableByTemplate(editor, alternateColor);
16
+ }, [editor]);
17
+ return /*#__PURE__*/React.createElement(UncontrolledPopover, {
18
+ target: targetId,
19
+ trigger: "hover",
20
+ placement: "right-start",
21
+ hideArrow: true,
22
+ fade: false,
23
+ className: "sdoc-sub-dropdown-menu sdoc-table-template-popover",
24
+ innerClassName: "sdoc-table-template-inner-popover"
25
+ }, tableTemplatePreviewList.map(function (alternateColor, index) {
26
+ return /*#__PURE__*/React.createElement(SmapleTable, {
27
+ key: alternateColor + index,
28
+ alternateColor: alternateColor,
29
+ onClickTemplate: handleClickTemplate
30
+ });
31
+ }));
32
+ };
33
+ export default TableTemplate;
@@ -0,0 +1,33 @@
1
+ import React, { useCallback } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { TABLE_ALTERNATE_HIGHLIGHT_CLASS_MAP } from '../../constants';
4
+ import './index.css';
5
+ var SmapleTable = function SmapleTable(_ref) {
6
+ var alternateColor = _ref.alternateColor,
7
+ onClickTemplate = _ref.onClickTemplate;
8
+ // generate table
9
+ var renderTableRow = useCallback(function (row, column) {
10
+ return new Array(row).fill(null).map(function (_, index) {
11
+ return /*#__PURE__*/React.createElement("div", {
12
+ className: "sdoc-table-template-row table-row",
13
+ key: "sdoc-template-table-row-".concat(index),
14
+ onClick: function onClick(e) {
15
+ return onClickTemplate(e, alternateColor);
16
+ }
17
+ }, new Array(column).fill(null).map(function (_, index) {
18
+ return /*#__PURE__*/React.createElement("div", {
19
+ className: "sdoc-table-template-cell",
20
+ key: "sdoc-template-table-cell-".concat(index)
21
+ });
22
+ }));
23
+ });
24
+ }, [onClickTemplate, alternateColor]);
25
+ return /*#__PURE__*/React.createElement("div", {
26
+ className: "sdoc-table-template-view-table ".concat(TABLE_ALTERNATE_HIGHLIGHT_CLASS_MAP[alternateColor])
27
+ }, renderTableRow(4, 4));
28
+ };
29
+ SmapleTable.proptoTypes = {
30
+ alternateColor: PropTypes.string.isRequired,
31
+ onClickTemplate: PropTypes.func.isRequired
32
+ };
33
+ export default SmapleTable;
@@ -0,0 +1,37 @@
1
+ /* type1 */
2
+ .sdoc-table-3f495d .table-row:nth-child(2n + 1) {
3
+ background-color: #f1f3f6;
4
+ }
5
+
6
+ .sdoc-table-3f495d .table-row:first-child {
7
+ background-color: #3f495d;
8
+ color: white;
9
+ }
10
+
11
+ /* type2 */
12
+ .sdoc-table-2367f2 .table-row:nth-child(2n + 1) {
13
+ background-color: #e1edff;
14
+ }
15
+
16
+ .sdoc-table-2367f2 .table-row:first-child {
17
+ background-color: #2367f2;
18
+ color: white;
19
+ }
20
+
21
+ /* type3 */
22
+ .sdoc-table-f77d21 .table-row:nth-child(2n + 1) {
23
+ background-color: #fff1e8;
24
+ }
25
+
26
+ .sdoc-table-f77d21 .table-row:first-child {
27
+ background-color: #f77d21;
28
+ }
29
+
30
+ /* type4 */
31
+ .sdoc-table-0099f4 .table-row:nth-child(2n + 1) {
32
+ background-color: #e1f5ff;
33
+ }
34
+
35
+ .sdoc-table-0099f4 .table-row:first-child {
36
+ background-color: #0099f4;
37
+ }
@@ -1,3 +1,4 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
1
2
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
4
  import React, { useRef, useState, useEffect, useCallback } from 'react';
@@ -5,7 +6,7 @@ import classnames from 'classnames';
5
6
  import throttle from 'lodash.throttle';
6
7
  import { useSelected, useSlateStatic, useReadOnly } from '@seafile/slate-react';
7
8
  import { Transforms, Editor } from '@seafile/slate';
8
- import { EMPTY_SELECTED_RANGE } from '../constants';
9
+ import { EMPTY_SELECTED_RANGE, TABLE_ALTERNATE_HIGHLIGHT_CLASS_MAP } from '../constants';
9
10
  import { ResizeHandlersContext, TableSelectedRangeContext, SettingSelectRangeContext } from './hooks';
10
11
  import EventBus from '../../../../utils/event-bus';
11
12
  import { INTERNAL_EVENT } from '../../../../constants';
@@ -17,7 +18,9 @@ import TableRoot from './table-root';
17
18
  import TableHeader from './table-header';
18
19
  import { findPath } from '../../../core';
19
20
  import './index.css';
21
+ import './alternate-color.css';
20
22
  var Table = function Table(_ref) {
23
+ var _element$style, _element$style2;
21
24
  var className = _ref.className,
22
25
  attributes = _ref.attributes,
23
26
  children = _ref.children,
@@ -181,7 +184,7 @@ var Table = function Table(_ref) {
181
184
  table: element,
182
185
  setSelectedRange: setSelectedRangeByClick
183
186
  }), /*#__PURE__*/React.createElement("div", {
184
- className: tableContainerClassName,
187
+ className: classnames(tableContainerClassName, _defineProperty({}, TABLE_ALTERNATE_HIGHLIGHT_CLASS_MAP[element === null || element === void 0 ? void 0 : (_element$style = element.style) === null || _element$style === void 0 ? void 0 : _element$style.alternate_highlight_color], element === null || element === void 0 ? void 0 : (_element$style2 = element.style) === null || _element$style2 === void 0 ? void 0 : _element$style2.alternate_highlight)),
185
188
  onMouseDown: onMouseDown,
186
189
  ref: table,
187
190
  "data-id": element.id
@@ -197,7 +200,6 @@ function renderTable(props) {
197
200
  attributes = props.attributes,
198
201
  children = props.children,
199
202
  element = props.element;
200
-
201
203
  // eslint-disable-next-line react-hooks/rules-of-hooks
202
204
  var editor = useSlateStatic();
203
205
  return /*#__PURE__*/React.createElement(TableRoot, {
@@ -52,15 +52,6 @@ var InsertBlockMenu = function InsertBlockMenu(_ref) {
52
52
 
53
53
  // eslint-disable-next-line react-hooks/exhaustive-deps
54
54
  }, [editor, insertPosition, slateNode]);
55
- var openTableDialog = useCallback(function () {
56
- var eventBus = EventBus.getInstance();
57
- eventBus.dispatch(INTERNAL_EVENT.INSERT_ELEMENT, {
58
- type: ELEMENT_TYPE.TABLE,
59
- insertPosition: insertPosition
60
- });
61
-
62
- // eslint-disable-next-line react-hooks/exhaustive-deps
63
- }, [insertPosition]);
64
55
  var onInsertList = useCallback(function (type) {
65
56
  toggleList(editor, type, insertPosition);
66
57
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -82,12 +73,12 @@ var InsertBlockMenu = function InsertBlockMenu(_ref) {
82
73
  }, /*#__PURE__*/React.createElement("i", {
83
74
  className: "sdocfont sdoc-right-slide sdoc-dropdown-item-right-icon"
84
75
  }), /*#__PURE__*/React.createElement(TableSizePopover, {
76
+ editor: editor,
85
77
  target: "sdoc-side-menu-item-table",
86
78
  trigger: "hover",
87
79
  placement: "right-start",
88
80
  popperClassName: "sdoc-side-menu-table-size",
89
- createTable: createTable,
90
- openDialog: openTableDialog
81
+ createTable: createTable
91
82
  })), /*#__PURE__*/React.createElement(DropdownMenuItem, {
92
83
  menuConfig: _objectSpread({}, SIDE_INSERT_MENUS_CONFIG[ELEMENT_TYPE.LINK]),
93
84
  onClick: openLinkDialog
@@ -51,3 +51,48 @@
51
51
  display: flex;
52
52
  flex-direction: column;
53
53
  }
54
+
55
+ .sdoc-editor-page-header .sdoc-revision-info .sdoc-revision-order {
56
+ display: inline-block;
57
+ font-size: 14px;
58
+ color: #888;
59
+ background: #eee;
60
+ padding: 0 8px;
61
+ height: 20px;
62
+ line-height: 20px;
63
+ border-radius: 10px;
64
+ margin-left: 0.5rem;
65
+ cursor: default;
66
+ }
67
+
68
+ .sdoc-editor-page-header .sdoc-revision-info .sdoc-revision-published-tip {
69
+ display: inline-block;
70
+ font-size: 14px;
71
+ color: #fff;
72
+ background: #5EBA00;
73
+ padding: 0 8px;
74
+ height: 20px;
75
+ line-height: 20px;
76
+ border-radius: 10px;
77
+ margin-left: 0.5rem;
78
+ cursor: default;
79
+ }
80
+
81
+ .sdoc-editor-page-header .sdoc-revision-info .sdoc-revision-source-doc {
82
+ display: inline-flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ height: 20px;
86
+ width: 20px;
87
+ margin-left: 0.5rem;
88
+ cursor: pointer;
89
+ }
90
+
91
+ .sdoc-editor-page-header .sdoc-revision-info .sdoc-revision-source-doc .sdoc-jump-to {
92
+ font-size: 14px;
93
+ color: #999;
94
+ }
95
+
96
+ .sdoc-editor-page-header .sdoc-revision-info .sdoc-revision-source-doc:hover .sdoc-jump-to {
97
+ color: #333;
98
+ }
@@ -24,6 +24,10 @@ var DocInfo = function DocInfo(_ref) {
24
24
  var eventBus = EventBus.getInstance();
25
25
  eventBus.dispatch(EXTERNAL_EVENT.TOGGLE_STAR);
26
26
  }, []);
27
+ var jumpToSourceDoc = useCallback(function () {
28
+ var originFileURL = context.getSetting('originFileURL');
29
+ window.open(originFileURL, '_blank');
30
+ }, []);
27
31
  var isSdocRevision = context.getSetting('isSdocRevision');
28
32
  var docName = context.getSetting('docName');
29
33
  var _context$getSettings = context.getSettings(),
@@ -68,9 +72,15 @@ var DocInfo = function DocInfo(_ref) {
68
72
  className: "doc-name"
69
73
  }, oldDocName), /*#__PURE__*/React.createElement("div", {
70
74
  className: "sdoc-revision-order"
71
- }, t('Revision') + ' ' + revisionId), isPublished && /*#__PURE__*/React.createElement("div", {
75
+ }, t('Revision') + ' ' + revisionId), isPublished && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
72
76
  className: "sdoc-revision-published-tip"
73
- }, t('Published')), !isPublished && /*#__PURE__*/React.createElement(TipMessage, {
77
+ }, t('Published')), /*#__PURE__*/React.createElement("div", {
78
+ className: "sdoc-revision-source-doc",
79
+ title: t('Jump_to_original_doc'),
80
+ onClick: jumpToSourceDoc
81
+ }, /*#__PURE__*/React.createElement("i", {
82
+ className: "sdocfont sdoc-jump-to"
83
+ }))), !isPublished && /*#__PURE__*/React.createElement(TipMessage, {
74
84
  isEditMode: isEditMode
75
85
  })), /*#__PURE__*/React.createElement("div", {
76
86
  className: "doc-state"
@@ -25,29 +25,3 @@
25
25
  .doc-ops .popover-wrapper {
26
26
  width: 300px;
27
27
  }
28
-
29
- .doc-info .sdoc-revision-order {
30
- display: inline-block;
31
- font-size: 14px;
32
- color: #888;
33
- background: #eee;
34
- padding: 0 8px;
35
- height: 20px;
36
- line-height: 20px;
37
- border-radius: 10px;
38
- margin-left: 0.5rem;
39
- cursor: default;
40
- }
41
-
42
- .doc-info .sdoc-revision-published-tip {
43
- display: inline-block;
44
- font-size: 14px;
45
- color: #55A900;
46
- background: #E6F4D6;
47
- padding: 0 8px;
48
- height: 20px;
49
- line-height: 20px;
50
- border-radius: 3px;
51
- margin-left: 0.5rem;
52
- cursor: default;
53
- }
@@ -103,6 +103,14 @@ var Alert = /*#__PURE__*/function (_React$PureComponent) {
103
103
  }),
104
104
  iconClass: 'sdocfont sdoc-exclamation-circle'
105
105
  };
106
+ default:
107
+ return {
108
+ borderStyle: this.containerBorderSuccess,
109
+ iconColor: css({
110
+ color: 'rgb(71, 184, 129)'
111
+ }),
112
+ iconClass: 'sdocfont sdoc-check-circle'
113
+ };
106
114
  }
107
115
  }
108
116
  }, {
@@ -75,7 +75,7 @@ var DateUtils = /*#__PURE__*/function () {
75
75
  if (this.isValidDateObject(dateObject)) return dateObject;
76
76
  if (!isDateTypeString) return null;
77
77
 
78
- //ios phone and safari browser not support use '2021-09-10 12:30', support '2021/09/10 12:30'
78
+ // ios phone and safari browser not support use '2021-09-10 12:30', support '2021/09/10 12:30'
79
79
  dateObject = new Date(dateString.replace(/-/g, '/'));
80
80
  if (this.isValidDateObject(dateObject)) return dateObject;
81
81
  return null;
@@ -34,7 +34,7 @@ var LocalStorage = /*#__PURE__*/function () {
34
34
  return window.localStorage.removeItem(key);
35
35
  }
36
36
 
37
- //The setExpire and getExpire methods used to satisfy some cases that need to be updated regularly
37
+ // The setExpire and getExpire methods used to satisfy some cases that need to be updated regularly
38
38
  }, {
39
39
  key: "setExpire",
40
40
  value: function setExpire(key, value, expire) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -410,5 +410,7 @@
410
410
  "revision": "revision",
411
411
  "xxx_added_a_new_comment": "{{author}} added a new comment",
412
412
  "xxx_added_a_reply": "{{author}} added a reply",
413
- "New": "Nový"
413
+ "New": "Nový",
414
+ "Table_template": "Table template",
415
+ "Jump_to_original_doc": "Jump to the original document"
414
416
  }
@@ -410,5 +410,7 @@
410
410
  "revision": "revision",
411
411
  "xxx_added_a_new_comment": "{{author}} added a new comment",
412
412
  "xxx_added_a_reply": "{{author}} added a reply",
413
- "New": "Erstellen"
413
+ "New": "Erstellen",
414
+ "Table_template": "Table template",
415
+ "Jump_to_original_doc": "Jump to the original document"
414
416
  }
@@ -410,5 +410,7 @@
410
410
  "revision": "revision",
411
411
  "xxx_added_a_new_comment": "{{author}} added a new comment",
412
412
  "xxx_added_a_reply": "{{author}} added a reply",
413
- "New": "New"
413
+ "New": "New",
414
+ "Table_template": "Table template",
415
+ "Jump_to_original_doc": "Jump to the original document"
414
416
  }
@@ -410,5 +410,7 @@
410
410
  "revision": "revision",
411
411
  "xxx_added_a_new_comment": "{{author}} added a new comment",
412
412
  "xxx_added_a_reply": "{{author}} added a reply",
413
- "New": "Nuevo"
413
+ "New": "Nuevo",
414
+ "Table_template": "Table template",
415
+ "Jump_to_original_doc": "Jump to the original document"
414
416
  }
@@ -410,5 +410,7 @@
410
410
  "revision": "revision",
411
411
  "xxx_added_a_new_comment": "{{author}} added a new comment",
412
412
  "xxx_added_a_reply": "{{author}} added a reply",
413
- "New": "Créer"
413
+ "New": "Créer",
414
+ "Table_template": "Table template",
415
+ "Jump_to_original_doc": "Jump to the original document"
414
416
  }
@@ -410,5 +410,7 @@
410
410
  "revision": "revision",
411
411
  "xxx_added_a_new_comment": "{{author}} added a new comment",
412
412
  "xxx_added_a_reply": "{{author}} added a reply",
413
- "New": "Nuovo"
413
+ "New": "Nuovo",
414
+ "Table_template": "Table template",
415
+ "Jump_to_original_doc": "Jump to the original document"
414
416
  }
@@ -410,5 +410,7 @@
410
410
  "revision": "версия",
411
411
  "xxx_added_a_new_comment": "{{author}} добавил новый комментарий",
412
412
  "xxx_added_a_reply": "{{author}} добавил ответ",
413
- "New": "Новый"
413
+ "New": "Новый",
414
+ "Table_template": "Шаблон таблицы",
415
+ "Jump_to_original_doc": "Jump to the original document"
414
416
  }
@@ -410,5 +410,7 @@
410
410
  "revision": "修订稿",
411
411
  "xxx_added_a_new_comment": "{{author}} 添加了一条新评论",
412
412
  "xxx_added_a_reply": "{{author}} 添加了一条回复",
413
- "New": "新"
413
+ "New": "新",
414
+ "Table_template": "表格模版",
415
+ "Jump_to_original_doc": "跳转到源文档"
414
416
  }
@@ -14,6 +14,12 @@
14
14
  />
15
15
  <missing-glyph />
16
16
 
17
+ <glyph glyph-name="sdoc-jump-to" unicode="&#58970;" d="M361.6 896c32 0 54.4-16 54.4-48S393.6 800 361.6 800H96v-832h832v262.4c0 32 16 57.6 48 57.6s48-25.6 48-57.6v-300.8c0-32-28.8-57.6-60.8-57.6H60.8c-32 0-60.8 25.6-60.8 57.6V835.2C0 870.4 25.6 896 60.8 896h300.8zM992 896c19.2 0 32-12.8 32-32v-332.8c0-28.8-19.2-51.2-48-51.2s-48 22.4-48 51.2V729.6L531.2 336c-6.4-9.6-19.2-16-35.2-16-12.8 0-25.6 6.4-35.2 16-19.2 19.2-19.2 51.2 0 70.4L857.6 800h-198.4c-28.8 0-51.2 19.2-51.2 48S630.4 896 656 896H992z" horiz-adv-x="1024" />
18
+
19
+ <glyph glyph-name="sdoc-callout" unicode="&#58972;" d="M992 352H32c-19.2 0-32 12.8-32 32V832c0 19.2 12.8 32 32 32h960c19.2 0 32-12.8 32-32v-448c0-19.2-12.8-32-32-32zM96 448h832V768H96v-320z m-96-224v-96h1024v96H0z m0-224v-96h576v96H0z" horiz-adv-x="1024" />
20
+
21
+ <glyph glyph-name="sdoc-chart" unicode="&#58971;" d="M992-128H32c-19.2 0-32 12.8-32 32V864c0 19.2 12.8 32 32 32h960c19.2 0 32-12.8 32-32v-960c0-19.2-12.8-32-32-32zM96-32h832V800H96v-832z m0 464v-96h832v96H96zM560 800h-96v-832h96V800z" horiz-adv-x="1024" />
22
+
17
23
  <glyph glyph-name="sdoc-add" unicode="&#58968;" d="M512-128C227.2-128 0 99.2 0 384S227.2 896 512 896s512-227.2 512-512-227.2-512-512-512z m-51.2 563.2H291.2c-19.2 0-35.2-12.8-35.2-35.2v-35.2c0-19.2 12.8-35.2 35.2-35.2h169.6V160c0-19.2 12.8-35.2 35.2-35.2h35.2c19.2 0 35.2 12.8 35.2 35.2v169.6H736c19.2 0 35.2 12.8 35.2 35.2v35.2c0 19.2-12.8 35.2-35.2 35.2h-169.6V604.8c0 19.2-12.8 35.2-35.2 35.2h-35.2c-19.2 0-35.2-12.8-35.2-35.2v-169.6z" horiz-adv-x="1024" />
18
24
 
19
25
  <glyph glyph-name="sdoc-tag" unicode="&#58969;" d="M521.353986 860.33363l466.979644-466.979644c22.389435-22.389435 35.183398-51.175851 35.183398-83.160758s-12.793963-60.771324-35.183398-83.160759l-323.047562-319.849071c-22.389435-22.389435-51.175851-35.183398-79.962268-35.183398-31.984907 0-60.771324 12.793963-83.160758 35.183398L35.183398 374.163042c-25.587926 25.587926-38.381889 60.771324-31.984907 95.954721l31.984907 291.062655c6.396981 54.374342 47.977361 95.954721 102.351703 102.351703l291.062654 31.984907c31.984907 3.198491 67.168305-9.595472 92.756231-35.183398zM444.590209 767.577399L159.924536 735.592492l-31.984908-281.467182L578.926819-0.060372l316.65058 313.45209L444.590209 767.577399z m12.793963-127.939628c57.572833-57.572833 57.572833-147.130573 0-204.703406-25.587926-25.587926-63.969814-41.580379-102.351703-41.580379-38.381889 0-73.565286 12.793963-102.351703 41.580379-57.572833 57.572833-57.572833 147.130573 0 204.703406 57.572833 57.572833 150.329063 57.572833 204.703406 0z m-102.351703-70.366796c-6.396981 0-15.992454-3.198491-22.389435-9.595472-12.793963-12.793963-12.793963-31.984907 0-44.77887 12.793963-12.793963 31.984907-12.793963 44.77887 0 12.793963 12.793963 12.793963 31.984907 0 44.77887-6.396981 6.396981-12.793963 9.595472-22.389435 9.595472z" horiz-adv-x="1024" />
@@ -1,11 +1,11 @@
1
1
  @font-face {
2
2
  font-family: "sdocfont"; /* Project id 4097705 */
3
- src: url('./sdoc-editor-font/iconfont.eot?t=1699007792511'); /* IE9 */
4
- src: url('./sdoc-editor-font/iconfont.eot?t=1699007792511#iefix') format('embedded-opentype'), /* IE6-IE8 */
5
- url('./sdoc-editor-font/iconfont.woff2?t=1699007792511') format('woff2'),
6
- url('./sdoc-editor-font/iconfont.woff?t=1699007792511') format('woff'),
7
- url('./sdoc-editor-font/iconfont.ttf?t=1699007792511') format('truetype'),
8
- url('./sdoc-editor-font/iconfont.svg?t=1699007792511#sdocfont') format('svg');
3
+ src: url('./sdoc-editor-font/iconfont.eot?t=1700460885427'); /* IE9 */
4
+ src: url('./sdoc-editor-font/iconfont.eot?t=1700460885427#iefix') format('embedded-opentype'), /* IE6-IE8 */
5
+ url('./sdoc-editor-font/iconfont.woff2?t=1700460885427') format('woff2'),
6
+ url('./sdoc-editor-font/iconfont.woff?t=1700460885427') format('woff'),
7
+ url('./sdoc-editor-font/iconfont.ttf?t=1700460885427') format('truetype'),
8
+ url('./sdoc-editor-font/iconfont.svg?t=1700460885427#sdocfont') format('svg');
9
9
  }
10
10
 
11
11
  .sdocfont {
@@ -16,6 +16,18 @@
16
16
  -moz-osx-font-smoothing: grayscale;
17
17
  }
18
18
 
19
+ .sdoc-jump-to:before {
20
+ content: "\e65a";
21
+ }
22
+
23
+ .sdoc-callout:before {
24
+ content: "\e65c";
25
+ }
26
+
27
+ .sdoc-chart:before {
28
+ content: "\e65b";
29
+ }
30
+
19
31
  .sdoc-add:before {
20
32
  content: "\e658";
21
33
  }