@seafile/sdoc-editor 1.0.68 → 1.0.69

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.
@@ -116,7 +116,6 @@ const GlobalComment = _ref => {
116
116
  if (contentRef.current && contentRef.current.contains(event.target)) return true;
117
117
  return false;
118
118
  }, []);
119
- console.log(commentList);
120
119
  return /*#__PURE__*/_react.default.createElement("div", {
121
120
  className: "sdoc-comment-drawer"
122
121
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -14,7 +14,6 @@ const useCommentList = () => {
14
14
  const {
15
15
  comment_list
16
16
  } = commentsInfo || {};
17
- console.log(comment_list);
18
17
  const [commentType, setCommentType] = (0, _react.useState)(_constants.COMMENT_TYPES.ALL);
19
18
  const [commentList, setCommentList] = (0, _react.useState)([]);
20
19
  (0, _react.useEffect)(() => {
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.PLUGIN_DISPLAY_TYPE = exports.PLUGIN_BTN_POSITION = void 0;
7
7
  const PLUGIN_DISPLAY_TYPE = exports.PLUGIN_DISPLAY_TYPE = {
8
- INLAY_RIGHT: 'inlay-right',
8
+ RIGHT_PANEL: 'right-panel',
9
9
  DIALOG: 'dialog'
10
10
  };
11
11
  const PLUGIN_BTN_POSITION = exports.PLUGIN_BTN_POSITION = {
@@ -9,6 +9,7 @@ exports.default = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _hooks = require("../../hooks");
11
11
  var _resizeWidth = _interopRequireDefault(require("./resize-width"));
12
+ var _constants = require("../constants");
12
13
  require("./index.css");
13
14
  const MIN_PANEL_WIDTH = 360;
14
15
  const MAX_PANEL_WIDTH = 620;
@@ -21,7 +22,6 @@ const RightPanel = _ref => {
21
22
  displayPluginName,
22
23
  closePlugin
23
24
  } = (0, _hooks.usePlugins)();
24
- const panelWrapperRef = (0, _react.useRef)(null);
25
25
  const {
26
26
  collaborators
27
27
  } = (0, _hooks.useCollaborators)();
@@ -41,7 +41,7 @@ const RightPanel = _ref => {
41
41
  }, [width, displayPluginName]);
42
42
  const resizeWidth = (0, _react.useCallback)(width => {
43
43
  setWidth(width);
44
- }, [panelWrapperRef]);
44
+ }, []);
45
45
  const resizeWidthEnd = (0, _react.useCallback)(width => {
46
46
  const panelWidth = JSON.parse(window.localStorage.getItem('sdoc-panel-width', '{}'));
47
47
  window.localStorage.setItem('sdoc-panel-width', JSON.stringify({
@@ -57,11 +57,11 @@ const RightPanel = _ref => {
57
57
  if (!displayPluginName) return null;
58
58
  const plugin = plugins.find(p => p.name === displayPluginName);
59
59
  if (!plugin) return null;
60
- const Component = plugin.Component;
60
+ if (plugin.display_type && plugin.display_type !== _constants.PLUGIN_DISPLAY_TYPE.RIGHT_PANEL) return null;
61
+ const Component = plugin.component;
61
62
  if (!Component) return null;
62
63
  return /*#__PURE__*/_react.default.createElement("div", {
63
64
  className: "sdoc-content-right-panel-wrapper",
64
- ref: panelWrapperRef,
65
65
  style: panelWrapperStyle
66
66
  }, plugin.resizable_width && /*#__PURE__*/_react.default.createElement(_resizeWidth.default, {
67
67
  minWidth: MIN_PANEL_WIDTH,
@@ -10,6 +10,7 @@ var _react = _interopRequireWildcard(require("react"));
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _hooks = require("../../hooks");
12
12
  var _mouseEvent = require("../../basic-sdk/utils/mouse-event");
13
+ var _constants = require("../../basic-sdk/constants");
13
14
  const PluginsOperations = () => {
14
15
  const {
15
16
  plugins,
@@ -19,7 +20,7 @@ const PluginsOperations = () => {
19
20
  (0, _mouseEvent.eventStopPropagation)(event);
20
21
  updateDisplayPlugin(pluginName);
21
22
  }, [updateDisplayPlugin]);
22
- return plugins.map(plugin => {
23
+ return plugins.filter(plugin => !plugin.position || plugin.position === _constants.PLUGIN_BTN_POSITION.DEFAULT).map(plugin => {
23
24
  const {
24
25
  name,
25
26
  icon
@@ -26,10 +26,9 @@ const PluginsProvider = _ref => {
26
26
  allPlugins.push({
27
27
  name: 'sdoc-comment',
28
28
  icon: 'sdoc-comments',
29
- position: '',
30
29
  resizable_width: true,
31
- display_type: 'inlay-right',
32
- Component: _comment.default
30
+ display_type: _constants.PLUGIN_DISPLAY_TYPE.RIGHT_PANEL,
31
+ component: _comment.default
33
32
  });
34
33
  }
35
34
  return allPlugins;
@@ -40,7 +39,7 @@ const PluginsProvider = _ref => {
40
39
  return;
41
40
  }
42
41
  const plugin = plugins.find(plugin => plugin.name === name);
43
- if ((plugin === null || plugin === void 0 ? void 0 : plugin.display_type) === _constants.PLUGIN_DISPLAY_TYPE.INLAY_RIGHT) {
42
+ if ((plugin === null || plugin === void 0 ? void 0 : plugin.display_type) === _constants.PLUGIN_DISPLAY_TYPE.RIGHT_PANEL) {
44
43
  setDisplayName(name);
45
44
  }
46
45
  }, [displayName, plugins]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.68",
3
+ "version": "1.0.69",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -1,14 +0,0 @@
1
- .sdoc-notification-container .sdoc-notification-count {
2
- position: absolute;
3
- color: #fff;
4
- font-size: 12px;
5
- top: -7px;
6
- right: -10px;
7
- padding: 2px;
8
- background: #fc6440;
9
- border-radius: 50%;
10
- min-width: 20px;
11
- min-height: 20px;
12
- transform: scale(.7);
13
- text-align: center;
14
- }
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = CommentsOperation;
8
- var _react = _interopRequireWildcard(require("react"));
9
- var _basicSdk = require("../../../basic-sdk");
10
- var _mouseEvent = require("../../../basic-sdk/utils/mouse-event");
11
- var _constants = require("../../../basic-sdk/constants");
12
- require("./index.css");
13
- function CommentsOperation() {
14
- const [unseenNotificationsCount, setUnseenNotificationsCount] = (0, _react.useState)(0);
15
- const onCommentsToggle = (0, _react.useCallback)(event => {
16
- (0, _mouseEvent.eventStopPropagation)(event);
17
- const eventBus = _basicSdk.EventBus.getInstance();
18
- eventBus.dispatch(_constants.INTERNAL_EVENT.COMMENT_LIST_CLICK);
19
- }, []);
20
- (0, _react.useEffect)(() => {
21
- const eventBus = _basicSdk.EventBus.getInstance();
22
- const unsubscribeUnseenNotificationsCount = eventBus.subscribe(_constants.INTERNAL_EVENT.UNSEEN_NOTIFICATIONS_COUNT, count => setUnseenNotificationsCount(count));
23
- return () => {
24
- unsubscribeUnseenNotificationsCount();
25
- };
26
- // eslint-disable-next-line react-hooks/exhaustive-deps
27
- }, []);
28
- return /*#__PURE__*/_react.default.createElement("span", {
29
- className: "op-item sdoc-notification-container",
30
- onClick: onCommentsToggle
31
- }, /*#__PURE__*/_react.default.createElement("i", {
32
- className: "sdocfont sdoc-comments"
33
- }), unseenNotificationsCount > 0 && /*#__PURE__*/_react.default.createElement("span", {
34
- className: "sdoc-notification-count"
35
- }, unseenNotificationsCount));
36
- }