@seafile/sdoc-editor 0.5.38 → 0.5.40

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.
@@ -1,12 +1,12 @@
1
- .sdoc-article-container .sdoc-comment-list-container {
2
- width: 312px;
3
- }
4
-
5
1
  .sdoc-comment-list-container {
6
2
  position: absolute;
7
3
  margin-top: 5px;
8
4
  }
9
5
 
6
+ .sdoc-comment-list-container .article.sdoc-comment-editor {
7
+ font-size: 14px;
8
+ }
9
+
10
10
  .sdoc-comment-list-container .comment-ui-container {
11
11
  background-color: #edf2fa;
12
12
  border-radius: 3px;
@@ -18,7 +18,7 @@
18
18
 
19
19
  .sdoc-comment-list-container .comment-ui-container.active {
20
20
  position: relative;
21
- left: -24px;
21
+ left: -5px;
22
22
  background: rgba(255, 255, 255, .92);
23
23
  box-shadow: 0 1px 3px rgba(0, 0, 0, .15), 0 4px 8px 3px rgba(0, 0, 0, .15);
24
24
  }
@@ -315,3 +315,57 @@
315
315
  padding-left: 10px;
316
316
  padding-right: 10px;
317
317
  }
318
+
319
+ /* editor Side comment preview */
320
+ .sdoc-article-container .sdoc-comment-list-container {
321
+ width: 312px;
322
+ /* font-size: 14px !important; */
323
+ }
324
+
325
+ .sdoc-article-container .comment-ui-container {
326
+ padding: 0;
327
+ margin: 0;
328
+ }
329
+
330
+ .sdoc-article-container .sdoc-comment-list-container .comment-item {
331
+ padding: 16px;
332
+ }
333
+
334
+ .sdoc-article-container .sdoc-comment-list-container .comment-item .comment-editor-wrapper.pb-3 {
335
+ padding-bottom: 0 !important;
336
+ }
337
+
338
+ .sdoc-article-container .sdoc-comment-list-container .comment-item .comment-author {
339
+ align-items: flex-start;
340
+ }
341
+
342
+ .sdoc-article-container .sdoc-comment-list-container .comment-item .comment-content {
343
+ margin-left: 33px;
344
+ }
345
+
346
+ .sdoc-article-container .sdoc-comment-list-container .comment-item .comment-author__avatar img {
347
+ margin-top: 3px;
348
+ width: 24px;
349
+ height: 24px;
350
+ }
351
+
352
+ .sdoc-article-container .sdoc-comment-list-container .comment-item .comment-author__info {
353
+ padding-left: 8px;
354
+ }
355
+
356
+ .sdoc-article-container .sdoc-comment-list-container .sdoc-reply-wrapper {
357
+ padding: 0 16px 16px;
358
+ }
359
+
360
+ .sdoc-article-container .sdoc-comment-list-container .comment-content div:last-child p {
361
+ margin-bottom: 0;
362
+ }
363
+
364
+ /* editor side comment editor */
365
+ .sdoc-article-container .sdoc-comment-list-container .comment-list .comment-ui-container.active {
366
+ padding: 0;
367
+ }
368
+
369
+ .sdoc-article-container .sdoc-comment-list-container .comment-ui-container.active {
370
+ padding: 16px;
371
+ }
@@ -4,6 +4,8 @@
4
4
  min-width: 360px;
5
5
  max-width: 620px;
6
6
  border-left: 1px solid #e2e3e6;
7
+ /* Prevent the image menu from still appearing above the comment drawer when scrolled hidden. */
8
+ z-index: 103;
7
9
  }
8
10
 
9
11
  .sdoc-comment-drawer .comments-panel-wrapper {
@@ -15,6 +15,7 @@ import { EventBus } from '../../basic-sdk';
15
15
  import { EXTERNAL_EVENT } from '../../constants';
16
16
  import CommentEditorToolbar from '../extension/toolbar/comment-editor-toolbar';
17
17
  import CommentArticle from './comment-article';
18
+ import { ScrollContext } from '../hooks/use-scroll-context';
18
19
  const SdocCommentEditor = forwardRef((_ref, ref) => {
19
20
  let {
20
21
  editor: propsEditor,
@@ -110,12 +111,16 @@ const SdocCommentEditor = forwardRef((_ref, ref) => {
110
111
  ref: commentEditorContainerRef,
111
112
  className: "article sdoc-comment-editor",
112
113
  onClick: handleFocusEditor
114
+ }, /*#__PURE__*/React.createElement(ScrollContext.Provider, {
115
+ value: {
116
+ scrollRef: commentEditorContainerRef
117
+ }
113
118
  }, /*#__PURE__*/React.createElement(CommentArticle, {
114
119
  type: type,
115
120
  editor: validEditor,
116
121
  slateValue: slateValue,
117
122
  updateSlateValue: setSlateValue
118
- })), /*#__PURE__*/React.createElement(CommentEditorToolbar, {
123
+ }))), /*#__PURE__*/React.createElement(CommentEditorToolbar, {
119
124
  editor: validEditor,
120
125
  onSubmit: onSubmit,
121
126
  submitBtnText: submitBtnText,
@@ -46,7 +46,8 @@ const InsertElementDialog = _ref => {
46
46
  slateNode,
47
47
  insertFileLinkCallback,
48
48
  insertSdocFileLinkCallback,
49
- isShowHistoryFiles
49
+ isShowHistoryFiles,
50
+ editor: paramEditor
50
51
  } = _ref2;
51
52
  setInsertPosition(insertPosition);
52
53
  setSlateNode(slateNode);
@@ -58,7 +59,7 @@ const InsertElementDialog = _ref => {
58
59
  });
59
60
  setIsShowHistoryFiles(isShowHistoryFiles);
60
61
  // Apply for comment editor, as it has a different editor instance
61
- setValidEditor(editor);
62
+ setValidEditor(paramEditor || editor);
62
63
  if (type === LOCAL_IMAGE) {
63
64
  setTimeout(() => {
64
65
  uploadLocalImageInputRef.current && uploadLocalImageInputRef.current.click();
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import classNames from 'classnames';
3
+ import './style.css';
4
+ const MenuShortcutPrompt = _ref => {
5
+ let {
6
+ shortcuts,
7
+ containerClassName = ''
8
+ } = _ref;
9
+ return /*#__PURE__*/React.createElement("div", {
10
+ className: classNames('sdoc-shortcut-prompt-container', containerClassName)
11
+ }, shortcuts.map((shortcut, index) => /*#__PURE__*/React.createElement("kbd", {
12
+ key: "sdoc-shortcut-".concat(shortcut, "-").concat(index)
13
+ }, shortcut)));
14
+ };
15
+ export default MenuShortcutPrompt;
@@ -0,0 +1,20 @@
1
+ .sdoc-shortcut-prompt-container kbd {
2
+ display: inline-block;
3
+ margin-bottom: 0px;
4
+ margin-left: 1px;
5
+ margin-right: 1px;
6
+ padding: 1px 3px;
7
+ min-width: 12px;
8
+ border-style: solid;
9
+ border-color: rgba(0, 0, 0, 0.1);
10
+ border-radius: 3px;
11
+ border-width: 1px 1px 2px;
12
+ font: inherit;
13
+ text-align: center;
14
+ color: rgb(51, 51, 51);
15
+ background-color: rgba(255, 255, 255, 0.25);
16
+ }
17
+
18
+ .sdoc-shortcut-prompt-container:last-child {
19
+ margin-right: 0px;
20
+ }
@@ -22,16 +22,18 @@ export const isMenuDisabled = (editor, readonly) => {
22
22
  return false; // enable
23
23
  };
24
24
 
25
- export const generateSdocFileNode = (uuid, text) => {
25
+ export const generateSdocFileNode = function (uuid) {
26
+ let text = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
27
+ const sdocFileName = text.replace(/\.sdoc$/, '');
26
28
  const sdocFileNode = {
27
29
  id: slugid.nice(),
28
30
  type: SDOC_LINK,
29
31
  doc_uuid: uuid,
30
- title: text,
32
+ title: sdocFileName,
31
33
  display_type: INSERT_FILE_DISPLAY_TYPE[1],
32
34
  children: [{
33
35
  id: slugid.nice(),
34
- text: text || ''
36
+ text: sdocFileName
35
37
  }]
36
38
  };
37
39
  return sdocFileNode;
@@ -87,18 +87,13 @@ const ResizeMask = _ref => {
87
87
  }
88
88
  return resizeHandlerInfo;
89
89
  }, [cellInfo, editor, maskStyle, table]);
90
- const handleMouseOver = useCallback((event, mode) => {
90
+ const handleMouseDown = useCallback((event, mode) => {
91
91
  event.stopPropagation();
92
92
  event.preventDefault();
93
- if (isDraggingResizeHandler) return;
93
+ handlerStartDragging();
94
94
  const handlerInfo = getHandlerDisplayInfo(mode);
95
95
  handleShowResizeHandler(handlerInfo);
96
- }, [getHandlerDisplayInfo, handleShowResizeHandler, isDraggingResizeHandler]);
97
- const handleMouseDown = useCallback(event => {
98
- event.stopPropagation();
99
- event.preventDefault();
100
- handlerStartDragging();
101
- }, [handlerStartDragging]);
96
+ }, [getHandlerDisplayInfo, handleShowResizeHandler, handlerStartDragging]);
102
97
  const handleMouseOut = useCallback(event => {
103
98
  event.stopPropagation();
104
99
  event.preventDefault();
@@ -110,23 +105,19 @@ const ResizeMask = _ref => {
110
105
  style: maskStyle
111
106
  }, cellInfo.rowIndex !== 0 && /*#__PURE__*/React.createElement("div", {
112
107
  onMouseOut: handleMouseOut,
113
- onMouseDown: handleMouseDown,
114
- onMouseOver: e => handleMouseOver(e, RESIZE_MASK_TOP),
108
+ onMouseDown: e => handleMouseDown(e, RESIZE_MASK_TOP),
115
109
  className: "sdoc-table-resize-top"
116
110
  }), /*#__PURE__*/React.createElement("div", {
117
111
  onMouseOut: handleMouseOut,
118
- onMouseDown: handleMouseDown,
119
- onMouseOver: e => handleMouseOver(e, RESIZE_MASK_RIGHT),
112
+ onMouseDown: e => handleMouseDown(e, RESIZE_MASK_RIGHT),
120
113
  className: "sdoc-table-resize-right"
121
114
  }), /*#__PURE__*/React.createElement("div", {
122
115
  onMouseOut: handleMouseOut,
123
- onMouseDown: handleMouseDown,
124
- onMouseOver: e => handleMouseOver(e, RESIZE_MASK_BOTTOM),
116
+ onMouseDown: e => handleMouseDown(e, RESIZE_MASK_BOTTOM),
125
117
  className: "sdoc-table-resize-bottom"
126
118
  }), /*#__PURE__*/React.createElement("div", {
127
119
  onMouseOut: handleMouseOut,
128
- onMouseDown: handleMouseDown,
129
- onMouseOver: e => handleMouseOver(e, RESIZE_MASK_LEFT),
120
+ onMouseDown: e => handleMouseDown(e, RESIZE_MASK_LEFT),
130
121
  className: "sdoc-table-resize-left"
131
122
  }));
132
123
  };
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useEffect, useState } from 'react';
1
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
2
2
  import { withTranslation } from 'react-i18next';
3
3
  import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
4
4
  import printJS from '@seafile/print-js';
@@ -6,6 +6,7 @@ import { EventBus } from '../../basic-sdk';
6
6
  import { EXTERNAL_EVENT } from '../../constants';
7
7
  import context from '../../context';
8
8
  import { INTERNAL_EVENT } from '../../basic-sdk/constants';
9
+ import MenuShortcutPrompt from '../../basic-sdk/extension/commons/menu-shortcut-indicator';
9
10
  const MoreOperations = _ref => {
10
11
  let {
11
12
  t
@@ -54,6 +55,12 @@ const MoreOperations = _ref => {
54
55
  event.nativeEvent.stopImmediatePropagation();
55
56
  window.location.href = historyURL;
56
57
  }, [docPerm, historyURL, isSdocRevision]);
58
+ const printShortCutTexts = useMemo(() => {
59
+ // chrome in Mac: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
60
+ const isMac = window.navigator.userAgent.indexOf('Macintosh') !== -1;
61
+ const printTexts = isMac ? ['⌘', 'P'] : ['Ctrl', 'P'];
62
+ return printTexts;
63
+ }, []);
57
64
  return /*#__PURE__*/React.createElement(Dropdown, {
58
65
  isOpen: isDropdownOpen,
59
66
  toggle: () => toggleDropdown(isDropdownOpen)
@@ -75,7 +82,11 @@ const MoreOperations = _ref => {
75
82
  }, t('Unfreeze')), /*#__PURE__*/React.createElement(DropdownItem, {
76
83
  className: "sdoc-dropdown-menu-item",
77
84
  onClick: handlePrint
78
- }, t('Print')), isPro && !isFreezed && /*#__PURE__*/React.createElement(DropdownItem, {
85
+ }, /*#__PURE__*/React.createElement("div", {
86
+ className: "sdoc-dropdown-print-container"
87
+ }, /*#__PURE__*/React.createElement("div", null, t('Print')), /*#__PURE__*/React.createElement(MenuShortcutPrompt, {
88
+ shortcuts: printShortCutTexts
89
+ }))), isPro && !isFreezed && /*#__PURE__*/React.createElement(DropdownItem, {
79
90
  className: "sdoc-dropdown-menu-item",
80
91
  onClick: onFreezeDocument
81
92
  }, t('Freeze_document')), /*#__PURE__*/React.createElement(DropdownItem, {
@@ -25,3 +25,10 @@
25
25
  .doc-ops .popover-wrapper {
26
26
  width: 300px;
27
27
  }
28
+
29
+ .sdoc-dropdown-print-container {
30
+ display: flex;
31
+ justify-content: space-between;
32
+ align-items: center;
33
+ width: 100%;
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.5.38",
3
+ "version": "0.5.40",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",