@seafile/sdoc-editor 0.4.13 → 0.4.15
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/index.js +2 -2
- package/dist/basic-sdk/extension/constants/font.js +0 -1
- package/dist/basic-sdk/extension/plugins/blockquote/plugin.js +17 -6
- package/dist/basic-sdk/extension/plugins/callout/render-elem/index.js +0 -2
- package/dist/basic-sdk/extension/plugins/code-block/helpers.js +0 -2
- package/dist/basic-sdk/extension/plugins/code-block/render-elem.js +0 -2
- package/dist/basic-sdk/extension/plugins/file-link/helpers.js +0 -1
- package/dist/basic-sdk/extension/plugins/html/helper.js +0 -1
- package/dist/basic-sdk/extension/plugins/image/plugin.js +3 -1
- package/dist/basic-sdk/extension/plugins/link/helpers.js +0 -1
- package/dist/basic-sdk/extension/plugins/sdoc-link/helpers.js +0 -1
- package/dist/basic-sdk/extension/plugins/search-replace/popover/index.js +1 -1
- package/dist/basic-sdk/extension/plugins/table/helpers.js +0 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/helpers.js +0 -1
- package/package.json +1 -1
- package/public/locales/cs/sdoc-editor.json +1 -1
- package/public/locales/de/sdoc-editor.json +1 -1
- package/public/locales/en/sdoc-editor.json +1 -1
- package/public/locales/es/sdoc-editor.json +1 -1
- package/public/locales/fr/sdoc-editor.json +1 -1
- package/public/locales/it/sdoc-editor.json +1 -1
- package/public/locales/ru/sdoc-editor.json +1 -1
- package/public/locales/zh_CN/sdoc-editor.json +2 -2
|
@@ -78,6 +78,7 @@ const GlobalComment = _ref => {
|
|
|
78
78
|
setActiveComment(comment);
|
|
79
79
|
deleteUnseenNotifications && deleteUnseenNotifications(comment);
|
|
80
80
|
if (comment.detail.element_id === DOC_COMMENT_ELEMENT_ID) return;
|
|
81
|
+
if (!element) return;
|
|
81
82
|
const elementDom = ReactEditor.toDOMNode(editor, element, scrollRef);
|
|
82
83
|
scrollRef.current.scrollTop = elementDom.offsetTop - scrollRef.current.clientHeight / 3;
|
|
83
84
|
focusToCommentElement(editor, element);
|
|
@@ -150,8 +151,7 @@ const GlobalComment = _ref => {
|
|
|
150
151
|
className: "sdoc-comment-list-container"
|
|
151
152
|
}, Array.isArray(commentList) && commentList.map(comment => {
|
|
152
153
|
const elementId = comment.detail.element_id;
|
|
153
|
-
const element = getNodeById(editor.children, elementId);
|
|
154
|
-
if (!element && elementId !== DOC_COMMENT_ELEMENT_ID) return null;
|
|
154
|
+
const element = elementId !== DOC_COMMENT_ELEMENT_ID ? getNodeById(editor.children, elementId) : null;
|
|
155
155
|
const isActive = activeComment && activeComment.id === comment.id;
|
|
156
156
|
return /*#__PURE__*/React.createElement(CommentItemWrapper, {
|
|
157
157
|
key: comment.id,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Editor, Element, Transforms, Node, Path } from '@seafile/slate';
|
|
2
|
-
import { focusEditor, generateDefaultText, getSelectedNodeByType, isSelectionAtBlockStart } from '../../core';
|
|
2
|
+
import { focusEditor, generateDefaultText, generateEmptyElement, getSelectedNodeByType, getSelectedNodeEntryByType, isBlockAboveEmpty, isSelectionAtBlockStart } from '../../core';
|
|
3
3
|
import { BLOCKQUOTE, PARAGRAPH, CODE_BLOCK, TABLE } from '../../constants';
|
|
4
|
-
import {
|
|
4
|
+
import { getFormattedElements, getFormattedRestElements } from './helpers';
|
|
5
5
|
const withBlockquote = editor => {
|
|
6
6
|
const {
|
|
7
7
|
insertBreak,
|
|
@@ -54,23 +54,34 @@ const withBlockquote = editor => {
|
|
|
54
54
|
deleteBackward(unit);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
57
|
+
const blockQuoteEntry = getSelectedNodeEntryByType(editor, BLOCKQUOTE);
|
|
58
|
+
if (blockQuoteEntry) {
|
|
59
59
|
const [currentLineEntry] = Editor.nodes(newEditor, {
|
|
60
60
|
match: n => Element.isElement(n) && n.type === PARAGRAPH,
|
|
61
61
|
mode: 'lowest'
|
|
62
62
|
});
|
|
63
63
|
if (!currentLineEntry) return deleteBackward(unit);
|
|
64
64
|
const currentLineIndex = currentLineEntry[1].slice(-1)[0];
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
// Transforms to paragraph when Select at the beginning of the first line
|
|
66
|
+
if (currentLineIndex === 0 && isBlockAboveEmpty(newEditor)) {
|
|
67
|
+
const emptyParagraph = generateEmptyElement(PARAGRAPH);
|
|
68
|
+
Transforms.removeNodes(editor, {
|
|
69
|
+
at: currentLineEntry[1]
|
|
70
|
+
});
|
|
71
|
+
Transforms.insertNodes(newEditor, emptyParagraph, {
|
|
72
|
+
at: blockQuoteEntry[1]
|
|
73
|
+
});
|
|
74
|
+
const previous = Path.previous(blockQuoteEntry[1]);
|
|
75
|
+
focusEditor(newEditor, Path.next(previous).concat(0));
|
|
67
76
|
return;
|
|
68
77
|
}
|
|
78
|
+
// Merge with previous line when Select at the beginning of the line
|
|
69
79
|
if (isSelectionAtBlockStart(editor)) {
|
|
70
80
|
const lineText = Node.string(currentLineEntry[0]);
|
|
71
81
|
const previousNodeEntry = Editor.previous(editor, {
|
|
72
82
|
at: currentLineEntry[1]
|
|
73
83
|
});
|
|
84
|
+
if (!previousNodeEntry) return;
|
|
74
85
|
const focusPoint = Editor.end(newEditor, previousNodeEntry[1]);
|
|
75
86
|
Transforms.insertText(newEditor, lineText, {
|
|
76
87
|
at: Editor.end(newEditor, previousNodeEntry[1])
|
|
@@ -51,7 +51,6 @@ const renderCallout = (_ref, editor) => {
|
|
|
51
51
|
top: menuTop,
|
|
52
52
|
left: left // left = code-block left distance
|
|
53
53
|
};
|
|
54
|
-
|
|
55
54
|
setPopoverPosition(newMenuPosition);
|
|
56
55
|
}
|
|
57
56
|
}, [isShowColorSelector, readOnly]);
|
|
@@ -82,7 +81,6 @@ const renderCallout = (_ref, editor) => {
|
|
|
82
81
|
top: menuTop,
|
|
83
82
|
left: left // left = callout left distance
|
|
84
83
|
};
|
|
85
|
-
|
|
86
84
|
setPopoverPosition(newMenuPosition);
|
|
87
85
|
setIsShowColorSelector(true);
|
|
88
86
|
}, [readOnly]);
|
|
@@ -23,7 +23,6 @@ export const isMenuDisabled = (editor, readonly) => {
|
|
|
23
23
|
if (isMatch) return false; // enable
|
|
24
24
|
return true; // disable
|
|
25
25
|
};
|
|
26
|
-
|
|
27
26
|
export const getSelectCodeElem = editor => {
|
|
28
27
|
const codeNode = getSelectedNodeByType(editor, CODE_BLOCK);
|
|
29
28
|
if (codeNode == null) return null;
|
|
@@ -63,7 +62,6 @@ export const changeToCodeBlock = function (editor) {
|
|
|
63
62
|
style: {
|
|
64
63
|
white_space: 'nowrap' // default nowrap
|
|
65
64
|
},
|
|
66
|
-
|
|
67
65
|
children: [{
|
|
68
66
|
id: slugid.nice(),
|
|
69
67
|
type: CODE_LINE,
|
|
@@ -81,7 +81,6 @@ const CodeBlock = _ref => {
|
|
|
81
81
|
top: menuTop,
|
|
82
82
|
left: left // left = code-block left distance
|
|
83
83
|
};
|
|
84
|
-
|
|
85
84
|
setMenuPosition(newMenuPosition);
|
|
86
85
|
}
|
|
87
86
|
setShowHoverMenu(true);
|
|
@@ -105,7 +104,6 @@ const CodeBlock = _ref => {
|
|
|
105
104
|
top: menuTop,
|
|
106
105
|
left: left // left = code-block left distance
|
|
107
106
|
};
|
|
108
|
-
|
|
109
107
|
setMenuPosition(newMenuPosition);
|
|
110
108
|
}
|
|
111
109
|
}, [readOnly, showHoverMenu]);
|
|
@@ -114,8 +114,10 @@ const withImage = editor => {
|
|
|
114
114
|
const point = Editor.before(editor, selection, {
|
|
115
115
|
distance: 2
|
|
116
116
|
});
|
|
117
|
+
if (!point) return;
|
|
117
118
|
const [node, path] = Editor.node(editor, [point.path[0], point.path[1]]);
|
|
118
|
-
|
|
119
|
+
const isPerviousNodeImage = node.type === IMAGE;
|
|
120
|
+
if (isPerviousNodeImage && Range.isCollapsed(selection) && isBlockAboveEmpty(editor) && !Path.isCommon(path, selection.anchor.path)) {
|
|
119
121
|
deleteBackward(unit);
|
|
120
122
|
focusEditor(newEditor, Editor.end(newEditor, focusPoint));
|
|
121
123
|
return;
|
|
@@ -188,7 +188,7 @@ const SearchReplacePopover = _ref => {
|
|
|
188
188
|
disabled: !highlightInfos.length,
|
|
189
189
|
onClick: handleLast,
|
|
190
190
|
className: "btn btn-secondary"
|
|
191
|
-
}, t('
|
|
191
|
+
}, t('Prevs')), /*#__PURE__*/React.createElement("button", {
|
|
192
192
|
disabled: !highlightInfos.length,
|
|
193
193
|
onClick: handleNext,
|
|
194
194
|
className: "btn btn-secondary"
|
|
@@ -175,7 +175,6 @@ export const isAllInTable = editor => {
|
|
|
175
175
|
if (firstSelectedNode.type !== ELEMENT_TYPE.TABLE) return false;
|
|
176
176
|
return selectedNodes.slice(1).every(node => [ELEMENT_TYPE.TABLE_ROW, ELEMENT_TYPE.TABLE_CELL].includes(node.type)); // same table element
|
|
177
177
|
};
|
|
178
|
-
|
|
179
178
|
export const setCellStyle = (editor, style) => {
|
|
180
179
|
// Select single cell
|
|
181
180
|
if (ObjectUtils.isSameObject(editor.tableSelectedRange, EMPTY_SELECTED_RANGE)) {
|
|
@@ -92,7 +92,6 @@ export const getDomTopHeight = (dom, slateNode) => {
|
|
|
92
92
|
if (ADD_POSITION_OFFSET_TYPE.includes(slateNode.type)) {
|
|
93
93
|
offsetY = lightHight / 2 + paddingTop - 12; // side toolbar icon is 12 px
|
|
94
94
|
}
|
|
95
|
-
|
|
96
95
|
const HEADER_HEIGHT = 56 + 44;
|
|
97
96
|
return rect.y - HEADER_HEIGHT + offsetY;
|
|
98
97
|
};
|
package/package.json
CHANGED
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
"Type_search_content": "Type search content",
|
|
435
435
|
"Replace_as": "Replace as",
|
|
436
436
|
"Type_replace_content": "Type replace content",
|
|
437
|
-
"
|
|
437
|
+
"Prevs": "Prevs",
|
|
438
438
|
"Next": "Další",
|
|
439
439
|
"Replace": "Nahradit",
|
|
440
440
|
"Replace_all": "Replace all",
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
"Type_search_content": "Type search content",
|
|
435
435
|
"Replace_as": "Replace as",
|
|
436
436
|
"Type_replace_content": "Type replace content",
|
|
437
|
-
"
|
|
437
|
+
"Prevs": "Prevs",
|
|
438
438
|
"Next": "Nächste Seite",
|
|
439
439
|
"Replace": "Ersetzen",
|
|
440
440
|
"Replace_all": "Replace all",
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
"Type_search_content": "Type search content",
|
|
435
435
|
"Replace_as": "Replace as",
|
|
436
436
|
"Type_replace_content": "Type replace content",
|
|
437
|
-
"
|
|
437
|
+
"Prevs": "Prevs",
|
|
438
438
|
"Next": "Next",
|
|
439
439
|
"Replace": "Replace",
|
|
440
440
|
"Replace_all": "Replace all",
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
"Type_search_content": "Type search content",
|
|
435
435
|
"Replace_as": "Replace as",
|
|
436
436
|
"Type_replace_content": "Type replace content",
|
|
437
|
-
"
|
|
437
|
+
"Prevs": "Prevs",
|
|
438
438
|
"Next": "Siguiente",
|
|
439
439
|
"Replace": "Reemplazar",
|
|
440
440
|
"Replace_all": "Replace all",
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
"Type_search_content": "Type search content",
|
|
435
435
|
"Replace_as": "Replace as",
|
|
436
436
|
"Type_replace_content": "Type replace content",
|
|
437
|
-
"
|
|
437
|
+
"Prevs": "Prevs",
|
|
438
438
|
"Next": "Suivant",
|
|
439
439
|
"Replace": "Remplacer",
|
|
440
440
|
"Replace_all": "Replace all",
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
"Type_search_content": "Type search content",
|
|
435
435
|
"Replace_as": "Replace as",
|
|
436
436
|
"Type_replace_content": "Type replace content",
|
|
437
|
-
"
|
|
437
|
+
"Prevs": "Prevs",
|
|
438
438
|
"Next": "Successivo",
|
|
439
439
|
"Replace": "Sostituire",
|
|
440
440
|
"Replace_all": "Replace all",
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
"Type_search_content": "Введите содержимое для поиска",
|
|
435
435
|
"Replace_as": "Заменить как",
|
|
436
436
|
"Type_replace_content": "Введите содержимое для замены",
|
|
437
|
-
"
|
|
437
|
+
"Prevs": "Prevs",
|
|
438
438
|
"Next": "Следующий",
|
|
439
439
|
"Replace": "Заменить",
|
|
440
440
|
"Replace_all": "Заменить все",
|
|
@@ -434,10 +434,10 @@
|
|
|
434
434
|
"Type_search_content": "输入查找内容",
|
|
435
435
|
"Replace_as": "替换为",
|
|
436
436
|
"Type_replace_content": "输入替换内容",
|
|
437
|
-
"
|
|
437
|
+
"Prevs": "上一个",
|
|
438
438
|
"Next": "下一页",
|
|
439
439
|
"Replace": "替换",
|
|
440
|
-
"Replace_all": "
|
|
440
|
+
"Replace_all": "替换全部",
|
|
441
441
|
"Are_you_sure_to_replace_all_number_xxx_in_this_document_with_yyy": "确定要将此文档内的 {{number}} 处 \"{{originalWord}} \" 替换为 \"{{replacedWord}} \" 吗?",
|
|
442
442
|
"Are_you_sure_to_clear_all_number_xxx_in_this_document": "确定将此文档内的 {{number}} 处 \"{{originalWord}}\" 全部清除吗?",
|
|
443
443
|
"Search_not_found": "未找到"
|