@seafile/sdoc-editor 0.5.21 → 0.5.24
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.
- package/dist/basic-sdk/comment/components/global-comment/global-comment-header.js +18 -3
- package/dist/basic-sdk/extension/plugins/blockquote/plugin.js +15 -1
- package/dist/basic-sdk/extension/plugins/callout/plugin.js +18 -3
- package/package.json +1 -1
- package/public/locales/cs/sdoc-editor.json +2 -1
- package/public/locales/de/sdoc-editor.json +2 -1
- package/public/locales/en/sdoc-editor.json +2 -1
- package/public/locales/es/sdoc-editor.json +2 -1
- package/public/locales/fr/sdoc-editor.json +2 -1
- package/public/locales/it/sdoc-editor.json +2 -1
- package/public/locales/ru/sdoc-editor.json +2 -1
- package/public/locales/zh_CN/sdoc-editor.json +2 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { eventStopPropagation } from '../../../utils/mouse-event';
|
|
4
4
|
import context from '../../../../context';
|
|
5
5
|
import { INTERNAL_EVENT } from '../../../constants';
|
|
6
6
|
import EventBus from '../../../utils/event-bus';
|
|
7
7
|
import { EXTERNAL_EVENT } from '../../../../constants';
|
|
8
|
+
import Tooltip from '../../../../components/tooltip';
|
|
8
9
|
const GlobalCommentHeader = _ref => {
|
|
9
10
|
let {
|
|
10
11
|
toggle,
|
|
@@ -13,6 +14,13 @@ const GlobalCommentHeader = _ref => {
|
|
|
13
14
|
const {
|
|
14
15
|
t
|
|
15
16
|
} = useTranslation();
|
|
17
|
+
const panelHeaderRef = useRef(null);
|
|
18
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (panelHeaderRef.current) {
|
|
21
|
+
setIsMounted(true);
|
|
22
|
+
}
|
|
23
|
+
}, []);
|
|
16
24
|
const toggleADDComment = useCallback(event => {
|
|
17
25
|
eventStopPropagation(event);
|
|
18
26
|
toggleGlobalCommentEditor();
|
|
@@ -36,18 +44,25 @@ const GlobalCommentHeader = _ref => {
|
|
|
36
44
|
}, /*#__PURE__*/React.createElement("span", {
|
|
37
45
|
className: "title"
|
|
38
46
|
}, t('Comments')), /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
ref: panelHeaderRef,
|
|
39
48
|
className: "comments-panel-header-right"
|
|
40
49
|
}, /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
id: "sdoc-read-all-btn",
|
|
41
51
|
className: "sdoc-icon-btn",
|
|
42
52
|
onClick: toggleReadAll
|
|
43
53
|
}, /*#__PURE__*/React.createElement("i", {
|
|
44
54
|
className: "sdocfont sdoc-all-read"
|
|
45
|
-
})
|
|
55
|
+
}), isMounted && /*#__PURE__*/React.createElement(Tooltip, {
|
|
56
|
+
target: "sdoc-read-all-btn"
|
|
57
|
+
}, t('Mark_all_as_read'))), /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
id: "sdoc-add-comment-btn",
|
|
46
59
|
className: "sdoc-icon-btn",
|
|
47
60
|
onClick: toggleADDComment
|
|
48
61
|
}, /*#__PURE__*/React.createElement("i", {
|
|
49
62
|
className: "sdocfont sdoc-add-comment"
|
|
50
|
-
})
|
|
63
|
+
}), isMounted && /*#__PURE__*/React.createElement(Tooltip, {
|
|
64
|
+
target: "sdoc-add-comment-btn"
|
|
65
|
+
}, t('Add_comment'))), /*#__PURE__*/React.createElement("div", {
|
|
51
66
|
className: "sdoc-icon-btn",
|
|
52
67
|
onClick: toggle
|
|
53
68
|
}, /*#__PURE__*/React.createElement("i", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Editor, Element, Transforms, Node, Path } from '@seafile/slate';
|
|
1
|
+
import { Editor, Element, Transforms, Node, Path, Range } from '@seafile/slate';
|
|
2
2
|
import { focusEditor, generateDefaultText, generateEmptyElement, getSelectedNodeByType, getSelectedNodeEntryByType, isBlockAboveEmpty, isSelectionAtBlockStart } from '../../core';
|
|
3
3
|
import { BLOCKQUOTE, PARAGRAPH, CODE_BLOCK, TABLE } from '../../constants';
|
|
4
4
|
import { getFormattedElements, getFormattedRestElements } from './helpers';
|
|
@@ -106,6 +106,20 @@ const withBlockquote = editor => {
|
|
|
106
106
|
|
|
107
107
|
// Insert elements of quote block
|
|
108
108
|
if (restElements.length !== 0) {
|
|
109
|
+
if (Range.isCollapsed(editor.selection)) {
|
|
110
|
+
const paragraphEntry = getSelectedNodeEntryByType(newEditor, PARAGRAPH);
|
|
111
|
+
if (paragraphEntry) {
|
|
112
|
+
const parentNodeEntry = Editor.parent(editor, paragraphEntry[1]);
|
|
113
|
+
if (parentNodeEntry && parentNodeEntry[0].type === BLOCKQUOTE) {
|
|
114
|
+
if (!Node.string(paragraphEntry[0]).length) {
|
|
115
|
+
insertFragment(data);
|
|
116
|
+
return Transforms.removeNodes(newEditor, {
|
|
117
|
+
at: paragraphEntry[1]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
109
123
|
// Insert text when inserting a single line paragraph
|
|
110
124
|
if (restElements.length === 1 && restElements[0].type === PARAGRAPH) {
|
|
111
125
|
const string = Node.string(restElements[0]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import isHotkey from 'is-hotkey';
|
|
2
|
-
import { Editor, Transforms } from '@seafile/slate';
|
|
3
|
-
import { PARAGRAPH, INSERT_POSITION, CODE_BLOCK } from '../../constants';
|
|
4
|
-
import { isSelectionAtBlockStart } from '../../core';
|
|
2
|
+
import { Editor, Node, Range, Transforms } from '@seafile/slate';
|
|
3
|
+
import { PARAGRAPH, INSERT_POSITION, CODE_BLOCK, CALL_OUT } from '../../constants';
|
|
4
|
+
import { getSelectedNodeEntryByType, isSelectionAtBlockStart } from '../../core';
|
|
5
5
|
import { deleteCalloutIcon, getCalloutEntry, isCalloutContentEmpty, unwrapCallout } from './helper';
|
|
6
6
|
import { insertElement } from '../../toolbar/side-toolbar/helpers';
|
|
7
7
|
import EventBus from '../../../utils/event-bus';
|
|
@@ -49,6 +49,21 @@ const withCallout = editor => {
|
|
|
49
49
|
newEditor.insertFragment = data => {
|
|
50
50
|
if (getCalloutEntry(editor)) {
|
|
51
51
|
var _data$find;
|
|
52
|
+
// Prvent insert new line when insert fragment
|
|
53
|
+
if (Range.isCollapsed(editor.selection)) {
|
|
54
|
+
const paragraphEntry = getSelectedNodeEntryByType(newEditor, PARAGRAPH);
|
|
55
|
+
if (paragraphEntry) {
|
|
56
|
+
const parentNodeEntry = Editor.parent(editor, paragraphEntry[1]);
|
|
57
|
+
if (parentNodeEntry && parentNodeEntry[0].type === CALL_OUT) {
|
|
58
|
+
if (!Node.string(paragraphEntry[0]).length) {
|
|
59
|
+
insertFragment(data);
|
|
60
|
+
return Transforms.removeNodes(newEditor, {
|
|
61
|
+
at: paragraphEntry[1]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
52
67
|
const eventBus = EventBus.getInstance();
|
|
53
68
|
const unsupportType = (_data$find = data.find(node => !CALLOUT_ALLOWED_INSIDE_TYPES.includes(node.type))) === null || _data$find === void 0 ? void 0 : _data$find.type;
|
|
54
69
|
if (unsupportType) {
|
package/package.json
CHANGED
|
@@ -450,5 +450,6 @@
|
|
|
450
450
|
"Center_align": "Middle",
|
|
451
451
|
"Bottom_align": "Bottom",
|
|
452
452
|
"Move_column_count": "Moving {{count}} column(s)",
|
|
453
|
-
"Move_row_count": "Moving {{count}} row(s)"
|
|
453
|
+
"Move_row_count": "Moving {{count}} row(s)",
|
|
454
|
+
"Mark_all_as_read": "Mark all as read"
|
|
454
455
|
}
|
|
@@ -450,5 +450,6 @@
|
|
|
450
450
|
"Center_align": "Middle",
|
|
451
451
|
"Bottom_align": "Bottom",
|
|
452
452
|
"Move_column_count": "Moving {{count}} column(s)",
|
|
453
|
-
"Move_row_count": "Moving {{count}} row(s)"
|
|
453
|
+
"Move_row_count": "Moving {{count}} row(s)",
|
|
454
|
+
"Mark_all_as_read": "Alle als gelesen markieren"
|
|
454
455
|
}
|
|
@@ -450,5 +450,6 @@
|
|
|
450
450
|
"Center_align": "Middle",
|
|
451
451
|
"Bottom_align": "Bottom",
|
|
452
452
|
"Move_column_count": "Moving {{count}} column(s)",
|
|
453
|
-
"Move_row_count": "Moving {{count}} row(s)"
|
|
453
|
+
"Move_row_count": "Moving {{count}} row(s)",
|
|
454
|
+
"Mark_all_as_read": "Mark all as read"
|
|
454
455
|
}
|
|
@@ -450,5 +450,6 @@
|
|
|
450
450
|
"Center_align": "Middle",
|
|
451
451
|
"Bottom_align": "Bottom",
|
|
452
452
|
"Move_column_count": "Moving {{count}} column(s)",
|
|
453
|
-
"Move_row_count": "Moving {{count}} row(s)"
|
|
453
|
+
"Move_row_count": "Moving {{count}} row(s)",
|
|
454
|
+
"Mark_all_as_read": "Mark all as read"
|
|
454
455
|
}
|
|
@@ -450,5 +450,6 @@
|
|
|
450
450
|
"Center_align": "Middle",
|
|
451
451
|
"Bottom_align": "Bottom",
|
|
452
452
|
"Move_column_count": "Moving {{count}} column(s)",
|
|
453
|
-
"Move_row_count": "Moving {{count}} row(s)"
|
|
453
|
+
"Move_row_count": "Moving {{count}} row(s)",
|
|
454
|
+
"Mark_all_as_read": "Mark all as read"
|
|
454
455
|
}
|
|
@@ -450,5 +450,6 @@
|
|
|
450
450
|
"Center_align": "Middle",
|
|
451
451
|
"Bottom_align": "Bottom",
|
|
452
452
|
"Move_column_count": "Moving {{count}} column(s)",
|
|
453
|
-
"Move_row_count": "Moving {{count}} row(s)"
|
|
453
|
+
"Move_row_count": "Moving {{count}} row(s)",
|
|
454
|
+
"Mark_all_as_read": "Mark all as read"
|
|
454
455
|
}
|
|
@@ -450,5 +450,6 @@
|
|
|
450
450
|
"Center_align": "Середина",
|
|
451
451
|
"Bottom_align": "Низ",
|
|
452
452
|
"Move_column_count": "Перемещение {{count}} столбцов",
|
|
453
|
-
"Move_row_count": "Перемещение {{count}} строк"
|
|
453
|
+
"Move_row_count": "Перемещение {{count}} строк",
|
|
454
|
+
"Mark_all_as_read": "Отметить все как прочитанное"
|
|
454
455
|
}
|