@seafile/sdoc-editor 1.0.195 → 1.0.197

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 (72) hide show
  1. package/dist/basic-sdk/comment/components/comment-all-participants/index.js +1 -1
  2. package/dist/basic-sdk/comment/components/comment-delete-popover.js +1 -1
  3. package/dist/basic-sdk/comment/components/comment-editor.js +1 -1
  4. package/dist/basic-sdk/comment/components/comment-participants-editor/index.js +1 -1
  5. package/dist/basic-sdk/comment/components/comment-participants-editor/searched-collaborators.js +1 -1
  6. package/dist/basic-sdk/comment/components/comment-participants-editor/selected-participants.js +1 -1
  7. package/dist/basic-sdk/comment/components/global-comment/global-comment-body-header.js +2 -2
  8. package/dist/basic-sdk/comment/components/global-comment/global-comment-header.js +1 -1
  9. package/dist/basic-sdk/comment/hooks/notification-hooks/use-notification-mount.js +1 -1
  10. package/dist/basic-sdk/comment/provider/participants-content-provider.js +1 -1
  11. package/dist/basic-sdk/extension/commons/dropdown-menu-item/index.js +1 -1
  12. package/dist/basic-sdk/extension/commons/file-insert-dialog/index.js +1 -1
  13. package/dist/basic-sdk/extension/commons/insert-element-dialog/index.js +1 -1
  14. package/dist/basic-sdk/extension/commons/menu/menu-item.js +1 -1
  15. package/dist/basic-sdk/extension/commons/select-file-dialog/index.js +1 -1
  16. package/dist/basic-sdk/extension/commons/wiki-file-insert-dialog/index.js +1 -1
  17. package/dist/basic-sdk/extension/core/utils/index.js +1 -1
  18. package/dist/basic-sdk/extension/plugins/ai/ai-menu/menu-item.js +1 -1
  19. package/dist/basic-sdk/extension/plugins/callout/menu/index.js +1 -1
  20. package/dist/basic-sdk/extension/plugins/callout/render-elem/callout-hover-menu/index.js +1 -1
  21. package/dist/basic-sdk/extension/plugins/callout/render-elem/index.js +1 -1
  22. package/dist/basic-sdk/extension/plugins/code-block/hover-menu/index.js +1 -1
  23. package/dist/basic-sdk/extension/plugins/file-link/helpers.js +12 -2
  24. package/dist/basic-sdk/extension/plugins/file-link/plugin.js +21 -1
  25. package/dist/basic-sdk/extension/plugins/file-link/render-elem.css +3 -2
  26. package/dist/basic-sdk/extension/plugins/file-link/render-elem.js +3 -0
  27. package/dist/basic-sdk/extension/plugins/font/menu/font-family/font-item.js +1 -1
  28. package/dist/basic-sdk/extension/plugins/font/menu/font-family/index.js +1 -1
  29. package/dist/basic-sdk/extension/plugins/font/menu/font-size/index.js +1 -1
  30. package/dist/basic-sdk/extension/plugins/header/plugin.js +3 -3
  31. package/dist/basic-sdk/extension/plugins/image/menu/index.js +1 -1
  32. package/dist/basic-sdk/extension/plugins/link/dialog/add-link-dialog/index.js +1 -1
  33. package/dist/basic-sdk/extension/plugins/link/hover/index.js +1 -1
  34. package/dist/basic-sdk/extension/plugins/list/helpers.js +14 -2
  35. package/dist/basic-sdk/extension/plugins/paragraph/plugin.js +3 -3
  36. package/dist/basic-sdk/extension/plugins/sdoc-link/helpers.js +12 -2
  37. package/dist/basic-sdk/extension/plugins/sdoc-link/plugin.js +10 -27
  38. package/dist/basic-sdk/extension/plugins/sdoc-link/render/render-elem.css +2 -1
  39. package/dist/basic-sdk/extension/plugins/sdoc-link/render/render-elem.js +2 -1
  40. package/dist/basic-sdk/extension/plugins/search-replace/popover/index.js +1 -1
  41. package/dist/basic-sdk/extension/plugins/search-replace/popover/replace-all-confirm-modal.js +1 -1
  42. package/dist/basic-sdk/extension/plugins/seatable-tables/op-menu/index.js +3 -3
  43. package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/seatable-table.js +1 -1
  44. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/filter-popover-widgets/department-filter/department-multiple-select-filter.js +1 -1
  45. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/filter-popover-widgets/department-filter/department-multiple-select.js +1 -1
  46. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/filter-popover-widgets/department-filter/department-single-select-filter.js +1 -1
  47. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/filter-popover-widgets/department-filter/selected-departments.js +1 -1
  48. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/index.js +1 -1
  49. package/dist/basic-sdk/extension/plugins/table/dialogs/custom-table-size-dialog/index.js +1 -1
  50. package/dist/basic-sdk/extension/plugins/table/dialogs/split-cell-setting-dialog.js +1 -1
  51. package/dist/basic-sdk/extension/plugins/table/menu/color-selector-popover/index.js +1 -1
  52. package/dist/basic-sdk/extension/plugins/table/menu/horizontal-align-popover/index.js +1 -1
  53. package/dist/basic-sdk/extension/plugins/table/menu/vertical-align-popover/index.js +1 -1
  54. package/dist/basic-sdk/extension/plugins/table/popover/table-size-popover/index.js +1 -1
  55. package/dist/basic-sdk/extension/plugins/table/render/table-header/index.js +1 -1
  56. package/dist/basic-sdk/extension/plugins/text-align/menu/index.js +1 -1
  57. package/dist/basic-sdk/extension/plugins/video/menu/index.js +1 -1
  58. package/dist/basic-sdk/extension/render/element-decorate/rebase-decorate/rebase-delete-modify-decorate.js +1 -1
  59. package/dist/basic-sdk/extension/render/element-decorate/rebase-decorate/rebase-modify-delete-decorate.js +1 -1
  60. package/dist/basic-sdk/extension/render/element-decorate/rebase-decorate/rebase-modify-modify-decorate.js +1 -1
  61. package/dist/basic-sdk/extension/toolbar/header-toolbar/insert-toolbar/index.js +1 -1
  62. package/dist/basic-sdk/extension/toolbar/side-toolbar/insert-block-menu.js +1 -1
  63. package/dist/basic-sdk/wiki-outline/index.js +1 -1
  64. package/dist/components/doc-operations/revision-operations/changes-count/index.js +1 -1
  65. package/dist/components/doc-operations/revision-operations/index.js +1 -1
  66. package/dist/components/doc-operations/revision-operations/publish-revision/index.js +1 -1
  67. package/dist/components/doc-operations/revision-operations/revisions/index.js +1 -1
  68. package/dist/components/doc-operations/revision-operations/revisions/revisions-dialog/index.js +1 -1
  69. package/dist/components/doc-operations/revision-operations/view-changes/index.js +1 -1
  70. package/dist/components/tip-dialog/index.js +1 -1
  71. package/dist/pages/published-revision-viewer.js +1 -1
  72. package/package.json +1 -1
@@ -20,7 +20,7 @@ const CommentAllParticipants = () => {
20
20
  } = (0, _useParticipants.useParticipantsContext)();
21
21
  const {
22
22
  t
23
- } = (0, _reactI18next.useTranslation)();
23
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
24
24
  const addParticipantId = 'sdoc-add-participants';
25
25
  const commentsParticipantsId = 'sdoc-comments-participants';
26
26
  const [isDidMount, setDidMount] = (0, _react.useState)(false);
@@ -19,7 +19,7 @@ const CommentDeletePopover = _ref => {
19
19
  } = _ref;
20
20
  const {
21
21
  t
22
- } = (0, _reactI18next.useTranslation)();
22
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
23
23
  const onDeleteCancel = (0, _react.useCallback)(event => {
24
24
  event.stopPropagation();
25
25
  setIsShowDeleteModal(false);
@@ -44,7 +44,7 @@ const CommentEditor = _ref => {
44
44
  const commentWrapperRef = (0, _react.useRef)();
45
45
  const {
46
46
  t
47
- } = (0, _reactI18next.useTranslation)();
47
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
48
48
  const {
49
49
  addParticipants
50
50
  } = (0, _useParticipants.useParticipantsContext)();
@@ -25,7 +25,7 @@ const CommentParticipantsEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref
25
25
  } = (0, _hooks.useCollaborators)();
26
26
  const {
27
27
  t
28
- } = (0, _reactI18next.useTranslation)();
28
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
29
29
  const [searchValue, setSearchValue] = (0, _react.useState)('');
30
30
  const [searchedCollaborators, setSearchedCollaborators] = (0, _react.useState)([]);
31
31
  (0, _react.useImperativeHandle)(ref, () => ({
@@ -20,7 +20,7 @@ const SearchedCollaborators = _ref => {
20
20
  } = (0, _useParticipants.useParticipantsContext)();
21
21
  const {
22
22
  t
23
- } = (0, _reactI18next.useTranslation)();
23
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
24
24
  const onSelectParticipant = (0, _react.useCallback)((event, participant, isSelected) => {
25
25
  (0, _mouseEvent.eventStopPropagation)(event);
26
26
  if (isSelected) {
@@ -15,7 +15,7 @@ const SelectedParticipants = () => {
15
15
  } = (0, _useParticipants.useParticipantsContext)();
16
16
  const {
17
17
  t
18
- } = (0, _reactI18next.useTranslation)();
18
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
19
19
  const onDeleteParticipant = (0, _react.useCallback)(participant => {
20
20
  deleteParticipant(participant.username);
21
21
  }, [deleteParticipant]);
@@ -17,7 +17,7 @@ const CommentTypeDropdownItem = _ref => {
17
17
  } = _ref;
18
18
  const {
19
19
  t
20
- } = (0, _reactI18next.useTranslation)();
20
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
21
21
  const handleCommentTypeChanged = (0, _react.useCallback)((event, type) => {
22
22
  (0, _mouseEvent.eventStopPropagation)(event);
23
23
  setCommentType(type);
@@ -38,7 +38,7 @@ const GlobalCommentBodyHeader = _ref2 => {
38
38
  } = _ref2;
39
39
  const {
40
40
  t
41
- } = (0, _reactI18next.useTranslation)();
41
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
42
42
  const [isDropdownOpen, setDropdownOpen] = (0, _react.useState)(false);
43
43
  let commentTip = null;
44
44
  if (commentList.length === 1) {
@@ -22,7 +22,7 @@ const GlobalCommentHeader = _ref => {
22
22
  } = _ref;
23
23
  const {
24
24
  t
25
- } = (0, _reactI18next.useTranslation)();
25
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
26
26
  const panelHeaderRef = (0, _react.useRef)(null);
27
27
  const [isMounted, setIsMounted] = (0, _react.useState)(false);
28
28
  (0, _react.useEffect)(() => {
@@ -17,7 +17,7 @@ var _constants3 = require("../../../constants");
17
17
  const useNotificationsMount = dispatch => {
18
18
  const {
19
19
  t
20
- } = (0, _reactI18next.useTranslation)();
20
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
21
21
  const {
22
22
  collaborators
23
23
  } = (0, _hooks.useCollaborators)();
@@ -24,7 +24,7 @@ const ParticipantsProvider = _ref => {
24
24
  const [participants, setParticipants] = (0, _react.useState)([]);
25
25
  const {
26
26
  t
27
- } = (0, _reactI18next.useTranslation)();
27
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
28
28
  const updateLocalParticipants = (0, _react.useCallback)(function () {
29
29
  let added = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
30
30
  if (!Array.isArray(added) || added.length === 0) return;
@@ -23,7 +23,7 @@ const DropdownMenuItem = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
23
23
  } = props;
24
24
  const {
25
25
  t
26
- } = (0, _reactI18next.useTranslation)();
26
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
27
27
  const {
28
28
  iconClass
29
29
  } = menuConfig;
@@ -30,7 +30,7 @@ const FileLinkInsertDialog = _ref => {
30
30
  } = _ref;
31
31
  const {
32
32
  t
33
- } = (0, _reactI18next.useTranslation)();
33
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
34
34
  const eventBus = _eventBus.default.getInstance();
35
35
  const fileLinkInsertRef = (0, _react.useRef)(null);
36
36
  const historyFileWrapperRef = (0, _react.useRef)(document.querySelector('.sdoc-history-files-wrapper'));
@@ -37,7 +37,7 @@ const InsertElementDialog = _ref => {
37
37
  const [handleSubmit, setHandleSubmit] = (0, _react.useState)(() => void 0);
38
38
  const {
39
39
  t
40
- } = (0, _reactI18next.useTranslation)();
40
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
41
41
  const uploadLocalImageInputRef = (0, _react.useRef)();
42
42
  const uploadLocalVideoInputRef = (0, _react.useRef)();
43
43
  const onFileChanged = (0, _react.useCallback)(event => {
@@ -26,7 +26,7 @@ const MenuItem = _ref => {
26
26
  } = _ref;
27
27
  const {
28
28
  t
29
- } = (0, _reactI18next.useTranslation)();
29
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
30
30
  const onClick = (0, _react.useCallback)(event => {
31
31
  if (disabled) return;
32
32
  onMouseDown(event, type);
@@ -26,7 +26,7 @@ const SelectSdocFileDialog = _ref => {
26
26
  const modalTitle = dialogType === _constants.ELEMENT_TYPE.FILE_LINK ? 'Select_file' : 'Select_sdoc_document';
27
27
  const {
28
28
  t
29
- } = (0, _reactI18next.useTranslation)();
29
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
30
30
  const [currentSelectedFile, setCurrentSelectedFile] = (0, _react.useState)(null);
31
31
  const [temSearchContent, setTemSearchContent] = (0, _react.useState)('');
32
32
  const [searchContent, setSearchContent] = (0, _react.useState)('');
@@ -27,7 +27,7 @@ const WikiFileLinkInsertDialog = _ref => {
27
27
  } = _ref;
28
28
  const {
29
29
  t
30
- } = (0, _reactI18next.useTranslation)();
30
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
31
31
  const eventBus = _eventBus.default.getInstance();
32
32
  const fileLinkInsertRef = (0, _react.useRef)(null);
33
33
  const historyFileWrapperRef = (0, _react.useRef)(document.querySelector('.sdoc-history-files-wrapper'));
@@ -58,7 +58,7 @@ function Placeholder(props) {
58
58
  } = props;
59
59
  const {
60
60
  t
61
- } = (0, _reactI18next.useTranslation)();
61
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
62
62
  return /*#__PURE__*/_react.default.createElement("span", {
63
63
  contentEditable: "false",
64
64
  suppressContentEditableWarning: true,
@@ -26,7 +26,7 @@ const MenuItem = _ref => {
26
26
  } = _ref;
27
27
  const {
28
28
  t
29
- } = (0, _reactI18next.useTranslation)();
29
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
30
30
  const onClick = (0, _react.useCallback)(event => {
31
31
  if (disabled) return;
32
32
  onMouseDown(event, type);
@@ -25,7 +25,7 @@ const CalloutMenu = _ref => {
25
25
  } = _ref;
26
26
  const {
27
27
  t
28
- } = (0, _reactI18next.useTranslation)();
28
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
29
29
  const handleDisplayAlert = (0, _react.useCallback)(type => {
30
30
  setTimeout(() => {
31
31
  _toast.default.warning(`${t('The_current_location_does_not_support_pasting')}${t(type && type.at(0).toUpperCase() + type.slice(1))}`);
@@ -24,7 +24,7 @@ function CalloutHoverMenu(_ref) {
24
24
  const [isShowIcon, setIsShowIcon] = (0, _react.useState)(false);
25
25
  const {
26
26
  t
27
- } = (0, _reactI18next.useTranslation)();
27
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
28
28
  const onColorSelectorToggle = (0, _react.useCallback)(event => {
29
29
  event.stopPropagation();
30
30
  if (!isShowColorSelector) {
@@ -30,7 +30,7 @@ const renderCallout = (_ref, editor) => {
30
30
  const isSelected = (0, _slateReact.useSelected)();
31
31
  const {
32
32
  t
33
- } = (0, _reactI18next.useTranslation)();
33
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
34
34
  const calloutRef = (0, _react.useRef)();
35
35
  const [isShowColorSelector, setIsShowColorSelector] = (0, _react.useState)(false);
36
36
  const [popoverPosition, setPopoverPosition] = (0, _react.useState)({
@@ -23,7 +23,7 @@ const LangList = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
23
23
  } = _ref;
24
24
  const {
25
25
  t
26
- } = (0, _reactI18next.useTranslation)();
26
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
27
27
  if (!langsData.length) {
28
28
  return /*#__PURE__*/_react.default.createElement("div", {
29
29
  className: "langs-list-empty"
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.unwrapLinkNode = exports.onCopyFileLinkNode = exports.isMenuDisabled = exports.insertFileLink = exports.getUrl = exports.getType = exports.generateFileNode = void 0;
7
+ exports.unwrapLinkNode = exports.onCopyFileLinkNode = exports.isMenuDisabled = exports.insertFileLink = exports.getUrl = exports.getType = exports.getFileLinkEntry = exports.generateFileNode = void 0;
8
8
  var _slateReact = require("@seafile/slate-react");
9
9
  var _slate = require("@seafile/slate");
10
10
  var _slugid = _interopRequireDefault(require("slugid"));
@@ -112,4 +112,14 @@ const onCopyFileLinkNode = (editor, element) => {
112
112
  }
113
113
  });
114
114
  };
115
- exports.onCopyFileLinkNode = onCopyFileLinkNode;
115
+ exports.onCopyFileLinkNode = onCopyFileLinkNode;
116
+ const getFileLinkEntry = function (editor) {
117
+ let at = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : editor.selection;
118
+ const aboveNodeEntry = _slate.Editor.above(editor, {
119
+ match: n => n.type === _constants.FILE_LINK,
120
+ mode: 'highest',
121
+ at
122
+ });
123
+ return aboveNodeEntry;
124
+ };
125
+ exports.getFileLinkEntry = getFileLinkEntry;
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _slate = require("@seafile/slate");
8
8
  var _constants = require("../../constants");
9
+ var _helpers = require("./helpers");
9
10
  const withFileLink = editor => {
10
11
  const {
11
12
  isInline,
12
- deleteBackward
13
+ deleteBackward,
14
+ onHotKeyDown
13
15
  } = editor;
14
16
  const newEditor = editor;
15
17
 
@@ -47,6 +49,24 @@ const withFileLink = editor => {
47
49
  }
48
50
  return deleteBackward(unit);
49
51
  };
52
+ newEditor.onHotKeyDown = e => {
53
+ const fileLinkEntry = (0, _helpers.getFileLinkEntry)(editor);
54
+ if (fileLinkEntry) {
55
+ if (e.key === 'ArrowLeft') {
56
+ const beforePointFileLink = _slate.Editor.before(newEditor, fileLinkEntry[1]);
57
+ _slate.Transforms.select(newEditor, beforePointFileLink);
58
+ e.preventDefault();
59
+ return;
60
+ }
61
+ if (e.key === 'ArrowRight') {
62
+ const afterPointFileLink = _slate.Editor.after(newEditor, fileLinkEntry[1]);
63
+ _slate.Transforms.select(newEditor, afterPointFileLink);
64
+ e.preventDefault();
65
+ return;
66
+ }
67
+ }
68
+ return onHotKeyDown && onHotKeyDown(e);
69
+ };
50
70
  return newEditor;
51
71
  };
52
72
  var _default = exports.default = withFileLink;
@@ -1,5 +1,6 @@
1
+ .file-link-selected,
1
2
  .sdoc-file-link-render:hover {
2
- background-color: #e5e5e5
3
+ background-color: #e5e5e5 !important;
3
4
  }
4
5
 
5
6
  .sdoc-file-card-link {
@@ -20,7 +21,7 @@
20
21
  }
21
22
 
22
23
  .sdoc-file-card-link .sdoc-file-link-icon :first-child {
23
- font-size: 24px;
24
+ font-size: 24px;
24
25
  }
25
26
 
26
27
  .sdoc-file-card-link .sdoc-file-link-icon {
@@ -27,6 +27,7 @@ const FileLink = _ref => {
27
27
  const readOnly = (0, _slateReact.useReadOnly)();
28
28
  const [isShowInsertHoverMenu, setIsShowInsertHoverMenu] = (0, _react.useState)(false);
29
29
  const [menuPosition, setMenuPosition] = (0, _react.useState)({});
30
+ const isSelected = (0, _slateReact.useSelected)();
30
31
  const registerEventHandle = (0, _react.useCallback)(() => {
31
32
  document.addEventListener('click', onHideInsertHoverMenu);
32
33
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -118,6 +119,8 @@ const FileLink = _ref => {
118
119
  "data-id": element.id,
119
120
  contentEditable: false,
120
121
  className: (0, _classnames.default)('sdoc-file-link-render', {
122
+ 'file-link-selected': isSelected
123
+ }, {
121
124
  'sdoc-file-card-link': element.display_type === _constants2.FILE_LINK_TYPE.CARD_LINK
122
125
  }),
123
126
  onClick: onClickFile,
@@ -18,7 +18,7 @@ const FontItem = _ref => {
18
18
  } = _ref;
19
19
  const {
20
20
  t
21
- } = (0, _reactI18next.useTranslation)();
21
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
22
22
  const fontName = fontObject.name;
23
23
  const isSelected = selectedFont === fontName;
24
24
  const isFontLoad = (0, _helpers.hasFontLoaded)(fontObject, 400);
@@ -30,7 +30,7 @@ const FontFamily = _ref => {
30
30
  const [fontList, setFontList] = (0, _react.useState)(_constants.FONT);
31
31
  const {
32
32
  t
33
- } = (0, _reactI18next.useTranslation)();
33
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
34
34
  const popoverRef = (0, _react.useRef)(null);
35
35
  const disabled = (0, _helpers.isMenuDisabled)(editor, readonly);
36
36
  const fontSizeButtonId = 'sdoc-button-font';
@@ -24,7 +24,7 @@ const FontSize = _ref => {
24
24
  const [isShowMenu, setMenuShow] = (0, _react.useState)(false);
25
25
  const {
26
26
  t
27
- } = (0, _reactI18next.useTranslation)();
27
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
28
28
  const popoverRef = (0, _react.useRef)(null);
29
29
  const disabled = (0, _helpers.isMenuDisabled)(editor, readonly);
30
30
  const fontSizeButtonId = 'sdoc-button-font-size';
@@ -12,6 +12,7 @@ var _helpers = require("./helpers");
12
12
  var _isHotkey = _interopRequireDefault(require("is-hotkey"));
13
13
  var _keyboard = require("../../constants/keyboard");
14
14
  var _utils = require("../../../../utils");
15
+ var _helpers2 = require("../list/helpers");
15
16
  const isSelectionAtLineEnd = (editor, path) => {
16
17
  const {
17
18
  selection
@@ -77,14 +78,13 @@ const withHeader = editor => {
77
78
  }
78
79
  };
79
80
  newEditor.insertFragment = data => {
80
- var _data$, _data$$children;
81
81
  const headerNode = (0, _core.getSelectedNodeByTypes)(editor, _constants.HEADERS);
82
82
  const headerText = _slate.Node.string(headerNode || {
83
83
  children: []
84
84
  });
85
- const isSingleListItem = data.length === 1 && ((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : (_data$$children = _data$.children) === null || _data$$children === void 0 ? void 0 : _data$$children.length) === 1 && _constants.LIST_TYPE_ARRAY.includes(data[0].type);
85
+ const onlyOneListItem = data.length === 1 && (0, _helpers2.isSingleListItem)(data[0]);
86
86
  // Insert a list item when the header is empty, insert only the text
87
- if (headerNode && headerText.length === 0 && isSingleListItem) {
87
+ if (headerNode && headerText.length === 0 && onlyOneListItem) {
88
88
  const text = _slate.Node.string(data[0]);
89
89
  insertText(text);
90
90
  return;
@@ -26,7 +26,7 @@ const ImageMenu = _ref => {
26
26
  const menuConfig = _constants.MENUS_CONFIG_MAP[_constants.IMAGE];
27
27
  const {
28
28
  t
29
- } = (0, _reactI18next.useTranslation)();
29
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
30
30
  const openInsertLocalImage = (0, _react.useCallback)(() => {
31
31
  eventBus.dispatch(_constants2.INTERNAL_EVENT.INSERT_ELEMENT, {
32
32
  type: _constants.LOCAL_IMAGE,
@@ -23,7 +23,7 @@ const AddLinkDialog = _ref => {
23
23
  } = _ref;
24
24
  const {
25
25
  t
26
- } = (0, _reactI18next.useTranslation)();
26
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
27
27
  const [linkErrorMessage, setLinkErrorMessage] = (0, _react.useState)('');
28
28
  const [titleErrorMessage, setTitleErrorMessage] = (0, _react.useState)('');
29
29
  const {
@@ -22,7 +22,7 @@ const LinkHover = _ref => {
22
22
  const readOnly = (0, _slateReact.useReadOnly)();
23
23
  const {
24
24
  t
25
- } = (0, _reactI18next.useTranslation)();
25
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
26
26
  const onMouseDown = (0, _react.useCallback)(event => {
27
27
  event.stopPropagation();
28
28
  if (!(0, _helpers.isWeChat)()) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setListType = exports.isMenuDisabled = exports.getListType = exports.getBeforeText = void 0;
6
+ exports.setListType = exports.isSingleListItem = exports.isMenuDisabled = exports.getListType = exports.getBeforeText = void 0;
7
7
  var _slate = require("@seafile/slate");
8
8
  var _constants = require("../../constants");
9
9
  var _transforms = require("./transforms");
@@ -100,4 +100,16 @@ const getBeforeText = editor => {
100
100
  range
101
101
  };
102
102
  };
103
- exports.getBeforeText = getBeforeText;
103
+ exports.getBeforeText = getBeforeText;
104
+ const isSingleListItem = node => {
105
+ // ordered_list/unordered_list -> list-item.children -> paragraph
106
+ // -> ordered_list/unordered_list
107
+ if (![_constants.ORDERED_LIST, _constants.UNORDERED_LIST].includes(node.type)) return false;
108
+ // list children
109
+ if (node.children.length !== 1) return false;
110
+ // listItem children
111
+ const listItem = node.children[0];
112
+ if (listItem.children.length !== 1) return false;
113
+ return true;
114
+ };
115
+ exports.isSingleListItem = isSingleListItem;
@@ -9,6 +9,7 @@ var _isHotkey = _interopRequireDefault(require("is-hotkey"));
9
9
  var _slate = require("@seafile/slate");
10
10
  var _core = require("../../core");
11
11
  var _constants = require("../../constants");
12
+ var _helpers = require("../list/helpers");
12
13
  const withParagraph = editor => {
13
14
  const {
14
15
  handleTab,
@@ -135,10 +136,9 @@ const withParagraph = editor => {
135
136
  return onHotKeyDown && onHotKeyDown(event);
136
137
  };
137
138
  newEditor.insertFragment = data => {
138
- var _data$, _data$$children;
139
139
  const paragraphBlock = (0, _core.getSelectedNodeByType)(editor, _constants.PARAGRAPH);
140
- const isSingleListItem = data.length === 1 && ((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : (_data$$children = _data$.children) === null || _data$$children === void 0 ? void 0 : _data$$children.length) === 1 && _constants.LIST_TYPE_ARRAY.includes(data[0].type);
141
- if (paragraphBlock && isSingleListItem) {
140
+ const onlyOneListItem = data.length === 1 && (0, _helpers.isSingleListItem)(data[0]);
141
+ if (paragraphBlock && onlyOneListItem) {
142
142
  const text = _slate.Node.string(data[0]);
143
143
  editor.insertText(text);
144
144
  return;
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.unwrapLinkNode = exports.sdocFileIcon = exports.removeTempInput = exports.removeShortCutSymbol = exports.onCopySdocLinkNode = exports.isTriggeredByShortcut = exports.isMenuDisabled = exports.insertTextWhenRemoveFileNameCollector = exports.insertTempInput = exports.insertSdocFileLink = exports.getUrl = exports.getType = exports.getNewFileListData = exports.getFileSearchInputEntry = exports.getBeforeText = exports.generateSdocFileNode = void 0;
7
+ exports.unwrapLinkNode = exports.sdocFileIcon = exports.removeTempInput = exports.removeShortCutSymbol = exports.onCopySdocLinkNode = exports.isTriggeredByShortcut = exports.isMenuDisabled = exports.insertTextWhenRemoveFileNameCollector = exports.insertTempInput = exports.insertSdocFileLink = exports.getUrl = exports.getType = exports.getSdocLinkEntry = exports.getNewFileListData = exports.getFileSearchInputEntry = exports.getBeforeText = exports.generateSdocFileNode = void 0;
8
8
  var _slateReact = require("@seafile/slate-react");
9
9
  var _slate = require("@seafile/slate");
10
10
  var _slugid = _interopRequireDefault(require("slugid"));
@@ -278,4 +278,14 @@ const sdocFileIcon = () => {
278
278
  const server = _context.default.getSetting('serviceUrl');
279
279
  return `${server}/media/img/file/256/sdoc.png`;
280
280
  };
281
- exports.sdocFileIcon = sdocFileIcon;
281
+ exports.sdocFileIcon = sdocFileIcon;
282
+ const getSdocLinkEntry = function (editor) {
283
+ let at = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : editor.selection;
284
+ const aboveNodeEntry = _slate.Editor.above(editor, {
285
+ match: n => n.type === _constants.SDOC_LINK,
286
+ mode: 'highest',
287
+ at
288
+ });
289
+ return aboveNodeEntry;
290
+ };
291
+ exports.getSdocLinkEntry = getSdocLinkEntry;
@@ -80,36 +80,19 @@ const withSdocLink = editor => {
80
80
  return onCompositionStart && onCompositionStart(event);
81
81
  };
82
82
  newEditor.onHotKeyDown = e => {
83
- const {
84
- selection
85
- } = newEditor;
86
- const isCollapsed = _slate.Range.isCollapsed(selection);
87
- if (isCollapsed) {
83
+ const sdocLinkEntry = (0, _helpers.getSdocLinkEntry)(editor);
84
+ if (sdocLinkEntry) {
88
85
  if (e.key === 'ArrowLeft') {
89
- const prePoint = _slate.Editor.before(newEditor, selection);
90
- const [preNode, prePath] = _slate.Editor.node(newEditor, prePoint.path, {
91
- depth: 2
92
- });
93
- if ((preNode === null || preNode === void 0 ? void 0 : preNode.type) === _constants.SDOC_LINK) {
94
- const beforePointSdocLink = _slate.Editor.before(newEditor, prePath);
95
- _slate.Transforms.select(newEditor, beforePointSdocLink);
96
- e.preventDefault();
97
- return;
98
- }
86
+ const beforePointSdocLink = _slate.Editor.before(newEditor, sdocLinkEntry[1]);
87
+ _slate.Transforms.select(newEditor, beforePointSdocLink);
88
+ e.preventDefault();
89
+ return;
99
90
  }
100
91
  if (e.key === 'ArrowRight') {
101
- const nextPoint = _slate.Editor.after(newEditor, selection);
102
- if (nextPoint) {
103
- const [nextNode, nextPath] = _slate.Editor.node(newEditor, nextPoint.path, {
104
- depth: 2
105
- });
106
- if ((nextNode === null || nextNode === void 0 ? void 0 : nextNode.type) === _constants.SDOC_LINK) {
107
- const afterPointSdocLink = _slate.Editor.after(newEditor, nextPath);
108
- _slate.Transforms.select(newEditor, afterPointSdocLink);
109
- e.preventDefault();
110
- return;
111
- }
112
- }
92
+ const afterPointSdocLink = _slate.Editor.after(newEditor, sdocLinkEntry[1]);
93
+ _slate.Transforms.select(newEditor, afterPointSdocLink);
94
+ e.preventDefault();
95
+ return;
113
96
  }
114
97
  }
115
98
  return onHotKeyDown && onHotKeyDown(e);
@@ -1,5 +1,6 @@
1
+ .sdoc-file-link-selected,
1
2
  .sdoc-file-render:hover {
2
- background-color: #e5e5e5;
3
+ background-color: #e5e5e5 !important;
3
4
  padding: 3px 0;
4
5
  }
5
6
 
@@ -35,6 +35,7 @@ const SdocFileLink = _ref => {
35
35
  const [isShowInsertHoverMenu, setIsShowInsertHoverMenu] = (0, _react.useState)(false);
36
36
  const [menuPosition, setMenuPosition] = (0, _react.useState)({});
37
37
  const readOnly = (0, _slateReact.useReadOnly)();
38
+ const isSelected = (0, _slateReact.useSelected)();
38
39
  const registerEventHandle = (0, _react.useCallback)(() => {
39
40
  document.addEventListener('click', onHideInsertHoverMenu);
40
41
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -136,7 +137,7 @@ const SdocFileLink = _ref => {
136
137
  return /*#__PURE__*/_react.default.createElement("span", Object.assign({}, attributes, {
137
138
  "data-id": element.id,
138
139
  contentEditable: false,
139
- className: `sdoc-file-render ${element.display_type === _constants2.SDOC_LINK_TYPE.CARD_LINK ? 'sdoc-file-card-link' : ''}`,
140
+ className: `sdoc-file-render ${isSelected ? 'sdoc-file-link-selected' : ''} ${element.display_type === _constants2.SDOC_LINK_TYPE.CARD_LINK ? 'sdoc-file-card-link' : ''}`,
140
141
  onClick: onClickFile,
141
142
  style: element.display_type === _constants2.SDOC_LINK_TYPE.CARD_LINK ? style : {}
142
143
  }), /*#__PURE__*/_react.default.createElement("span", {
@@ -43,7 +43,7 @@ const SearchReplacePopover = _ref => {
43
43
  const searchInputRef = (0, _react.useRef)(null);
44
44
  const {
45
45
  t
46
- } = (0, _reactI18next.useTranslation)();
46
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
47
47
  const searchInputSuffixContent = (0, _react.useMemo)(() => {
48
48
  if (!!searchContent.length && !highlightInfos.length) return t('Search_not_found');
49
49
  if (highlightInfos.length) return `${currentSelectIndex + 1} / ${highlightInfos.length}`;
@@ -19,7 +19,7 @@ const ReplaceAllConfirmModal = _ref => {
19
19
  } = _ref;
20
20
  const {
21
21
  t
22
- } = (0, _reactI18next.useTranslation)();
22
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
23
23
  const modalContent = replacedWord === '' ? t('Are_you_sure_to_clear_all_number_xxx_in_this_document', {
24
24
  number,
25
25
  originalWord
@@ -26,7 +26,7 @@ const TablesList = _ref => {
26
26
  } = _ref;
27
27
  const {
28
28
  t
29
- } = (0, _reactI18next.useTranslation)();
29
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
30
30
  if (!tablesData.length) {
31
31
  return /*#__PURE__*/_react.default.createElement("div", {
32
32
  className: "tables-list-empty"
@@ -58,7 +58,7 @@ const TablesSettings = _ref2 => {
58
58
  } = _ref2;
59
59
  const {
60
60
  t
61
- } = (0, _reactI18next.useTranslation)();
61
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
62
62
  return /*#__PURE__*/_react.default.createElement("div", {
63
63
  className: "seatable-setting-container"
64
64
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -94,7 +94,7 @@ function OpMenu(_ref3) {
94
94
  } = _ref3;
95
95
  const {
96
96
  t
97
- } = (0, _reactI18next.useTranslation)();
97
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
98
98
  const scrollRef = (0, _useScrollContext.useScrollContext)();
99
99
  const timer = (0, _react.useRef)(null);
100
100
  const tablesData = editor.tables;
@@ -45,7 +45,7 @@ function SeaTableTable(_ref) {
45
45
  const tableInfoRef = (0, _react.useRef)(null);
46
46
  const {
47
47
  t
48
- } = (0, _reactI18next.useTranslation)();
48
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
49
49
 
50
50
  // menu control
51
51
  const seaTableRef = (0, _react.useRef)(null);
@@ -22,7 +22,7 @@ function DepartmentMultipleSelectFilter(props) {
22
22
  const selectorRef = (0, _react.useRef)(null);
23
23
  const {
24
24
  t
25
- } = (0, _reactI18next.useTranslation)();
25
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
26
26
  (0, _useClickOutside.default)({
27
27
  currDOM: selectorRef.current,
28
28
  onClickOutside: () => setIsShowSelector(false)
@@ -29,7 +29,7 @@ function DepartmentMultipleSelect(props) {
29
29
  const validDepartmentsRef = (0, _react.useRef)([]);
30
30
  const {
31
31
  t
32
- } = (0, _reactI18next.useTranslation)();
32
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
33
33
  (0, _react.useEffect)(() => {
34
34
  if (departmentContainerRef.current) {
35
35
  resetContainerPosition();
@@ -23,7 +23,7 @@ function DepartmentSingleSelectFilter(props) {
23
23
  const selectorRef = (0, _react.useRef)(null);
24
24
  const {
25
25
  t
26
- } = (0, _reactI18next.useTranslation)();
26
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
27
27
  let selectedDepartmentIds = [];
28
28
  selectedDepartmentIds.push(value);
29
29
  (0, _useClickOutside.default)({
@@ -20,7 +20,7 @@ function SelectedDepartments(props) {
20
20
  } = props;
21
21
  const {
22
22
  t
23
- } = (0, _reactI18next.useTranslation)();
23
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
24
24
  const idDepartmentMap = (0, _react.useMemo)(() => {
25
25
  let idDepartmentMap = {};
26
26
  departments.forEach(department => {
@@ -25,7 +25,7 @@ function TableSettings(_ref) {
25
25
  const [columns, setColumns] = (0, _react.useState)([]);
26
26
  const {
27
27
  t
28
- } = (0, _reactI18next.useTranslation)();
28
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
29
29
  const timer = (0, _react.useRef)(null);
30
30
  (0, _react.useEffect)(() => {
31
31
  const {
@@ -21,7 +21,7 @@ const CustomTableSizeDialog = _ref => {
21
21
  } = _ref;
22
22
  const {
23
23
  t
24
- } = (0, _reactI18next.useTranslation)();
24
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
25
25
  const [errorMessage, setErrorMessage] = (0, _react.useState)('');
26
26
  const [rows, setRows] = (0, _react.useState)('1');
27
27
  const [cols, setCols] = (0, _react.useState)('1');
@@ -16,7 +16,7 @@ const SplitCellSettingDialog = _ref => {
16
16
  } = _ref;
17
17
  const {
18
18
  t
19
- } = (0, _reactI18next.useTranslation)();
19
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
20
20
  const {
21
21
  cell
22
22
  } = (0, _helpers.getSelectedInfo)(editor);
@@ -28,7 +28,7 @@ const ColorSelectorPopover = _ref => {
28
28
  } = _ref;
29
29
  const {
30
30
  t
31
- } = (0, _reactI18next.useTranslation)();
31
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
32
32
  const {
33
33
  lastUsedTableCellBackgroundColor: lastUsedColor,
34
34
  updateLastUsedTableCellBackgroundColor: updateLastUsedColor
@@ -23,7 +23,7 @@ const HorizontalAlignPopover = _ref => {
23
23
  } = _ref;
24
24
  const {
25
25
  t
26
- } = (0, _reactI18next.useTranslation)();
26
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
27
27
  const setTextAlignStyle = (0, _react.useCallback)(textAlign => {
28
28
  if (readonly) return;
29
29
  (0, _helpers.setCellStyle)(editor, {
@@ -24,7 +24,7 @@ const VerticalAlignPopover = _ref => {
24
24
  } = _ref;
25
25
  const {
26
26
  t
27
- } = (0, _reactI18next.useTranslation)();
27
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
28
28
  const setVerticalAlignStyle = (0, _react.useCallback)(position => {
29
29
  if (readonly) return;
30
30
  const alignItems = (0, _KebabToCamel.default)(_constants.TABLE_CELL_STYLE.ALIGN_ITEMS);
@@ -253,7 +253,7 @@ const MenuItem = _ref2 => {
253
253
  } = _ref2;
254
254
  const {
255
255
  t
256
- } = (0, _reactI18next.useTranslation)();
256
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
257
257
  return /*#__PURE__*/_react.default.createElement("div", {
258
258
  id: id,
259
259
  className: (0, _classnames.default)('sdoc-selected-table-size-custom', {
@@ -25,7 +25,7 @@ const TableHeader = _ref => {
25
25
  } = _ref;
26
26
  const {
27
27
  t
28
- } = (0, _reactI18next.useTranslation)();
28
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
29
29
  const columns = (0, _hooks.useResizeHandlersContext)();
30
30
  const selectedRange = (0, _hooks.useTableSelectedRangeContext)() || _constants.EMPTY_SELECTED_RANGE;
31
31
  const selectColumn = (0, _react.useCallback)(columnIndex => {
@@ -27,7 +27,7 @@ const TextAlignMenu = _ref => {
27
27
  const buttonId = 'sdoc-button-text-align';
28
28
  const {
29
29
  t
30
- } = (0, _reactI18next.useTranslation)();
30
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
31
31
  const toggle = (0, _react.useCallback)(event => {
32
32
  popoverRef.current.toggle();
33
33
  setMenuShow(!isShowMenu);
@@ -23,7 +23,7 @@ const VideoMenu = _ref => {
23
23
  const menuConfig = _constants.MENUS_CONFIG_MAP[_constants.VIDEO];
24
24
  const {
25
25
  t
26
- } = (0, _reactI18next.useTranslation)();
26
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
27
27
  const openLocalVideoDialog = (0, _react.useCallback)(() => {
28
28
  eventBus.dispatch(_constants2.INTERNAL_EVENT.INSERT_ELEMENT, {
29
29
  type: _constants.LOCAL_VIDEO,
@@ -19,7 +19,7 @@ const RebaseDeleteModifyDecorate = _ref => {
19
19
  } = _ref;
20
20
  const {
21
21
  t
22
- } = (0, _reactI18next.useTranslation)();
22
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
23
23
  const editor = (0, _slateReact.useSlateStatic)();
24
24
  const deleteElement = (0, _react.useCallback)(() => {
25
25
  const path = (0, _core.findPath)(editor, element);
@@ -19,7 +19,7 @@ const RebaseModifyDeleteDecorate = _ref => {
19
19
  } = _ref;
20
20
  const {
21
21
  t
22
- } = (0, _reactI18next.useTranslation)();
22
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
23
23
  const editor = (0, _slateReact.useSlateStatic)();
24
24
  const deleteElement = (0, _react.useCallback)(() => {
25
25
  const path = (0, _core.findPath)(editor, element);
@@ -21,7 +21,7 @@ const RebaseModifyModifyDecorate = _ref => {
21
21
  } = _ref;
22
22
  const {
23
23
  t
24
- } = (0, _reactI18next.useTranslation)();
24
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
25
25
  const editor = (0, _slateReact.useSlateStatic)();
26
26
  const useMasterChanges = (0, _react.useCallback)(() => {
27
27
  const path = (0, _core.findPath)(editor, element);
@@ -32,7 +32,7 @@ const InsertToolbar = _ref => {
32
32
  const [isShowMenu, setMenuShow] = (0, _react.useState)(false);
33
33
  const {
34
34
  t
35
- } = (0, _reactI18next.useTranslation)();
35
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
36
36
  const popoverRef = (0, _react.useRef)(null);
37
37
  const disabled = readonly;
38
38
  const insertButtonRef = (0, _react.useRef)(null);
@@ -34,7 +34,7 @@ const InsertBlockMenu = _ref => {
34
34
  const editor = (0, _slateReact.useSlateStatic)();
35
35
  const {
36
36
  t
37
- } = (0, _reactI18next.useTranslation)();
37
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
38
38
  const onInsertImageToggle = (0, _react.useCallback)(() => {
39
39
  const eventBus = _eventBus.default.getInstance();
40
40
  if (insertPosition === _constants.INSERT_POSITION.CURRENT) {
@@ -26,7 +26,7 @@ const Outline = _ref => {
26
26
  } = _ref;
27
27
  const {
28
28
  t
29
- } = (0, _reactI18next.useTranslation)();
29
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
30
30
  const scrollRef = (0, _useScrollContext.useScrollContext)();
31
31
  const [headerList, setHeaderList] = (0, _react.useState)([]);
32
32
  const [activeId, setActiveId] = (0, _react.useState)('');
@@ -17,7 +17,7 @@ const ChangesCount = _ref => {
17
17
  } = _ref;
18
18
  const {
19
19
  t
20
- } = (0, _reactI18next.useTranslation)();
20
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
21
21
  const [currentDiffIndex, setDiffIndex] = (0, _react.useState)(0);
22
22
  const [changes, setChanges] = (0, _react.useState)([]);
23
23
  const intervalRef = (0, _react.useRef)();
@@ -32,7 +32,7 @@ const RevisionOperations = _ref => {
32
32
  const isSdocRevision = _context.default.getSetting('isSdocRevision');
33
33
  const {
34
34
  t
35
- } = (0, _reactI18next.useTranslation)();
35
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
36
36
  const [isShowTip, setShowTip] = (0, _react.useState)(false);
37
37
  const [tipType, setTipType] = (0, _react.useState)('');
38
38
  const [mergeValue, setMergeValue] = (0, _react.useState)(null);
@@ -14,7 +14,7 @@ const PublishRevision = _ref => {
14
14
  } = _ref;
15
15
  const {
16
16
  t
17
- } = (0, _reactI18next.useTranslation)();
17
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
18
18
  const onPublishRevision = (0, _react.useCallback)(event => {
19
19
  event.stopPropagation();
20
20
  event.nativeEvent.stopImmediatePropagation();
@@ -19,7 +19,7 @@ const Revisions = () => {
19
19
  const eventBus = _basicSdk.EventBus.getInstance();
20
20
  const {
21
21
  t
22
- } = (0, _reactI18next.useTranslation)();
22
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
23
23
  const [revisionsCount, setRevisionsCount] = (0, _react.useState)(0);
24
24
  const [isShowRevisions, setShowRevisions] = (0, _react.useState)(false);
25
25
  const autoIncrementRevisionsCount = (0, _react.useCallback)(() => {
@@ -29,7 +29,7 @@ const RevisionsDialog = _ref => {
29
29
  const revisionListRef = (0, _react.useRef)(null);
30
30
  const {
31
31
  t
32
- } = (0, _reactI18next.useTranslation)();
32
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
33
33
  const [isLoading, setLoading] = (0, _react.useState)(true);
34
34
  const [revisions, setRevisions] = (0, _react.useState)([]);
35
35
  const [page, setPage] = (0, _react.useState)(1);
@@ -19,7 +19,7 @@ const ViewChanges = _ref => {
19
19
  } = _ref;
20
20
  const {
21
21
  t
22
- } = (0, _reactI18next.useTranslation)();
22
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
23
23
  (0, _react.useEffect)(() => {
24
24
  const url = new URL(window.location.href);
25
25
  const searchParams = new URLSearchParams(url.search);
@@ -26,7 +26,7 @@ const TipDialog = _ref => {
26
26
  } = _ref;
27
27
  const {
28
28
  t
29
- } = (0, _reactI18next.useTranslation)();
29
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
30
30
  const [isSubmitting, setSubmitting] = (0, _react.useState)();
31
31
  const closeDialog = (0, _react.useCallback)(() => {
32
32
  if (NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType)) return;
@@ -22,7 +22,7 @@ const PublishedRevisionViewer = () => {
22
22
  _context.default.initApi();
23
23
  const {
24
24
  t
25
- } = (0, _reactI18next.useTranslation)();
25
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
26
26
  const [isFirstLoading, setIsFirstLoading] = (0, _react.useState)(true);
27
27
  const [errorMessage, setErrorMessage] = (0, _react.useState)('');
28
28
  const [isShowChanges, setShowChanges] = (0, _react.useState)(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.195",
3
+ "version": "1.0.197",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",