@seafile/comment-editor 0.0.1-alpha.41 → 0.0.1-alpha.42

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.
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _reactI18next = require("react-i18next");
9
+ var _i18next = _interopRequireDefault(require("i18next"));
10
+ var _i18nextBrowserLanguagedetector = _interopRequireDefault(require("i18next-browser-languagedetector"));
11
+ var _i18nextHttpBackend = _interopRequireDefault(require("i18next-http-backend"));
12
+ var _window;
13
+ let {
14
+ lang
15
+ } = (_window = window) !== null && _window !== void 0 && _window.seafile ? window.seafile : window.seafileConfig;
16
+ lang = lang === 'zh-cn' ? 'zh_cn' : lang;
17
+ _i18next.default.use(_i18nextHttpBackend.default).use(_i18nextBrowserLanguagedetector.default).use(_reactI18next.initReactI18next).init({
18
+ lng: lang,
19
+ fallbackLng: 'en',
20
+ ns: ['sdoc-editor'],
21
+ defaultNS: 'sdoc-editor',
22
+ debug: false,
23
+ // console log if debug: true
24
+
25
+ whitelist: ['en', 'zh_CN', 'fr', 'de', 'cs', 'es', 'es-AR', 'es-MX', 'ru'],
26
+ backend: {
27
+ loadPath: '/public/locales/{{ lng }}/{{ ns }}.json'
28
+ },
29
+ interpolation: {
30
+ escapeValue: false // not needed for react!!
31
+ },
32
+ react: {
33
+ wait: true
34
+ }
35
+ });
36
+ var _default = exports.default = _i18next.default;
@@ -4,17 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- Object.defineProperty(exports, "Notification", {
8
- enumerable: true,
9
- get: function () {
10
- return _notification.default;
11
- }
12
- });
13
7
  Object.defineProperty(exports, "User", {
14
8
  enumerable: true,
15
9
  get: function () {
16
10
  return _user.default;
17
11
  }
18
12
  });
19
- var _user = _interopRequireDefault(require("./user"));
20
- var _notification = _interopRequireDefault(require("./notification"));
13
+ var _user = _interopRequireDefault(require("./user"));
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
+ var _reactI18next = require("react-i18next");
9
10
  var _basicSdk = require("../basic-sdk");
10
- // import ErrorBoundary from '../components/error-boundary';
11
-
11
+ var _i18n = _interopRequireDefault(require("../_i18n"));
12
+ var _errorBoundary = _interopRequireDefault(require("../components/error-boundary"));
12
13
  const SeafileCommentEditor = _ref => {
13
14
  let {
14
15
  // Provider
@@ -35,29 +36,26 @@ const SeafileCommentEditor = _ref => {
35
36
  api
36
37
  } = _ref;
37
38
  _basicSdk.context.init(settings, api);
38
- return (
39
- /*#__PURE__*/
40
- // <ErrorBoundary>
41
- _react.default.createElement(_basicSdk.CommentProvider, {
42
- type: type,
43
- className: className,
44
- pluginName: pluginName,
45
- pluginEventBus: pluginEventBus,
46
- pluginEvent: pluginEvent,
47
- collaborators: collaborators,
48
- participants: participants,
49
- addParticipants: addParticipants
50
- }, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentEditor, {
51
- content: content,
52
- insertContent: insertContent,
53
- onContentChange: onContentChange,
54
- hiddenUserInfo: hiddenUserInfo,
55
- hiddenComment: hiddenComment,
56
- toolMenus: toolMenus,
57
- closePanel: closePanel,
58
- addParticipants: addParticipants
59
- }))
60
- // </ErrorBoundary>
61
- );
39
+ return /*#__PURE__*/_react.default.createElement(_errorBoundary.default, null, /*#__PURE__*/_react.default.createElement(_reactI18next.I18nextProvider, {
40
+ i18n: _i18n.default
41
+ }, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentProvider, {
42
+ type: type,
43
+ className: className,
44
+ pluginName: pluginName,
45
+ pluginEventBus: pluginEventBus,
46
+ pluginEvent: pluginEvent,
47
+ collaborators: collaborators,
48
+ participants: participants,
49
+ addParticipants: addParticipants
50
+ }, /*#__PURE__*/_react.default.createElement(_basicSdk.CommentEditor, {
51
+ content: content,
52
+ insertContent: insertContent,
53
+ onContentChange: onContentChange,
54
+ hiddenUserInfo: hiddenUserInfo,
55
+ hiddenComment: hiddenComment,
56
+ toolMenus: toolMenus,
57
+ closePanel: closePanel,
58
+ addParticipants: addParticipants
59
+ }))));
62
60
  };
63
61
  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.41",
3
+ "version": "0.0.1-alpha.42",
4
4
  "private": false,
5
5
  "description": "This is a comment editor",
6
6
  "main": "dist/index.js",
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _utils = require("../comment/utils");
8
- class Notification {
9
- constructor(options) {
10
- var _options$detail, _options$detail2, _options$detail3;
11
- this.id = options.id || '';
12
- this.comment_id = (options === null || options === void 0 ? void 0 : (_options$detail = options.detail) === null || _options$detail === void 0 ? void 0 : _options$detail.comment_id) || '';
13
- this.reply_id = (options === null || options === void 0 ? void 0 : (_options$detail2 = options.detail) === null || _options$detail2 === void 0 ? void 0 : _options$detail2.reply_id) || '';
14
- this.type = (options === null || options === void 0 ? void 0 : (_options$detail3 = options.detail) === null || _options$detail3 === void 0 ? void 0 : _options$detail3.msg_type) || '';
15
- this.key = this.type !== 'reply' ? (0, _utils.generatorNotificationKey)(this.comment_id) : (0, _utils.generatorNotificationKey)(this.comment_id, this.reply_id);
16
- }
17
- }
18
- var _default = exports.default = Notification;