@seafile/sdoc-editor 0.5.0 → 0.5.1
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/extension/commons/history-files/index.js +2 -2
- package/dist/basic-sdk/extension/plugins/blockquote/plugin.js +4 -3
- package/dist/basic-sdk/extension/plugins/list/plugin/index.js +24 -5
- 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 +2 -2
- package/public/locales/zh_CN/sdoc-editor.json +1 -1
|
@@ -26,7 +26,7 @@ const HistoryFiles = _ref => {
|
|
|
26
26
|
const historyFilesInputRef = useRef();
|
|
27
27
|
const [files, setFiles] = useState([]);
|
|
28
28
|
const [position, setPosition] = useState({});
|
|
29
|
-
const [header, setHeader] = useState(t('
|
|
29
|
+
const [header, setHeader] = useState(t('Recent_visited'));
|
|
30
30
|
const [newFileName, setNewFileName] = useState('');
|
|
31
31
|
const getPosition = useCallback(() => {
|
|
32
32
|
const {
|
|
@@ -109,7 +109,7 @@ const HistoryFiles = _ref => {
|
|
|
109
109
|
|
|
110
110
|
// Show history files when search is empty
|
|
111
111
|
if (e.target.value.trim().length === 0) {
|
|
112
|
-
setHeader(t('
|
|
112
|
+
setHeader(t('Recent_visited'));
|
|
113
113
|
setNewFileName('');
|
|
114
114
|
getHistoryFiles();
|
|
115
115
|
return;
|
|
@@ -56,12 +56,13 @@ const withBlockquote = editor => {
|
|
|
56
56
|
}
|
|
57
57
|
const blockQuoteEntry = getSelectedNodeEntryByType(editor, BLOCKQUOTE);
|
|
58
58
|
if (blockQuoteEntry) {
|
|
59
|
+
const [, blockQuotePath] = blockQuoteEntry;
|
|
59
60
|
const [currentLineEntry] = Editor.nodes(newEditor, {
|
|
60
|
-
match: n => Element.isElement(n) && n.type === PARAGRAPH
|
|
61
|
-
mode: 'lowest'
|
|
61
|
+
match: (n, p) => Element.isElement(n) && p.length === blockQuotePath.length + 1 && n.type === PARAGRAPH
|
|
62
62
|
});
|
|
63
63
|
if (!currentLineEntry) return deleteBackward(unit);
|
|
64
|
-
const
|
|
64
|
+
const [, currentLinePath] = currentLineEntry;
|
|
65
|
+
const currentLineIndex = currentLinePath[blockQuotePath.length];
|
|
65
66
|
// Transforms to paragraph when Select at the beginning of the first line
|
|
66
67
|
if (currentLineIndex === 0 && isBlockAboveEmpty(newEditor)) {
|
|
67
68
|
const emptyParagraph = generateEmptyElement(PARAGRAPH);
|
|
@@ -3,12 +3,15 @@ import { onTabHandle } from './on-tab-handle';
|
|
|
3
3
|
import { normalizeList } from './normalize-list';
|
|
4
4
|
import { insertFragmentList } from './insert-fragment-list';
|
|
5
5
|
import { handleShortcut } from './shortcut';
|
|
6
|
+
import { getAboveBlockNode, getSelectedNodeEntryByType } from '../../../core';
|
|
7
|
+
import { BLOCKQUOTE, LIST_ITEM } from '../../../constants';
|
|
8
|
+
import { Editor, Transforms } from '@seafile/slate';
|
|
6
9
|
const withList = editor => {
|
|
7
10
|
const {
|
|
8
11
|
insertBreak,
|
|
9
|
-
deleteBackWord,
|
|
10
12
|
handleTab,
|
|
11
|
-
insertText
|
|
13
|
+
insertText,
|
|
14
|
+
deleteBackward
|
|
12
15
|
} = editor;
|
|
13
16
|
const newEditor = editor;
|
|
14
17
|
newEditor.insertBreak = () => {
|
|
@@ -16,16 +19,32 @@ const withList = editor => {
|
|
|
16
19
|
insertBreak();
|
|
17
20
|
return;
|
|
18
21
|
};
|
|
19
|
-
newEditor.
|
|
22
|
+
newEditor.deleteBackward = unit => {
|
|
20
23
|
const {
|
|
21
24
|
selection
|
|
22
25
|
} = newEditor;
|
|
23
26
|
if (selection === null) {
|
|
24
|
-
|
|
27
|
+
deleteBackward(unit);
|
|
25
28
|
return;
|
|
26
29
|
}
|
|
30
|
+
const listItemEntry = getSelectedNodeEntryByType(editor, LIST_ITEM);
|
|
31
|
+
if (listItemEntry) {
|
|
32
|
+
const [, listItemPath] = listItemEntry;
|
|
33
|
+
const blockQuoteEntry = getSelectedNodeEntryByType(editor, BLOCKQUOTE);
|
|
34
|
+
if (blockQuoteEntry) {
|
|
35
|
+
const isStart = Editor.isStart(editor, editor.selection.anchor, listItemPath);
|
|
36
|
+
if (isStart) {
|
|
37
|
+
// This is a tricky way to delete the blockquote and create a new paragraph
|
|
38
|
+
Transforms.removeNodes(editor, {
|
|
39
|
+
at: listItemPath
|
|
40
|
+
});
|
|
41
|
+
insertBreak();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
27
46
|
// nothing todo
|
|
28
|
-
|
|
47
|
+
deleteBackward(unit);
|
|
29
48
|
};
|
|
30
49
|
newEditor.handleTab = event => {
|
|
31
50
|
if (!newEditor.selection) {
|
package/package.json
CHANGED
|
@@ -442,7 +442,7 @@
|
|
|
442
442
|
"Are_you_sure_to_replace_all_number_xxx_in_this_document_with_yyy": "Are you sure to replace all {{number}} '{{originalWord}}' in this document with '{{replacedWord}}'?",
|
|
443
443
|
"Are_you_sure_to_clear_all_number_xxx_in_this_document": "Are you sure to clear all {{number}} '{{originalWord}}' in this document?",
|
|
444
444
|
"Search_not_found": "Not found",
|
|
445
|
-
"
|
|
445
|
+
"Recent_visited": "Recent visited",
|
|
446
446
|
"The_document_does_not_exist": "The document does not exist",
|
|
447
447
|
"Create_a_new_sdoc_file": "Create a new sdoc file",
|
|
448
448
|
"Create": "Vytvořit"
|
|
@@ -442,7 +442,7 @@
|
|
|
442
442
|
"Are_you_sure_to_replace_all_number_xxx_in_this_document_with_yyy": "Are you sure to replace all {{number}} '{{originalWord}}' in this document with '{{replacedWord}}'?",
|
|
443
443
|
"Are_you_sure_to_clear_all_number_xxx_in_this_document": "Are you sure to clear all {{number}} '{{originalWord}}' in this document?",
|
|
444
444
|
"Search_not_found": "Not found",
|
|
445
|
-
"
|
|
445
|
+
"Recent_visited": "Recent visited",
|
|
446
446
|
"The_document_does_not_exist": "The document does not exist",
|
|
447
447
|
"Create_a_new_sdoc_file": "Create a new sdoc file",
|
|
448
448
|
"Create": "Erstellen"
|
|
@@ -442,7 +442,7 @@
|
|
|
442
442
|
"Are_you_sure_to_replace_all_number_xxx_in_this_document_with_yyy": "Are you sure to replace all {{number}} '{{originalWord}}' in this document with '{{replacedWord}}'?",
|
|
443
443
|
"Are_you_sure_to_clear_all_number_xxx_in_this_document": "Are you sure to clear all {{number}} '{{originalWord}}' in this document?",
|
|
444
444
|
"Search_not_found": "Not found",
|
|
445
|
-
"
|
|
445
|
+
"Recent_visited": "Recent visited",
|
|
446
446
|
"The_document_does_not_exist": "The document does not exist",
|
|
447
447
|
"Create_a_new_sdoc_file": "Create a new sdoc file",
|
|
448
448
|
"Create": "Create"
|
|
@@ -442,7 +442,7 @@
|
|
|
442
442
|
"Are_you_sure_to_replace_all_number_xxx_in_this_document_with_yyy": "Are you sure to replace all {{number}} '{{originalWord}}' in this document with '{{replacedWord}}'?",
|
|
443
443
|
"Are_you_sure_to_clear_all_number_xxx_in_this_document": "Are you sure to clear all {{number}} '{{originalWord}}' in this document?",
|
|
444
444
|
"Search_not_found": "Not found",
|
|
445
|
-
"
|
|
445
|
+
"Recent_visited": "Recent visited",
|
|
446
446
|
"The_document_does_not_exist": "The document does not exist",
|
|
447
447
|
"Create_a_new_sdoc_file": "Create a new sdoc file",
|
|
448
448
|
"Create": "Crear"
|
|
@@ -442,7 +442,7 @@
|
|
|
442
442
|
"Are_you_sure_to_replace_all_number_xxx_in_this_document_with_yyy": "Are you sure to replace all {{number}} '{{originalWord}}' in this document with '{{replacedWord}}'?",
|
|
443
443
|
"Are_you_sure_to_clear_all_number_xxx_in_this_document": "Are you sure to clear all {{number}} '{{originalWord}}' in this document?",
|
|
444
444
|
"Search_not_found": "Not found",
|
|
445
|
-
"
|
|
445
|
+
"Recent_visited": "Recent visited",
|
|
446
446
|
"The_document_does_not_exist": "The document does not exist",
|
|
447
447
|
"Create_a_new_sdoc_file": "Create a new sdoc file",
|
|
448
448
|
"Create": "Créer"
|
|
@@ -442,7 +442,7 @@
|
|
|
442
442
|
"Are_you_sure_to_replace_all_number_xxx_in_this_document_with_yyy": "Are you sure to replace all {{number}} '{{originalWord}}' in this document with '{{replacedWord}}'?",
|
|
443
443
|
"Are_you_sure_to_clear_all_number_xxx_in_this_document": "Are you sure to clear all {{number}} '{{originalWord}}' in this document?",
|
|
444
444
|
"Search_not_found": "Not found",
|
|
445
|
-
"
|
|
445
|
+
"Recent_visited": "Recent visited",
|
|
446
446
|
"The_document_does_not_exist": "The document does not exist",
|
|
447
447
|
"Create_a_new_sdoc_file": "Create a new sdoc file",
|
|
448
448
|
"Create": "Crea"
|
|
@@ -428,7 +428,7 @@
|
|
|
428
428
|
"My_modification": "Моя модификация",
|
|
429
429
|
"Document_history": "История документа",
|
|
430
430
|
"Freeze_document": "Заморозить документ",
|
|
431
|
-
"Document_frozen": "
|
|
431
|
+
"Document_frozen": "Документ заморожен",
|
|
432
432
|
"Unfreeze": "Разморозить",
|
|
433
433
|
"Search_and_replace": "Поиск и замена",
|
|
434
434
|
"Search": "Поиск",
|
|
@@ -442,7 +442,7 @@
|
|
|
442
442
|
"Are_you_sure_to_replace_all_number_xxx_in_this_document_with_yyy": "Вы уверены, что хотите заменить все {{number}} '{{originalWord}}' в этом документе на '{{replacedWord}}'?",
|
|
443
443
|
"Are_you_sure_to_clear_all_number_xxx_in_this_document": "Вы уверены, что хотите очистить все {{number}} '{{originalWord}}' в этом документе?",
|
|
444
444
|
"Search_not_found": "Не найдено",
|
|
445
|
-
"
|
|
445
|
+
"Recent_visited": "Recent visited",
|
|
446
446
|
"The_document_does_not_exist": "Документ не существует",
|
|
447
447
|
"Create_a_new_sdoc_file": "Создать новый файл sdoc",
|
|
448
448
|
"Create": "Создать"
|
|
@@ -442,7 +442,7 @@
|
|
|
442
442
|
"Are_you_sure_to_replace_all_number_xxx_in_this_document_with_yyy": "确定要将此文档内的 {{number}} 处 \"{{originalWord}} \" 替换为 \"{{replacedWord}} \" 吗?",
|
|
443
443
|
"Are_you_sure_to_clear_all_number_xxx_in_this_document": "确定将此文档内的 {{number}} 处 \"{{originalWord}}\" 全部清除吗?",
|
|
444
444
|
"Search_not_found": "未找到",
|
|
445
|
-
"
|
|
445
|
+
"Recent_visited": "最近浏览",
|
|
446
446
|
"The_document_does_not_exist": "不存在该文档",
|
|
447
447
|
"Create_a_new_sdoc_file": "新建 sdoc 文件",
|
|
448
448
|
"Create": "创建"
|