@seafile/sdoc-editor 2.0.189 → 2.0.191

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.
@@ -221,6 +221,7 @@
221
221
  background-color: rgb(153 153 153 / 15%);
222
222
  padding: 3px 0;
223
223
  border-radius: 3px;
224
+ cursor: pointer;
224
225
  }
225
226
 
226
227
  /* code_block */
@@ -65,23 +65,9 @@ var EditableArticle = function EditableArticle(_ref) {
65
65
  }
66
66
 
67
67
  // Remove linked block overlay style when operating
68
- var _Editor$nodes = _slate.Editor.nodes(editor, {
69
- at: [],
70
- match: function match(n) {
71
- return n.linked_block === true;
72
- }
73
- }),
74
- _Editor$nodes2 = (0, _slicedToArray2["default"])(_Editor$nodes, 1),
75
- linkedNodeEntry = _Editor$nodes2[0];
76
- if (linkedNodeEntry) {
77
- var _linkedNodeEntry = (0, _slicedToArray2["default"])(linkedNodeEntry, 2),
78
- node = _linkedNodeEntry[0],
79
- path = _linkedNodeEntry[1];
80
- var linkedDomNode = _slateReact.ReactEditor.toDOMNode(editor, node);
81
- linkedDomNode.classList.remove('linked-block-highlight-overlay');
82
- _slate.Transforms.unsetNodes(editor, ['linked_block'], {
83
- at: path
84
- });
68
+ var highlightedNode = document.querySelector('.linked-block-highlight-overlay');
69
+ if (highlightedNode) {
70
+ highlightedNode.classList.remove('linked-block-highlight-overlay');
85
71
  }
86
72
  // eslint-disable-next-line react-hooks/exhaustive-deps
87
73
  }, []);
@@ -354,14 +340,14 @@ var EditableArticle = function EditableArticle(_ref) {
354
340
  editor.oldSelection = (0, _objectSpread2["default"])({}, selection);
355
341
 
356
342
  // Do not scroll into view, when focus on image
357
- var _Editor$nodes3 = _slate.Editor.nodes(editor, {
343
+ var _Editor$nodes = _slate.Editor.nodes(editor, {
358
344
  match: function match(n) {
359
345
  return [_constants2.IMAGE, _constants2.IMAGE_BLOCK].includes(n.type);
360
346
  },
361
347
  at: selection
362
348
  }),
363
- _Editor$nodes4 = (0, _slicedToArray2["default"])(_Editor$nodes3, 1),
364
- imageNodeEntry = _Editor$nodes4[0];
349
+ _Editor$nodes2 = (0, _slicedToArray2["default"])(_Editor$nodes, 1),
350
+ imageNodeEntry = _Editor$nodes2[0];
365
351
  if (imageNodeEntry) return;
366
352
  var focusedNode = _slate.Node.get(editor, selection.focus.path);
367
353
  var domNode = _slateReact.ReactEditor.toDOMNode(editor, focusedNode);
@@ -13,7 +13,7 @@
13
13
 
14
14
  .sdoc-file-preview-drawer .file-preview-panel-header {
15
15
  padding: 0 16px;
16
- height: 46px;
16
+ height: 44px;
17
17
  display: flex;
18
18
  align-items: center;
19
19
  justify-content: space-between;
@@ -47,7 +47,7 @@ var ListView = function ListView(_ref) {
47
47
  (0, _react.useEffect)(function () {
48
48
  var getFileMetadata = /*#__PURE__*/function () {
49
49
  var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regenerator2["default"])().m(function _callee() {
50
- var res, sortedRecords, firstFile, filePath;
50
+ var res, sortedRecords;
51
51
  return (0, _regenerator2["default"])().w(function (_context) {
52
52
  while (1) switch (_context.n) {
53
53
  case 0:
@@ -61,15 +61,6 @@ var ListView = function ListView(_ref) {
61
61
  });
62
62
  setAllFileList(sortedRecords);
63
63
  setFileList(sortedRecords);
64
- firstFile = sortedRecords[0];
65
- if (firstFile) {
66
- filePath = (firstFile._parent_dir === '/' ? '' : firstFile._parent_dir) + '/' + firstFile._name;
67
- onSelectFile(null, {
68
- id: firstFile._id,
69
- name: firstFile._name,
70
- path: filePath
71
- });
72
- }
73
64
  case 2:
74
65
  return _context.a(2);
75
66
  }
@@ -5,6 +5,10 @@
5
5
  border-radius: 3px;
6
6
  }
7
7
 
8
+ .sdoc-file-link-render:hover {
9
+ cursor: pointer;
10
+ }
11
+
8
12
  .sdoc-file-link-render:hover .sdoc-file-text-link a {
9
13
  text-decoration: underline;
10
14
  text-underline-position: under;
@@ -44,7 +48,7 @@
44
48
 
45
49
  .sdoc-file-link-render .sdoc-file-link-icon {
46
50
  padding-right: 5px;
47
- color: #ff9800;
51
+ color: #9aa0ac;
48
52
  }
49
53
 
50
54
  .sdoc-file-card-link .sdoc-file-link-icon :first-child {
@@ -53,22 +53,17 @@ var LinkHover = function LinkHover(_ref) {
53
53
  _Editor$nodes2 = (0, _slicedToArray2["default"])(_Editor$nodes, 1),
54
54
  linkedNodeEntry = _Editor$nodes2[0];
55
55
  if (linkedNodeEntry) {
56
- var _linkedNodeEntry = (0, _slicedToArray2["default"])(linkedNodeEntry, 2),
57
- node = _linkedNodeEntry[0],
58
- path = _linkedNodeEntry[1];
56
+ var node = linkedNodeEntry[0];
59
57
  var linkedDomNode = _slateReact.ReactEditor.toDOMNode(editor, node);
60
58
  linkedDomNode.classList.add('linked-block-highlight-overlay');
61
- _slate.Transforms.setNodes(editor, {
62
- linked_block: true
63
- }, {
64
- at: path
65
- });
66
59
 
67
60
  // Scroll linked node to view if not in current view
68
61
  if (!(0, _helpers.isNodeInCurrentView)(linkedDomNode)) {
69
62
  linkedDomNode.scrollIntoView();
70
63
  }
71
64
  }
65
+
66
+ // eslint-disable-next-line react-hooks/exhaustive-deps
72
67
  }, [linked_id]);
73
68
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react["default"].createElement("div", {
74
69
  id: "link-op-menu",
@@ -75,18 +75,22 @@ var SdocLinkHoverMenu = function SdocLinkHoverMenu(_ref) {
75
75
  var doc_uuid = element.doc_uuid,
76
76
  title = element.title,
77
77
  type = element.type;
78
- var eventBus = _eventBus["default"].getInstance();
79
- eventBus.dispatch(_constants.INTERNAL_EVENT.TRANSFER_PREVIEW_FILE_ID, {
78
+ var data = {
80
79
  doc_uuid: doc_uuid,
81
80
  title: title,
82
81
  type: type
83
- });
82
+ };
83
+ if (editor.editorType === _constants.WIKI_EDITOR) {
84
+ data = element;
85
+ }
86
+ var eventBus = _eventBus["default"].getInstance();
87
+ eventBus.dispatch(_constants.INTERNAL_EVENT.TRANSFER_PREVIEW_FILE_ID, data);
84
88
  setTimeout(function () {
85
89
  onHideInsertHoverMenu();
86
90
  }, 0);
91
+ // eslint-disable-next-line react-hooks/exhaustive-deps
87
92
  }, [updateDisplayPlugin]);
88
93
  var selectedType = element.display_type || _constants2.SDOC_LINK_TYPE.TEXT_LINK;
89
- var id = "sdoc-link-display-type-".concat(element.id);
90
94
  var newSdocFileTypes = _constants2.SDOC_LINK_TYPES.filter(function (sdocLinkType) {
91
95
  return (0, _helpers.isInTable)(editor, element) ? sdocLinkType !== _constants2.SDOC_LINK_TYPE.CARD_LINK : true;
92
96
  });
@@ -154,7 +158,7 @@ var SdocLinkHoverMenu = function SdocLinkHoverMenu(_ref) {
154
158
  return handleOpenLinkPreview('sdoc-file-preview');
155
159
  }
156
160
  }, /*#__PURE__*/_react["default"].createElement("i", {
157
- className: "sdocfont sodc-eye icon-font"
161
+ className: "sdocfont sdoc-eye icon-font"
158
162
  })), isShowTooltip && /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
159
163
  target: "sdoc_link_preview",
160
164
  placement: "top",
@@ -5,6 +5,10 @@
5
5
  border-radius: 3px;
6
6
  }
7
7
 
8
+ .sdoc-file-render:hover {
9
+ cursor: pointer;
10
+ }
11
+
8
12
  .sdoc-file-render:hover .sdoc-file-text-link a {
9
13
  text-decoration: underline;
10
14
  text-underline-position: under;
@@ -27,7 +31,7 @@
27
31
 
28
32
  .sdoc-file-render .sdoc-file-link-icon {
29
33
  padding-right: 5px;
30
- color: #ff9800;
34
+ color: #666;
31
35
  }
32
36
 
33
37
  .sdoc-file-card-link .sdoc-file-link-icon :first-child {
@@ -125,18 +125,22 @@ var SdocFileLink = function SdocFileLink(_ref) {
125
125
  return;
126
126
  }
127
127
  }
128
- if (isShowInsertHoverMenu && element.type === _elementType.SDOC_LINK) {
128
+ if (isShowInsertHoverMenu && [_elementType.SDOC_LINK, _elementType.WIKI_LINK].includes(element.type)) {
129
129
  e.stopPropagation();
130
- updateDisplayPlugin('sdoc-file-preview', true);
130
+ element.type === _elementType.SDOC_LINK && updateDisplayPlugin('sdoc-file-preview', true);
131
131
  var doc_uuid = element.doc_uuid,
132
132
  title = element.title,
133
133
  type = element.type;
134
- var eventBus = _eventBus["default"].getInstance();
135
- eventBus.dispatch(_constants.INTERNAL_EVENT.TRANSFER_PREVIEW_FILE_ID, {
134
+ var data = {
136
135
  doc_uuid: doc_uuid,
137
136
  title: title,
138
137
  type: type
139
- });
138
+ };
139
+ if (element.type === _elementType.WIKI_LINK) {
140
+ data = element;
141
+ }
142
+ var eventBus = _eventBus["default"].getInstance();
143
+ eventBus.dispatch(_constants.INTERNAL_EVENT.TRANSFER_PREVIEW_FILE_ID, data);
140
144
  setTimeout(function () {
141
145
  onHideInsertHoverMenu();
142
146
  }, 0);
@@ -17,8 +17,7 @@ var _fullWidthMode = require("../utils/full-width-mode");
17
17
  var _localStorageUtils = _interopRequireDefault(require("../utils/local-storage-utils"));
18
18
  function ArticleContainer(_ref) {
19
19
  var editor = _ref.editor,
20
- children = _ref.children,
21
- isShowCommentPanelInWiki = _ref.isShowCommentPanelInWiki;
20
+ children = _ref.children;
22
21
  var scrollRef = (0, _useScrollContext.useScrollContext)();
23
22
  var articleRef = (0, _react.useRef)(null);
24
23
  var _useState = (0, _react.useState)({}),
@@ -111,6 +111,7 @@ var RightPanel = function RightPanel(_ref) {
111
111
  return function () {
112
112
  unsubscribeTransferFileId();
113
113
  };
114
+ // eslint-disable-next-line react-hooks/exhaustive-deps
114
115
  }, []);
115
116
  if (!displayPluginName) return null;
116
117
  var plugin = plugins.find(function (p) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "2.0.189",
3
+ "version": "2.0.191",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -71,5 +71,5 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "59450c9add50eee2fd988db15cc9b11091a09034"
74
+ "gitHead": "c558ebae65cc4325ebc6ad0d4989ae889d4f420d"
75
75
  }