@seafile/comment-editor 0.0.1-alpha.45 → 0.0.1-alpha.46

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.
@@ -10,10 +10,12 @@ var _reactI18next = require("react-i18next");
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
  const ColorItem = _ref => {
12
12
  let {
13
- t,
14
13
  color,
15
14
  lastUsedColor
16
15
  } = _ref;
16
+ const {
17
+ t
18
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
17
19
  return /*#__PURE__*/_react.default.createElement("div", {
18
20
  className: (0, _classnames.default)('sdoc-color-item', {
19
21
  'selected': lastUsedColor === color.value
@@ -28,4 +30,4 @@ const ColorItem = _ref => {
28
30
  }) : t(color.name)
29
31
  });
30
32
  };
31
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(ColorItem);
33
+ var _default = exports.default = ColorItem;
@@ -26,7 +26,6 @@ const ColorMenu = _ref => {
26
26
  id,
27
27
  popoverClassName,
28
28
  disabled,
29
- t,
30
29
  setColor,
31
30
  recentUsedColorsKey,
32
31
  text,
@@ -35,6 +34,9 @@ const ColorMenu = _ref => {
35
34
  lastUsedColor,
36
35
  updateLastUsedColor
37
36
  } = _ref;
37
+ const {
38
+ t
39
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
38
40
  const popoverRef = (0, _react.useRef)(null);
39
41
  const moreColorsPopoverRef = (0, _react.useRef)(null);
40
42
  const [recentUsedColors, setRecentUsedColors] = (0, _react.useState)(_localStorageUtils.default.getItem(recentUsedColorsKey, _constants.DEFAULT_RECENT_USED_LIST));
@@ -205,4 +207,4 @@ const ColorMenu = _ref => {
205
207
  onChange: onChange
206
208
  }))))));
207
209
  };
208
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(ColorMenu);
210
+ var _default = exports.default = ColorMenu;
@@ -20,10 +20,12 @@ const LocalFiles = _ref => {
20
20
  onSelectedFile,
21
21
  toggle,
22
22
  fileType,
23
- t,
24
23
  searchContent,
25
24
  isOpenSearch
26
25
  } = _ref;
26
+ const {
27
+ t
28
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
27
29
  const folderRef = (0, _react.useRef)(null);
28
30
  const [expandedFolder, setExpandedFolder] = (0, _react.useState)(new Set([]));
29
31
  const [currentActiveItem, setCurrentActiveItem] = (0, _react.useState)(null);
@@ -188,4 +190,4 @@ const LocalFiles = _ref => {
188
190
  className: "sdoc-file-search-no-result"
189
191
  }, t('No_results')));
190
192
  };
191
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(LocalFiles);
193
+ var _default = exports.default = LocalFiles;
@@ -55,9 +55,11 @@ const CodeBlockHoverMenu = _ref2 => {
55
55
  onChangeLanguage,
56
56
  onChangeAutoLineWrap,
57
57
  onCopyCodeBlock,
58
- onDeleteCodeBlock,
59
- t
58
+ onDeleteCodeBlock
60
59
  } = _ref2;
60
+ const {
61
+ t
62
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
61
63
  const {
62
64
  white_space = 'nowrap'
63
65
  } = style;
@@ -254,4 +256,4 @@ const CodeBlockHoverMenu = _ref2 => {
254
256
  ref: langRefs
255
257
  })))));
256
258
  };
257
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(CodeBlockHoverMenu);
259
+ var _default = exports.default = CodeBlockHoverMenu;
@@ -24,9 +24,11 @@ const FileLinkHoverMenu = _ref => {
24
24
  menuPosition,
25
25
  element,
26
26
  onUnwrapFileLinkNode,
27
- onHideInsertHoverMenu,
28
- t
27
+ onHideInsertHoverMenu
29
28
  } = _ref;
29
+ const {
30
+ t
31
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
30
32
  const readOnly = (0, _slateReact.useReadOnly)();
31
33
  const [isShowDisplayStylePopover, setIsShowDisplayStylePopover] = (0, _react.useState)(false);
32
34
  const onCopy = (0, _react.useCallback)(e => {
@@ -117,4 +119,4 @@ const FileLinkHoverMenu = _ref => {
117
119
  }));
118
120
  }))));
119
121
  };
120
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(FileLinkHoverMenu);
122
+ var _default = exports.default = FileLinkHoverMenu;
@@ -27,9 +27,11 @@ const ImageHoverMenu = _ref => {
27
27
  parentNodeEntry,
28
28
  imageCaptionInputRef,
29
29
  onHideImageHoverMenu,
30
- t,
31
30
  readonly
32
31
  } = _ref;
32
+ const {
33
+ t
34
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
33
35
  const {
34
36
  data,
35
37
  border_type = _constants2.IMAGE_BORDER_TYPE[0].type
@@ -299,4 +301,4 @@ const ImageHoverMenu = _ref => {
299
301
  }
300
302
  })));
301
303
  };
302
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(ImageHoverMenu);
304
+ var _default = exports.default = ImageHoverMenu;
@@ -33,9 +33,11 @@ const Image = _ref => {
33
33
  className,
34
34
  attributes,
35
35
  children,
36
- isSelected,
37
- t
36
+ isSelected
38
37
  } = _ref;
38
+ const {
39
+ t
40
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
39
41
  const {
40
42
  data,
41
43
  border_type = _constants3.IMAGE_BORDER_TYPE[0].type
@@ -348,7 +350,7 @@ const Image = _ref => {
348
350
  }
349
351
  })));
350
352
  };
351
- const SdocImage = (0, _reactI18next.withTranslation)('sdoc-editor')(Image);
353
+ const SdocImage = Image;
352
354
  function renderImage(props, editor) {
353
355
  // eslint-disable-next-line react-hooks/rules-of-hooks
354
356
  const isSelected = (0, _slateReact.useSelected)();
@@ -25,9 +25,11 @@ const SdocLinkHoverMenu = _ref => {
25
25
  element,
26
26
  onUnwrapFileLinkNode,
27
27
  onHideInsertHoverMenu,
28
- t,
29
28
  url
30
29
  } = _ref;
30
+ const {
31
+ t
32
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
31
33
  const readOnly = (0, _slateReact.useReadOnly)();
32
34
  const [isShowDisplayStylePopover, setIsShowDisplayStylePopover] = (0, _react.useState)(false);
33
35
  const onCopy = (0, _react.useCallback)(e => {
@@ -116,4 +118,4 @@ const SdocLinkHoverMenu = _ref => {
116
118
  }));
117
119
  }))));
118
120
  };
119
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(SdocLinkHoverMenu);
121
+ var _default = exports.default = SdocLinkHoverMenu;
@@ -10,10 +10,12 @@ var _reactI18next = require("react-i18next");
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
  const ColorItem = _ref => {
12
12
  let {
13
- t,
14
13
  color,
15
14
  lastUsedColor
16
15
  } = _ref;
16
+ const {
17
+ t
18
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
17
19
  return /*#__PURE__*/_react.default.createElement("div", {
18
20
  className: (0, _classnames.default)('sdoc-color-item', {
19
21
  'selected': lastUsedColor === color.value
@@ -28,4 +30,4 @@ const ColorItem = _ref => {
28
30
  }) : t(color.name)
29
31
  });
30
32
  };
31
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(ColorItem);
33
+ var _default = exports.default = ColorItem;
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
- var _reactI18next = require("react-i18next");
11
10
  var _dropdownMenuItem = _interopRequireDefault(require("../../../../commons/dropdown-menu-item"));
12
11
  var _constants = require("../../../../constants");
13
12
  var _helpers = require("../../helpers");
@@ -38,4 +37,4 @@ const TableMenu = _ref => {
38
37
  createTable: createTable
39
38
  }));
40
39
  };
41
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(TableMenu);
40
+ var _default = exports.default = TableMenu;
@@ -95,4 +95,4 @@ const TextAlignMenu = _ref => {
95
95
  }));
96
96
  }))));
97
97
  };
98
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(TextAlignMenu);
98
+ var _default = exports.default = TextAlignMenu;
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _reactI18next = require("react-i18next");
10
9
  var _commons = require("../../../commons");
11
10
  var _constants = require("../../../constants");
12
11
  var _menusConfig = require("../../../constants/menus-config");
@@ -69,4 +68,4 @@ const CommentEditorTextStyleMenuList = _ref => {
69
68
  key: index
70
69
  }, itemProps))));
71
70
  };
72
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(CommentEditorTextStyleMenuList);
71
+ var _default = exports.default = CommentEditorTextStyleMenuList;
@@ -25,12 +25,14 @@ var _helpers3 = require("../helpers");
25
25
  const TextStyleMenuList = _ref => {
26
26
  let {
27
27
  editor,
28
- t,
29
28
  isRichEditor,
30
29
  className,
31
30
  idPrefix,
32
31
  readonly
33
32
  } = _ref;
33
+ const {
34
+ t
35
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
34
36
  let selectedFontSize = (0, _helpers.getFontSize)(editor);
35
37
  let selectedFontSizeValue = selectedFontSize;
36
38
  const enableSeafileAI = _context.default.getSetting('enableSeafileAI');
@@ -159,4 +161,4 @@ const TextStyleMenuList = _ref => {
159
161
  isRichEditor: isRichEditor
160
162
  }));
161
163
  };
162
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(TextStyleMenuList);
164
+ var _default = exports.default = TextStyleMenuList;
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.renderVideo = renderVideo;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _reactI18next = require("react-i18next");
10
9
  var _slate = require("@seafile/slate");
11
10
  var _slateReact = require("@seafile/slate-react");
12
11
  var _helpers = require("./helpers");
@@ -128,7 +127,7 @@ const Video = _ref => {
128
127
  }
129
128
  }))));
130
129
  };
131
- const SdocVideo = (0, _reactI18next.withTranslation)('sdoc-editor')(Video);
130
+ const SdocVideo = Video;
132
131
  function renderVideo(props, editor) {
133
132
  const {
134
133
  element,
@@ -10,10 +10,10 @@ var _reactI18next = require("react-i18next");
10
10
  var _reactstrap = require("reactstrap");
11
11
  var _basicSdk = require("../../basic-sdk");
12
12
  require("./error-page.css");
13
- function ErrorPage(_ref) {
14
- let {
13
+ function ErrorPage() {
14
+ const {
15
15
  t
16
- } = _ref;
16
+ } = (0, _reactI18next.useTranslation)('sdoc-editor');
17
17
  const normalizeSdoc = (0, _react.useCallback)(async () => {
18
18
  const res = await _basicSdk.context.normalizeSdocContent();
19
19
  const {
@@ -33,4 +33,4 @@ function ErrorPage(_ref) {
33
33
  onClick: () => normalizeSdoc()
34
34
  }, t('Repair')));
35
35
  }
36
- var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(ErrorPage);
36
+ var _default = exports.default = ErrorPage;
@@ -41,6 +41,24 @@ const SeafileCommentEditor = _ref => {
41
41
  _basicSdk.context.init(settings, api);
42
42
  return /*#__PURE__*/_react.default.createElement(_reactI18next.I18nextProvider, {
43
43
  i18n: (0, _i18n.getI18n)(lang || 'en')
44
- }, /*#__PURE__*/_react.default.createElement("div", null, "123"));
44
+ }, /*#__PURE__*/_react.default.createElement(_errorBoundary.default, null, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentProvider, {
45
+ type: type,
46
+ className: className,
47
+ pluginName: pluginName,
48
+ pluginEventBus: pluginEventBus,
49
+ pluginEvent: pluginEvent,
50
+ collaborators: collaborators,
51
+ participants: participants,
52
+ addParticipants: addParticipants
53
+ }, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentEditor, {
54
+ content: content,
55
+ insertContent: insertContent,
56
+ onContentChange: onContentChange,
57
+ hiddenUserInfo: hiddenUserInfo,
58
+ hiddenComment: hiddenComment,
59
+ toolMenus: toolMenus,
60
+ closePanel: closePanel,
61
+ addParticipants: addParticipants
62
+ }))));
45
63
  };
46
64
  var _default = exports.default = SeafileCommentEditor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/comment-editor",
3
- "version": "0.0.1-alpha.45",
3
+ "version": "0.0.1-alpha.46",
4
4
  "private": false,
5
5
  "description": "This is a comment editor",
6
6
  "main": "dist/index.js",