@seafile/sdoc-editor 3.0.121 → 3.0.123

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.
@@ -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.useCursorPosition = exports.updateElementsAttrs = exports.updateCommentedElementsAttrs = exports.getSelectionRange = exports.getSelectedElemIds = exports.getPrimaryElementId = exports.getElementCommentCountTop = exports.getDomById = exports.getCursorPosition = exports.getCommentedTextsByElementId = exports.getAvatarUrl = exports.commentContainerWikiTransfer = void 0;
7
+ exports.useCursorPosition = exports.updateElementsAttrs = exports.updateCommentedElementsAttrs = exports.getWikiHeaderHeight = exports.getSelectionRange = exports.getSelectedElemIds = exports.getPrimaryElementId = exports.getElementCommentCountTop = exports.getDomById = exports.getCursorPosition = exports.getCommentedTextsByElementId = exports.getAvatarUrl = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
10
10
  var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createForOfIteratorHelper"));
@@ -57,23 +57,13 @@ var getAvatarUrl = exports.getAvatarUrl = function getAvatarUrl() {
57
57
  var avatarUrl = "".concat(server, "/media/avatars/default.png");
58
58
  return avatarUrl;
59
59
  };
60
- var commentContainerWikiTransfer = exports.commentContainerWikiTransfer = function commentContainerWikiTransfer(result, value) {
61
- var newResult;
62
- var isWikiTitleIcon = document.querySelector('.wiki-page-icon-wrapper');
63
- var isWikiTitleCover = document.getElementById('wiki-page-cover');
64
- if (isWikiTitleIcon && !isWikiTitleCover) {
65
- // 90 is icon height in wiki
66
- newResult = result - value - 90;
67
- } else if (!isWikiTitleIcon && isWikiTitleCover) {
68
- // 203 is icon height in wiki
69
- newResult = result - value - 203;
70
- } else if (isWikiTitleIcon && isWikiTitleCover) {
71
- // 205 is icon and cover height in wiki
72
- newResult = result - value - 205;
73
- } else {
74
- newResult = result - value;
75
- }
76
- return newResult;
60
+ var getWikiHeaderHeight = exports.getWikiHeaderHeight = function getWikiHeaderHeight() {
61
+ var pageCover = window.document.getElementById('wiki-page-cover');
62
+ var pageCoverHeight = (pageCover === null || pageCover === void 0 ? void 0 : pageCover.offsetHeight) || 0;
63
+ var pageTitle = window.document.getElementById('wiki-page-title');
64
+ var pageTitleHeight = (pageTitle === null || pageTitle === void 0 ? void 0 : pageTitle.offsetHeight) || 0;
65
+ var topNavHeight = 44;
66
+ return pageCoverHeight + pageTitleHeight + topNavHeight;
77
67
  };
78
68
  var getElementCommentCountTop = exports.getElementCommentCountTop = function getElementCommentCountTop(editor, element, scrollTop) {
79
69
  var minY;
@@ -94,7 +84,8 @@ var getElementCommentCountTop = exports.getElementCommentCountTop = function get
94
84
  resultY = minY - 100 + scrollTop; // 100: header height(56) + toolbar height(37)
95
85
  if (editor.editorType === _constants.WIKI_EDITOR) {
96
86
  // 55 is basic top title height in wiki
97
- resultY = commentContainerWikiTransfer(resultY, 55);
87
+ var headerHight = getWikiHeaderHeight();
88
+ resultY = minY - headerHight + scrollTop;
98
89
  }
99
90
  return resultY;
100
91
  };
@@ -27,13 +27,13 @@
27
27
  border-radius: 4px;
28
28
  }
29
29
 
30
- .sdoc-file-view-container .sdoc-file-view-content {
30
+ /* .sdoc-file-view-container .sdoc-file-view-content {
31
31
  height: 400px;
32
32
  }
33
33
 
34
34
  .sdoc-file-view-container .sdoc-file-view-content .sea-metadata {
35
35
  height: 396px;
36
- }
36
+ } */
37
37
 
38
38
  .sdoc-file-view-container .sdoc-file-view-content .sea-metadata .sea-metadata-table-main-container {
39
39
  border: 1px solid #eee;
@@ -48,4 +48,5 @@
48
48
  background-color: #007bff;
49
49
  border: 1px solid #fff;
50
50
  cursor: se-resize;
51
+ display: none;
51
52
  }
@@ -49,13 +49,13 @@ var FileViewPlugin = function FileViewPlugin(_ref) {
49
49
  var viewSettings = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, settings), {}, {
50
50
  view_data: {
51
51
  wiki_id: data.wiki_id,
52
- file_view_id: data.file_view_id,
53
- height: data.height
52
+ file_view_id: data.file_view_id
53
+ // height: data.height,
54
54
  // width: data.width,
55
55
  }
56
56
  });
57
57
  return viewSettings;
58
- }, [data.file_view_id, data.height, data.wiki_id]);
58
+ }, [data.file_view_id, data.wiki_id]);
59
59
  (0, _react.useEffect)(function () {
60
60
  var copyContent = _localStorageUtils["default"].getItem(_constants.RECENT_COPY_CONTENT);
61
61
  var wikiId = _context["default"].getSetting('wikiId');
@@ -144,16 +144,7 @@ var FileViewPlugin = function FileViewPlugin(_ref) {
144
144
  'event': onResizeEnd
145
145
  }]);
146
146
  }, [onMouseMove, onResizeEnd, registerEvent]);
147
- var style = (0, _react.useMemo)(function () {
148
- var height = data.height;
149
- if (height) {
150
- return {
151
- // width,
152
- height: height
153
- };
154
- }
155
- return null;
156
- }, [data]);
147
+ console.log(viewSettings);
157
148
  return /*#__PURE__*/_react["default"].createElement("div", Object.assign({
158
149
  "data-id": element.id
159
150
  }, attributes, {
@@ -164,8 +155,7 @@ var FileViewPlugin = function FileViewPlugin(_ref) {
164
155
  className: (0, _classnames["default"])('sdoc-file-view-content', {
165
156
  'is-selected': isSelected
166
157
  }),
167
- ref: wrapperRef,
168
- style: style
158
+ ref: wrapperRef
169
159
  }, /*#__PURE__*/_react["default"].createElement(_seafileDatabase.FileView, {
170
160
  settings: viewSettings,
171
161
  ref: databaseRef,
@@ -58,8 +58,8 @@ var useCommentListPosition = exports.useCommentListPosition = function useCommen
58
58
  var topPara;
59
59
  topPara = rect.bottom - headerHeight + 10 + scrollTop;
60
60
  if (editor.editorType === _constants.WIKI_EDITOR) {
61
- // 55 is basic top title height in wiki
62
- topPara = (0, _helper.commentContainerWikiTransfer)(topPara, 55);
61
+ var wikiHeaderHight = (0, _helper.getWikiHeaderHeight)();
62
+ topPara = rect.bottom - wikiHeaderHight + 10 + scrollTop;
63
63
  }
64
64
  var rightPara = editorArticleRight - rect.left - 300; // 300 is comment container's width
65
65
  return {
@@ -73,8 +73,8 @@ var useCommentListPosition = exports.useCommentListPosition = function useCommen
73
73
  if (selectionPosition && selectionPosition.y !== 0) {
74
74
  selectionPosition.y = selectionPosition.y - headerHeight + scrollTop;
75
75
  if (editor.editorType === _constants.WIKI_EDITOR) {
76
- // 47 is top nav bar height in wiki
77
- selectionPosition.y = (0, _helper.commentContainerWikiTransfer)(selectionPosition.y, 47);
76
+ var _wikiHeaderHight = (0, _helper.getWikiHeaderHeight)();
77
+ selectionPosition.y = selectionPosition.y - _wikiHeaderHight + scrollTop;
78
78
  }
79
79
  }
80
80
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "3.0.121",
3
+ "version": "3.0.123",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -20,7 +20,7 @@
20
20
  "@seafile/comment-editor": "1.0.19",
21
21
  "@seafile/print-js": "1.6.6",
22
22
  "@seafile/react-image-lightbox": "5.0.4",
23
- "@seafile/seafile-database": "0.0.41",
23
+ "@seafile/seafile-database": "0.0.43",
24
24
  "@seafile/slate": "0.91.8",
25
25
  "@seafile/slate-history": "0.86.2",
26
26
  "@seafile/slate-hyperscript": "0.81.7",
@@ -72,5 +72,5 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "86fe08615af2e429b778e9075e7331b4dad5f77f"
75
+ "gitHead": "a9e3b6f309ad176cd1ec83997229670e75af81fc"
76
76
  }