@seafile/seafile-sdoc-editor 2.0.51 → 2.0.53

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.
@@ -25,6 +25,7 @@ var EXTERNAL_EVENT = exports.EXTERNAL_EVENT = {
25
25
  // wiki
26
26
  CREATE_SDOC_FILE: _sdocEditor.INTERNAL_EVENT.CREATE_SDOC_FILE,
27
27
  CREATE_WIKI_PAGE: _sdocEditor.INTERNAL_EVENT.CREATE_WIKI_PAGE,
28
+ UNSEEN_NOTIFICATIONS_COUNT: _sdocEditor.INTERNAL_EVENT.UNSEEN_NOTIFICATIONS_COUNT,
28
29
  // document
29
30
  IMAGE_COLUMN_TOGGLE: _sdocEditor.INTERNAL_EVENT.IMAGE_COLUMN_TOGGLE,
30
31
  COLLABORATORS_UPDATED: 'collaborators_updated',
package/dist/index.js CHANGED
@@ -22,6 +22,12 @@ Object.defineProperty(exports, "EXTERNAL_EVENT", {
22
22
  return _constants.EXTERNAL_EVENT;
23
23
  }
24
24
  });
25
+ Object.defineProperty(exports, "ErrorBoundary", {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _errorBoundary["default"];
29
+ }
30
+ });
25
31
  Object.defineProperty(exports, "EventBus", {
26
32
  enumerable: true,
27
33
  get: function get() {
@@ -72,6 +78,7 @@ Object.defineProperty(exports, "WikiViewer", {
72
78
  });
73
79
  var _sdocEditor = require("@seafile/sdoc-editor");
74
80
  var _docInfo = _interopRequireDefault(require("./components/doc-info"));
81
+ var _errorBoundary = _interopRequireDefault(require("./components/error-boundary"));
75
82
  var _constants = require("./constants");
76
83
  var _diffViewer = _interopRequireDefault(require("./pages/diff-viewer"));
77
84
  var _publishedRevisionViewer = _interopRequireDefault(require("./pages/published-revision-viewer"));
@@ -15,7 +15,11 @@ var SdocWikiEditor = function SdocWikiEditor(_ref) {
15
15
  var document = _ref.document,
16
16
  docUuid = _ref.docUuid,
17
17
  isWikiReadOnly = _ref.isWikiReadOnly,
18
- scrollRef = _ref.scrollRef;
18
+ scrollRef = _ref.scrollRef,
19
+ collaborators = _ref.collaborators,
20
+ showComment = _ref.showComment,
21
+ isShowRightPanel = _ref.isShowRightPanel,
22
+ setEditor = _ref.setEditor;
19
23
  _sdocEditor.context.initApi();
20
24
  var validEditor = (0, _react.useMemo)(function () {
21
25
  var defaultEditor = (0, _sdocEditor.createWikiEditor)();
@@ -39,6 +43,12 @@ var SdocWikiEditor = function SdocWikiEditor(_ref) {
39
43
 
40
44
  // eslint-disable-next-line react-hooks/exhaustive-deps
41
45
  }, [docUuid]);
46
+ (0, _react.useEffect)(function () {
47
+ if (setEditor && validEditor && isShowRightPanel) {
48
+ validEditor.editorType = _sdocEditor.WIKI_EDITOR;
49
+ setEditor(validEditor);
50
+ }
51
+ }, [setEditor, validEditor, isShowRightPanel]);
42
52
  (0, _react.useEffect)(function () {
43
53
  if (isWikiReadOnly) return;
44
54
  validEditor.openConnection();
@@ -46,12 +56,24 @@ var SdocWikiEditor = function SdocWikiEditor(_ref) {
46
56
  validEditor.closeConnection();
47
57
  };
48
58
  }, [isWikiReadOnly, validEditor]);
49
- return /*#__PURE__*/_react["default"].createElement(_errorBoundary["default"], null, /*#__PURE__*/_react["default"].createElement(_sdocEditor.WikiEditor, {
59
+
60
+ // If you don't display comment, use Fragment to replace CommentProvider
61
+ var WithCommentProvider = showComment ? _sdocEditor.CommentContextProvider : _react.Fragment;
62
+ return /*#__PURE__*/_react["default"].createElement(_errorBoundary["default"], null, /*#__PURE__*/_react["default"].createElement(_sdocEditor.CollaboratorsProvider, {
63
+ collaborators: collaborators
64
+ }, /*#__PURE__*/_react["default"].createElement(_sdocEditor.PluginsProvider, {
65
+ plugins: [],
66
+ showComment: showComment
67
+ }, /*#__PURE__*/_react["default"].createElement(WithCommentProvider, showComment && {
68
+ editor: validEditor
69
+ }, /*#__PURE__*/_react["default"].createElement(_sdocEditor.WikiEditor, {
50
70
  document: document,
51
71
  docUuid: docUuid,
52
72
  editor: validEditor,
53
73
  isWikiReadOnly: isWikiReadOnly,
54
- scrollRef: scrollRef
55
- }));
74
+ scrollRef: scrollRef,
75
+ showComment: showComment,
76
+ isShowRightPanel: isShowRightPanel
77
+ })))));
56
78
  };
57
79
  var _default = exports["default"] = (0, _reactI18next.withTranslation)('sdoc-editor')(SdocWikiEditor);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-sdoc-editor",
3
- "version": "2.0.51",
3
+ "version": "2.0.53",
4
4
  "author": "shuntian <978987373@qq.com>",
5
5
  "homepage": "https://github.com/seafileltd/sea-sdoc-editor#readme",
6
6
  "license": "ISC",
@@ -29,7 +29,7 @@
29
29
  "description": "",
30
30
  "dependencies": {
31
31
  "@seafile/print-js": "1.6.6",
32
- "@seafile/sdoc-editor": "^2.0.134",
32
+ "@seafile/sdoc-editor": "^2.0.136",
33
33
  "classnames": "2.3.2",
34
34
  "dayjs": "1.10.7"
35
35
  },
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "5ab8c21594b1d82f829e8d8fe6fa39954e2ed463"
48
+ "gitHead": "b853c017655f8db5ec240d17d67055aa532472b7"
49
49
  }