@seafile/sdoc-editor 0.1.161 → 0.1.162
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/constants/index.js +1 -1
- package/dist/basic-sdk/extension/constants/menus-config.js +68 -20
- package/dist/basic-sdk/extension/plugins/check-list/helpers.js +11 -3
- package/dist/basic-sdk/extension/plugins/list/transforms/toggle-list.js +16 -5
- package/dist/basic-sdk/extension/toolbar/side-toolbar/helpers.js +17 -7
- package/dist/basic-sdk/extension/toolbar/side-toolbar/insert-block-menu.js +44 -15
- package/dist/basic-sdk/extension/toolbar/side-toolbar/side-menu.js +1 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/transform-menus.js +5 -5
- package/package.json +1 -1
- package/public/locales/cs/sdoc-editor.json +14 -1
- package/public/locales/de/sdoc-editor.json +14 -1
- package/public/locales/es/sdoc-editor.json +14 -1
- package/public/locales/fr/sdoc-editor.json +12 -1
- package/public/locales/it/sdoc-editor.json +15 -2
- package/public/locales/ru/sdoc-editor.json +13 -2
- package/public/locales/zh_CN/sdoc-editor.json +4 -2
|
@@ -7,7 +7,7 @@ export { DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_LIST, DEFAULT_FONT
|
|
|
7
7
|
export { FONT_SIZE, DEFAULT_FONT, FONT, GOOGLE_FONT_CLASS, RECENT_USED_FONTS_KEY, SDOC_FONT_SIZE } from './font';
|
|
8
8
|
export { DIFF_TYPE, ADDED_STYLE, DELETED_STYLE } from './diff-view';
|
|
9
9
|
export { KEYBOARD, MAC_HOTKEYS, WIN_HOTKEYS } from './keyboard';
|
|
10
|
-
export { UNDO, REDO, TEXT_STYLE, TEXT_STYLE_MAP, TEXT_STYLE_MORE, TEXT_ALIGN, REMOVE_TABLE, CLEAR_FORMAT, MENUS_CONFIG_MAP,
|
|
10
|
+
export { UNDO, REDO, TEXT_STYLE, TEXT_STYLE_MAP, TEXT_STYLE_MORE, TEXT_ALIGN, REMOVE_TABLE, CLEAR_FORMAT, MENUS_CONFIG_MAP, SIDE_TRANSFORM_MENUS_CONFIG, SIDE_INSERT_MENUS_CONFIG } from './menus-config';
|
|
11
11
|
export var HEADERS = [HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6];
|
|
12
12
|
export var HEADER_TITLE_MAP = (_HEADER_TITLE_MAP = {}, _defineProperty(_HEADER_TITLE_MAP, TITLE, 'Title'), _defineProperty(_HEADER_TITLE_MAP, SUBTITLE, 'Subtitle'), _defineProperty(_HEADER_TITLE_MAP, HEADER1, 'Header_one'), _defineProperty(_HEADER_TITLE_MAP, HEADER2, 'Header_two'), _defineProperty(_HEADER_TITLE_MAP, HEADER3, 'Header_three'), _defineProperty(_HEADER_TITLE_MAP, HEADER4, 'Header_four'), _defineProperty(_HEADER_TITLE_MAP, HEADER5, 'Header_five'), _defineProperty(_HEADER_TITLE_MAP, HEADER6, 'Header_six'), _defineProperty(_HEADER_TITLE_MAP, PARAGRAPH, 'Paragraph'), _HEADER_TITLE_MAP);
|
|
13
13
|
export var TRANSPARENT = 'transparent';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
var _MENUS_CONFIG_MAP;
|
|
2
|
+
var _MENUS_CONFIG_MAP, _SIDE_INSERT_MENUS_CO;
|
|
3
3
|
import { RECENT_USED_HIGHLIGHT_COLORS_KEY, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, RECENT_USED_FONT_COLORS_KEY, DEFAULT_FONT_COLOR, DEFAULT_LAST_USED_FONT_COLOR } from './color';
|
|
4
|
-
import { BLOCKQUOTE, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, ORDERED_LIST, UNORDERED_LIST, CHECK_LIST_ITEM, CODE_BLOCK, LINK, IMAGE, TABLE, SDOC_LINK, FILE_LINK, PARAGRAPH } from './element-type';
|
|
4
|
+
import { BLOCKQUOTE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, ORDERED_LIST, UNORDERED_LIST, CHECK_LIST_ITEM, CODE_BLOCK, LINK, IMAGE, TABLE, SDOC_LINK, FILE_LINK, PARAGRAPH } from './element-type';
|
|
5
5
|
export var UNDO = 'undo';
|
|
6
6
|
export var REDO = 'redo';
|
|
7
7
|
export var CLEAR_FORMAT = 'clear_format';
|
|
@@ -166,8 +166,8 @@ export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CO
|
|
|
166
166
|
text: 'Link_file'
|
|
167
167
|
}), _MENUS_CONFIG_MAP);
|
|
168
168
|
|
|
169
|
-
//
|
|
170
|
-
export var
|
|
169
|
+
// Side transform menu config
|
|
170
|
+
export var SIDE_TRANSFORM_MENUS_CONFIG = [{
|
|
171
171
|
id: PARAGRAPH,
|
|
172
172
|
iconClass: 'sdocfont sdoc-text',
|
|
173
173
|
type: PARAGRAPH,
|
|
@@ -217,24 +217,72 @@ export var SIDE_MENUS_CONFIG = [{
|
|
|
217
217
|
iconClass: 'sdocfont sdoc-check-square',
|
|
218
218
|
type: CHECK_LIST_ITEM,
|
|
219
219
|
text: 'Check_list_item'
|
|
220
|
-
}, {
|
|
221
|
-
id: ALIGN_LEFT,
|
|
222
|
-
iconClass: 'sdocfont sdoc-align-left',
|
|
223
|
-
type: 'left',
|
|
224
|
-
text: 'Left'
|
|
225
|
-
}, {
|
|
226
|
-
id: ALIGN_CENTER,
|
|
227
|
-
iconClass: 'sdocfont sdoc-align-center',
|
|
228
|
-
type: 'center',
|
|
229
|
-
text: 'Center'
|
|
230
|
-
}, {
|
|
231
|
-
id: ALIGN_RIGHT,
|
|
232
|
-
iconClass: 'sdocfont sdoc-align-right',
|
|
233
|
-
type: 'right',
|
|
234
|
-
text: 'Right'
|
|
235
220
|
}, {
|
|
236
221
|
id: BLOCKQUOTE,
|
|
237
222
|
iconClass: 'sdocfont sdoc-quote1',
|
|
238
223
|
type: BLOCKQUOTE,
|
|
239
224
|
text: 'Quote'
|
|
240
|
-
}];
|
|
225
|
+
}];
|
|
226
|
+
|
|
227
|
+
// Side insert menu config
|
|
228
|
+
export var SIDE_INSERT_MENUS_CONFIG = (_SIDE_INSERT_MENUS_CO = {}, _defineProperty(_SIDE_INSERT_MENUS_CO, IMAGE, {
|
|
229
|
+
id: '',
|
|
230
|
+
iconClass: 'sdocfont sdoc-image',
|
|
231
|
+
type: IMAGE,
|
|
232
|
+
text: 'Insert_image'
|
|
233
|
+
}), _defineProperty(_SIDE_INSERT_MENUS_CO, TABLE, {
|
|
234
|
+
id: 'sdoc-side-menu-item-table',
|
|
235
|
+
iconClass: 'sdocfont sdoc-table',
|
|
236
|
+
type: TABLE,
|
|
237
|
+
text: 'Insert_table'
|
|
238
|
+
}), _defineProperty(_SIDE_INSERT_MENUS_CO, LINK, {
|
|
239
|
+
id: '',
|
|
240
|
+
iconClass: 'sdocfont sdoc-link',
|
|
241
|
+
type: LINK,
|
|
242
|
+
text: 'Insert_link'
|
|
243
|
+
}), _defineProperty(_SIDE_INSERT_MENUS_CO, CODE_BLOCK, {
|
|
244
|
+
id: '',
|
|
245
|
+
iconClass: 'sdocfont sdoc-code-block',
|
|
246
|
+
type: CODE_BLOCK,
|
|
247
|
+
text: 'Code_block'
|
|
248
|
+
}), _defineProperty(_SIDE_INSERT_MENUS_CO, ORDERED_LIST, {
|
|
249
|
+
id: '',
|
|
250
|
+
iconClass: 'sdocfont sdoc-list-ol',
|
|
251
|
+
type: ORDERED_LIST,
|
|
252
|
+
text: 'Ordered_list'
|
|
253
|
+
}), _defineProperty(_SIDE_INSERT_MENUS_CO, UNORDERED_LIST, {
|
|
254
|
+
id: '',
|
|
255
|
+
iconClass: 'sdocfont sdoc-list-ul',
|
|
256
|
+
type: UNORDERED_LIST,
|
|
257
|
+
text: 'Unordered_list'
|
|
258
|
+
}), _defineProperty(_SIDE_INSERT_MENUS_CO, CHECK_LIST_ITEM, {
|
|
259
|
+
id: '',
|
|
260
|
+
iconClass: 'sdocfont sdoc-check-square',
|
|
261
|
+
type: CHECK_LIST_ITEM,
|
|
262
|
+
text: 'Check_list_item'
|
|
263
|
+
}), _defineProperty(_SIDE_INSERT_MENUS_CO, PARAGRAPH, {
|
|
264
|
+
id: PARAGRAPH,
|
|
265
|
+
iconClass: 'sdocfont sdoc-text',
|
|
266
|
+
type: PARAGRAPH,
|
|
267
|
+
text: 'Paragraph'
|
|
268
|
+
}), _defineProperty(_SIDE_INSERT_MENUS_CO, HEADER, [{
|
|
269
|
+
id: HEADER1,
|
|
270
|
+
iconClass: 'sdocfont sdoc-header1',
|
|
271
|
+
type: HEADER1,
|
|
272
|
+
text: 'Header_one'
|
|
273
|
+
}, {
|
|
274
|
+
id: HEADER2,
|
|
275
|
+
iconClass: 'sdocfont sdoc-header2',
|
|
276
|
+
type: HEADER2,
|
|
277
|
+
text: 'Header_two'
|
|
278
|
+
}, {
|
|
279
|
+
id: HEADER3,
|
|
280
|
+
iconClass: 'sdocfont sdoc-header3',
|
|
281
|
+
type: HEADER3,
|
|
282
|
+
text: 'Header_three'
|
|
283
|
+
}, {
|
|
284
|
+
id: HEADER4,
|
|
285
|
+
iconClass: 'sdocfont sdoc-header4',
|
|
286
|
+
type: HEADER4,
|
|
287
|
+
text: 'Header_four'
|
|
288
|
+
}]), _SIDE_INSERT_MENUS_CO);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
3
3
|
import { Transforms, Editor, Element } from '@seafile/slate';
|
|
4
|
-
import { CHECK_LIST_ITEM, PARAGRAPH, ELEMENT_TYPE } from '../../constants';
|
|
5
|
-
import { getSelectedNodeByType } from '../../core';
|
|
4
|
+
import { CHECK_LIST_ITEM, PARAGRAPH, ELEMENT_TYPE, INSERT_POSITION } from '../../constants';
|
|
5
|
+
import { getSelectedNodeByType, generateEmptyElement } from '../../core';
|
|
6
6
|
export var isMenuDisabled = function isMenuDisabled(editor, readonly) {
|
|
7
7
|
if (readonly) return true;
|
|
8
8
|
if (editor.selection == null) return true;
|
|
@@ -43,7 +43,15 @@ export var getCheckListItemType = function getCheckListItemType(editor) {
|
|
|
43
43
|
if (!node) return PARAGRAPH;
|
|
44
44
|
return node.type;
|
|
45
45
|
};
|
|
46
|
-
export var setCheckListItemType = function setCheckListItemType(editor, newType) {
|
|
46
|
+
export var setCheckListItemType = function setCheckListItemType(editor, newType, insertPosition) {
|
|
47
|
+
if (insertPosition === INSERT_POSITION.AFTER) {
|
|
48
|
+
var p = generateEmptyElement(PARAGRAPH);
|
|
49
|
+
var path = Editor.path(editor, editor.selection);
|
|
50
|
+
Transforms.insertNodes(editor, p, {
|
|
51
|
+
at: [path[0] + 1]
|
|
52
|
+
});
|
|
53
|
+
Transforms.select(editor, [path[0] + 1]);
|
|
54
|
+
}
|
|
47
55
|
Transforms.setNodes(editor, {
|
|
48
56
|
type: newType
|
|
49
57
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import { Node, Range, Transforms, Element, Editor } from '@seafile/slate';
|
|
4
|
-
import { LIST_ITEM, LIST_LIC, PARAGRAPH } from '../../../constants';
|
|
5
|
-
import { findNode, getNodeEntries, getNodeType, getSelectedNodeEntryByType, isRangeAcrossBlocks } from '../../../core';
|
|
4
|
+
import { LIST_ITEM, LIST_LIC, PARAGRAPH, INSERT_POSITION } from '../../../constants';
|
|
5
|
+
import { findNode, getNodeEntries, getNodeType, getSelectedNodeEntryByType, isRangeAcrossBlocks, generateEmptyElement } from '../../../core';
|
|
6
6
|
import { getListItemEntry, getListTypes } from '../queries';
|
|
7
7
|
import { unwrapList } from './unwrap-list';
|
|
8
8
|
import { generateEmptyList, generateEmptyListItem } from '../model';
|
|
@@ -110,7 +110,18 @@ var wrapRangeList = function wrapRangeList(editor, type) {
|
|
|
110
110
|
});
|
|
111
111
|
});
|
|
112
112
|
};
|
|
113
|
-
var toggleList = function toggleList(editor, type) {
|
|
113
|
+
var toggleList = function toggleList(editor, type, insertPosition) {
|
|
114
|
+
if (insertPosition === INSERT_POSITION.AFTER) {
|
|
115
|
+
var list = generateEmptyList(type);
|
|
116
|
+
var p = generateEmptyElement(PARAGRAPH);
|
|
117
|
+
var path = Editor.path(editor, editor.selection);
|
|
118
|
+
Transforms.insertNodes(editor, p, {
|
|
119
|
+
at: [path[0] + 1]
|
|
120
|
+
});
|
|
121
|
+
Transforms.select(editor, [path[0] + 1]);
|
|
122
|
+
Transforms.wrapNodes(editor, list);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
114
125
|
Editor.withoutNormalizing(editor, function () {
|
|
115
126
|
var selection = editor.selection;
|
|
116
127
|
if (!selection) return false;
|
|
@@ -120,9 +131,9 @@ var toggleList = function toggleList(editor, type) {
|
|
|
120
131
|
if (Range.isCollapsed(selection) || !isRangeAcrossBlocks(editor)) {
|
|
121
132
|
var res = getListItemEntry(editor);
|
|
122
133
|
if (res) {
|
|
123
|
-
var
|
|
134
|
+
var _list = res.list;
|
|
124
135
|
// 选中内容的类型是另一个类型, 如: select_type: ordered_list, 将被切换为 unordered_list
|
|
125
|
-
if (
|
|
136
|
+
if (_list[0].type !== type) {
|
|
126
137
|
var match = function match(n) {
|
|
127
138
|
return getListTypes().includes(getNodeType(n));
|
|
128
139
|
};
|
|
@@ -3,7 +3,8 @@ import slugid from 'slugid';
|
|
|
3
3
|
import { ReactEditor } from '@seafile/slate-react';
|
|
4
4
|
import copy from 'copy-to-clipboard';
|
|
5
5
|
import { toggleList } from '../../plugins/list/transforms';
|
|
6
|
-
import {
|
|
6
|
+
import { generateEmptyElement } from '../../core';
|
|
7
|
+
import { ORDERED_LIST, UNORDERED_LIST, PARAGRAPH, CHECK_LIST_ITEM, IMAGE, TABLE, CODE_BLOCK, BLOCKQUOTE, LIST_ITEM_CORRELATION_TYPE, ADD_POSITION_OFFSET_TYPE, INSERT_POSITION } from '../../constants';
|
|
7
8
|
export var onSetNodeType = function onSetNodeType(editor, element, type) {
|
|
8
9
|
if (!type) return;
|
|
9
10
|
if ([ORDERED_LIST, UNORDERED_LIST].includes(type)) {
|
|
@@ -17,12 +18,6 @@ export var onSetNodeType = function onSetNodeType(editor, element, type) {
|
|
|
17
18
|
});
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
|
-
if (['left', 'center', 'right'].includes(type)) {
|
|
21
|
-
Transforms.setNodes(editor, {
|
|
22
|
-
'align': type
|
|
23
|
-
});
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
21
|
if (type === BLOCKQUOTE && LIST_ITEM_CORRELATION_TYPE.includes(element.type)) {
|
|
27
22
|
Transforms.wrapNodes(editor, {
|
|
28
23
|
id: slugid.nice(),
|
|
@@ -88,4 +83,19 @@ export var isNotSupportTransform = function isNotSupportTransform(node) {
|
|
|
88
83
|
return true;
|
|
89
84
|
}
|
|
90
85
|
return false;
|
|
86
|
+
};
|
|
87
|
+
export var insertElement = function insertElement(editor, type, insertPosition) {
|
|
88
|
+
if (insertPosition === INSERT_POSITION.AFTER) {
|
|
89
|
+
var p = generateEmptyElement(PARAGRAPH);
|
|
90
|
+
var path = Editor.path(editor, editor.selection);
|
|
91
|
+
Transforms.insertNodes(editor, p, {
|
|
92
|
+
at: [path[0] + 1]
|
|
93
|
+
});
|
|
94
|
+
Transforms.select(editor, [path[0] + 1]);
|
|
95
|
+
}
|
|
96
|
+
if (type !== PARAGRAPH) {
|
|
97
|
+
Transforms.setNodes(editor, {
|
|
98
|
+
type: type
|
|
99
|
+
});
|
|
100
|
+
}
|
|
91
101
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
3
|
import React, { useCallback } from 'react';
|
|
3
4
|
import { useSlateStatic } from '@seafile/slate-react';
|
|
4
5
|
import { Transforms } from '@seafile/slate';
|
|
6
|
+
import { insertElement } from './helpers';
|
|
5
7
|
import { insertTable } from '../../plugins/table/helpers';
|
|
6
8
|
import TableSizePopover from '../../plugins/table/popover/table-size-popover';
|
|
7
9
|
import { changeToCodeBlock } from '../../plugins/code-block/helpers';
|
|
8
|
-
import {
|
|
10
|
+
import { toggleList } from '../../plugins/list/transforms';
|
|
11
|
+
import { setCheckListItemType } from '../../plugins/check-list/helpers';
|
|
12
|
+
import { ELEMENT_TYPE, INSERT_POSITION, LOCAL_IMAGE, SIDE_INSERT_MENUS_CONFIG } from '../../constants';
|
|
9
13
|
import EventBus from '../../../utils/event-bus';
|
|
10
14
|
import { INTERNAL_EVENT } from '../../../constants';
|
|
11
15
|
import DropdownMenuItem from '../../commons/dropdown-menu-item';
|
|
@@ -27,7 +31,7 @@ var InsertBlockMenu = function InsertBlockMenu(_ref) {
|
|
|
27
31
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
28
32
|
}, [editor, insertPosition]);
|
|
29
33
|
var createTable = useCallback(function (size) {
|
|
30
|
-
var newInsertPosition = slateNode.type === LIST_ITEM ? INSERT_POSITION.AFTER : insertPosition;
|
|
34
|
+
var newInsertPosition = slateNode.type === ELEMENT_TYPE.LIST_ITEM ? INSERT_POSITION.AFTER : insertPosition;
|
|
31
35
|
insertTable(editor, size, editor.selection, newInsertPosition);
|
|
32
36
|
|
|
33
37
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -43,7 +47,7 @@ var InsertBlockMenu = function InsertBlockMenu(_ref) {
|
|
|
43
47
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
48
|
}, [insertPosition]);
|
|
45
49
|
var onInsertCodeBlock = useCallback(function () {
|
|
46
|
-
var newInsertPosition = slateNode.type === LIST_ITEM ? INSERT_POSITION.AFTER : insertPosition;
|
|
50
|
+
var newInsertPosition = slateNode.type === ELEMENT_TYPE.LIST_ITEM ? INSERT_POSITION.AFTER : insertPosition;
|
|
47
51
|
changeToCodeBlock(editor, 'plaintext', newInsertPosition);
|
|
48
52
|
|
|
49
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -57,15 +61,23 @@ var InsertBlockMenu = function InsertBlockMenu(_ref) {
|
|
|
57
61
|
|
|
58
62
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
63
|
}, [insertPosition]);
|
|
64
|
+
var onInsertList = useCallback(function (type) {
|
|
65
|
+
toggleList(editor, type, insertPosition);
|
|
66
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
+
}, [editor, insertPosition, slateNode]);
|
|
68
|
+
var onInsertCheckList = useCallback(function () {
|
|
69
|
+
setCheckListItemType(editor, ELEMENT_TYPE.CHECK_LIST_ITEM, insertPosition);
|
|
70
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
71
|
+
}, [editor, insertPosition, slateNode]);
|
|
72
|
+
var onInsert = useCallback(function (type) {
|
|
73
|
+
insertElement(editor, type, insertPosition);
|
|
74
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
75
|
+
}, [editor, insertPosition, slateNode]);
|
|
60
76
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
61
|
-
menuConfig: _objectSpread(
|
|
62
|
-
id: ''
|
|
63
|
-
}),
|
|
77
|
+
menuConfig: _objectSpread({}, SIDE_INSERT_MENUS_CONFIG[ELEMENT_TYPE.IMAGE]),
|
|
64
78
|
onClick: onInsertImageToggle
|
|
65
79
|
}), /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
66
|
-
menuConfig: _objectSpread(
|
|
67
|
-
id: 'sdoc-side-menu-item-table'
|
|
68
|
-
}),
|
|
80
|
+
menuConfig: _objectSpread({}, SIDE_INSERT_MENUS_CONFIG[ELEMENT_TYPE.TABLE]),
|
|
69
81
|
className: "pr-2"
|
|
70
82
|
}, /*#__PURE__*/React.createElement("i", {
|
|
71
83
|
className: "sdocfont sdoc-right-slide sdoc-dropdown-item-right-icon"
|
|
@@ -77,15 +89,32 @@ var InsertBlockMenu = function InsertBlockMenu(_ref) {
|
|
|
77
89
|
createTable: createTable,
|
|
78
90
|
openDialog: openTableDialog
|
|
79
91
|
})), /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
80
|
-
menuConfig: _objectSpread(
|
|
81
|
-
id: ''
|
|
82
|
-
}),
|
|
92
|
+
menuConfig: _objectSpread({}, SIDE_INSERT_MENUS_CONFIG[ELEMENT_TYPE.LINK]),
|
|
83
93
|
onClick: openLinkDialog
|
|
84
94
|
}), /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
85
|
-
menuConfig: _objectSpread(
|
|
86
|
-
id: ''
|
|
87
|
-
}),
|
|
95
|
+
menuConfig: _objectSpread({}, SIDE_INSERT_MENUS_CONFIG[ELEMENT_TYPE.CODE_BLOCK]),
|
|
88
96
|
onClick: onInsertCodeBlock
|
|
97
|
+
}), /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
98
|
+
menuConfig: _objectSpread({}, SIDE_INSERT_MENUS_CONFIG[ELEMENT_TYPE.UNORDERED_LIST]),
|
|
99
|
+
onClick: function onClick() {
|
|
100
|
+
onInsertList(ELEMENT_TYPE.UNORDERED_LIST);
|
|
101
|
+
}
|
|
102
|
+
}), /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
103
|
+
menuConfig: _objectSpread({}, SIDE_INSERT_MENUS_CONFIG[ELEMENT_TYPE.ORDERED_LIST]),
|
|
104
|
+
onClick: function onClick() {
|
|
105
|
+
onInsertList(ELEMENT_TYPE.ORDERED_LIST);
|
|
106
|
+
}
|
|
107
|
+
}), /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
108
|
+
menuConfig: _objectSpread({}, SIDE_INSERT_MENUS_CONFIG[ELEMENT_TYPE.CHECK_LIST_ITEM]),
|
|
109
|
+
onClick: onInsertCheckList
|
|
110
|
+
}), [SIDE_INSERT_MENUS_CONFIG[ELEMENT_TYPE.PARAGRAPH]].concat(_toConsumableArray(SIDE_INSERT_MENUS_CONFIG[ELEMENT_TYPE.HEADER])).map(function (item) {
|
|
111
|
+
return /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
112
|
+
key: item.id,
|
|
113
|
+
menuConfig: item,
|
|
114
|
+
onClick: function onClick() {
|
|
115
|
+
return onInsert(item.type);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
89
118
|
}));
|
|
90
119
|
};
|
|
91
120
|
InsertBlockMenu.defaultProps = {
|
|
@@ -58,7 +58,7 @@ var SideMenu = function SideMenu(_ref) {
|
|
|
58
58
|
}, /*#__PURE__*/React.createElement("div", {
|
|
59
59
|
className: "sdoc-side-menu sdoc-dropdown-menu",
|
|
60
60
|
ref: sideMenuRef
|
|
61
|
-
}, /*#__PURE__*/React.createElement(React.Fragment, null, !isNotSupportTransform(slateNode) && /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
61
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, !isNodeEmpty && !isNotSupportTransform(slateNode) && /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
62
62
|
menuConfig: {
|
|
63
63
|
id: 'sdoc-side-menu-item-transform',
|
|
64
64
|
text: 'Transform_to',
|
|
@@ -3,7 +3,7 @@ import { UncontrolledPopover } from 'reactstrap';
|
|
|
3
3
|
import { withTranslation } from 'react-i18next';
|
|
4
4
|
import { useSlateStatic } from '@seafile/slate-react';
|
|
5
5
|
import { onSetNodeType } from './helpers';
|
|
6
|
-
import {
|
|
6
|
+
import { SIDE_TRANSFORM_MENUS_CONFIG, LIST_ITEM_SUPPORTED_TRANSFORMATION, LIST_ITEM_CORRELATION_TYPE } from '../../constants';
|
|
7
7
|
import DropdownMenuItem from '../../commons/dropdown-menu-item';
|
|
8
8
|
var TransformMenus = function TransformMenus(_ref) {
|
|
9
9
|
var target = _ref.target,
|
|
@@ -16,10 +16,10 @@ var TransformMenus = function TransformMenus(_ref) {
|
|
|
16
16
|
onReset();
|
|
17
17
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
18
|
}, []);
|
|
19
|
-
var getSideMenusConfig = useCallback(function (
|
|
20
|
-
var newSideMenusConfig =
|
|
19
|
+
var getSideMenusConfig = useCallback(function (SIDE_TRANSFORM_MENUS_CONFIG) {
|
|
20
|
+
var newSideMenusConfig = SIDE_TRANSFORM_MENUS_CONFIG;
|
|
21
21
|
if (LIST_ITEM_CORRELATION_TYPE.includes(slateNode.type)) {
|
|
22
|
-
newSideMenusConfig =
|
|
22
|
+
newSideMenusConfig = SIDE_TRANSFORM_MENUS_CONFIG.filter(function (item) {
|
|
23
23
|
return LIST_ITEM_SUPPORTED_TRANSFORMATION.includes(item.type);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -36,7 +36,7 @@ var TransformMenus = function TransformMenus(_ref) {
|
|
|
36
36
|
fade: false
|
|
37
37
|
}, /*#__PURE__*/React.createElement("div", {
|
|
38
38
|
className: "sdoc-dropdown-menu-container"
|
|
39
|
-
}, getSideMenusConfig(
|
|
39
|
+
}, getSideMenusConfig(SIDE_TRANSFORM_MENUS_CONFIG).map(function (item) {
|
|
40
40
|
return /*#__PURE__*/React.createElement(DropdownMenuItem, {
|
|
41
41
|
key: item.id,
|
|
42
42
|
menuConfig: item,
|
package/package.json
CHANGED
|
@@ -347,6 +347,7 @@
|
|
|
347
347
|
"Icon_and_text_Link": "Icon and text Link",
|
|
348
348
|
"Card": "Card",
|
|
349
349
|
"Select_sdoc_document": "Select sdoc document",
|
|
350
|
+
"Select_file": "Select file",
|
|
350
351
|
"Local_file": "Local file",
|
|
351
352
|
"Internal_server_exec_operations_error": "An exception occurred on the server, please refresh the page and try again",
|
|
352
353
|
"Failed_to_sync_with_server_operations": "Synchronization with the server failed, please refresh the page",
|
|
@@ -362,5 +363,17 @@
|
|
|
362
363
|
"No_changes": "No changes",
|
|
363
364
|
"Title": "Název",
|
|
364
365
|
"Subtitle": "Subtitle",
|
|
365
|
-
"Link_sdoc": "Link sdoc"
|
|
366
|
+
"Link_sdoc": "Link sdoc",
|
|
367
|
+
"Link_file": "Link file",
|
|
368
|
+
"Keep_my_modification": "Keep my modification",
|
|
369
|
+
"Keep_other_modification": "Keep other's modification",
|
|
370
|
+
"Keep_both_modification": "Keep my modification",
|
|
371
|
+
"Tip": "Tip",
|
|
372
|
+
"Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
|
|
373
|
+
"Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
|
|
374
|
+
"Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
|
|
375
|
+
"Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
|
|
376
|
+
"Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
|
|
377
|
+
"Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
|
|
378
|
+
"Has_been_removed_tip": "Document has been removed, please view other documents."
|
|
366
379
|
}
|
|
@@ -347,6 +347,7 @@
|
|
|
347
347
|
"Icon_and_text_Link": "Icon and text Link",
|
|
348
348
|
"Card": "Card",
|
|
349
349
|
"Select_sdoc_document": "Select sdoc document",
|
|
350
|
+
"Select_file": "Select file",
|
|
350
351
|
"Local_file": "Local file",
|
|
351
352
|
"Internal_server_exec_operations_error": "An exception occurred on the server, please refresh the page and try again",
|
|
352
353
|
"Failed_to_sync_with_server_operations": "Synchronization with the server failed, please refresh the page",
|
|
@@ -362,5 +363,17 @@
|
|
|
362
363
|
"No_changes": "No changes",
|
|
363
364
|
"Title": "Titel",
|
|
364
365
|
"Subtitle": "Subtitle",
|
|
365
|
-
"Link_sdoc": "Link sdoc"
|
|
366
|
+
"Link_sdoc": "Link sdoc",
|
|
367
|
+
"Link_file": "Link file",
|
|
368
|
+
"Keep_my_modification": "Keep my modification",
|
|
369
|
+
"Keep_other_modification": "Keep other's modification",
|
|
370
|
+
"Keep_both_modification": "Keep my modification",
|
|
371
|
+
"Tip": "Tip",
|
|
372
|
+
"Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
|
|
373
|
+
"Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
|
|
374
|
+
"Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
|
|
375
|
+
"Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
|
|
376
|
+
"Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
|
|
377
|
+
"Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
|
|
378
|
+
"Has_been_removed_tip": "Document has been removed, please view other documents."
|
|
366
379
|
}
|
|
@@ -347,6 +347,7 @@
|
|
|
347
347
|
"Icon_and_text_Link": "Icon and text Link",
|
|
348
348
|
"Card": "Card",
|
|
349
349
|
"Select_sdoc_document": "Select sdoc document",
|
|
350
|
+
"Select_file": "Select file",
|
|
350
351
|
"Local_file": "Local file",
|
|
351
352
|
"Internal_server_exec_operations_error": "An exception occurred on the server, please refresh the page and try again",
|
|
352
353
|
"Failed_to_sync_with_server_operations": "Synchronization with the server failed, please refresh the page",
|
|
@@ -362,5 +363,17 @@
|
|
|
362
363
|
"No_changes": "No changes",
|
|
363
364
|
"Title": "Título",
|
|
364
365
|
"Subtitle": "Subtitle",
|
|
365
|
-
"Link_sdoc": "Link sdoc"
|
|
366
|
+
"Link_sdoc": "Link sdoc",
|
|
367
|
+
"Link_file": "Link file",
|
|
368
|
+
"Keep_my_modification": "Keep my modification",
|
|
369
|
+
"Keep_other_modification": "Keep other's modification",
|
|
370
|
+
"Keep_both_modification": "Keep my modification",
|
|
371
|
+
"Tip": "Tip",
|
|
372
|
+
"Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
|
|
373
|
+
"Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
|
|
374
|
+
"Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
|
|
375
|
+
"Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
|
|
376
|
+
"Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
|
|
377
|
+
"Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
|
|
378
|
+
"Has_been_removed_tip": "Document has been removed, please view other documents."
|
|
366
379
|
}
|
|
@@ -364,5 +364,16 @@
|
|
|
364
364
|
"Title": "Titre",
|
|
365
365
|
"Subtitle": "Sous-titre",
|
|
366
366
|
"Link_sdoc": "Lien sdoc",
|
|
367
|
-
"Link_file": "Link file"
|
|
367
|
+
"Link_file": "Link file",
|
|
368
|
+
"Keep_my_modification": "Keep my modification",
|
|
369
|
+
"Keep_other_modification": "Keep other's modification",
|
|
370
|
+
"Keep_both_modification": "Keep my modification",
|
|
371
|
+
"Tip": "Tip",
|
|
372
|
+
"Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
|
|
373
|
+
"Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
|
|
374
|
+
"Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
|
|
375
|
+
"Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
|
|
376
|
+
"Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
|
|
377
|
+
"Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
|
|
378
|
+
"Has_been_removed_tip": "Document has been removed, please view other documents."
|
|
368
379
|
}
|
|
@@ -343,11 +343,11 @@
|
|
|
343
343
|
"Default_font": "Default font",
|
|
344
344
|
"Pending_operations_exceed_limit": "There are multiple operations not synced to the server. Please check your network.",
|
|
345
345
|
"Recently_saved": "Recently saved",
|
|
346
|
-
"Sdoc_document" : "Sdoc document",
|
|
347
346
|
"Text_Link": "Text Link",
|
|
348
347
|
"Icon_and_text_Link": "Icon and text Link",
|
|
349
348
|
"Card": "Card",
|
|
350
349
|
"Select_sdoc_document": "Select sdoc document",
|
|
350
|
+
"Select_file": "Select file",
|
|
351
351
|
"Local_file": "Local file",
|
|
352
352
|
"Internal_server_exec_operations_error": "An exception occurred on the server, please refresh the page and try again",
|
|
353
353
|
"Failed_to_sync_with_server_operations": "Synchronization with the server failed, please refresh the page",
|
|
@@ -362,5 +362,18 @@
|
|
|
362
362
|
"Changes": "Modifiche",
|
|
363
363
|
"No_changes": "No changes",
|
|
364
364
|
"Title": "Titolo",
|
|
365
|
-
"
|
|
365
|
+
"Subtitle": "Subtitle",
|
|
366
|
+
"Link_sdoc": "Link sdoc",
|
|
367
|
+
"Link_file": "Link file",
|
|
368
|
+
"Keep_my_modification": "Keep my modification",
|
|
369
|
+
"Keep_other_modification": "Keep other's modification",
|
|
370
|
+
"Keep_both_modification": "Keep my modification",
|
|
371
|
+
"Tip": "Tip",
|
|
372
|
+
"Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
|
|
373
|
+
"Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
|
|
374
|
+
"Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
|
|
375
|
+
"Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
|
|
376
|
+
"Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
|
|
377
|
+
"Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
|
|
378
|
+
"Has_been_removed_tip": "Document has been removed, please view other documents."
|
|
366
379
|
}
|
|
@@ -347,7 +347,7 @@
|
|
|
347
347
|
"Icon_and_text_Link": "Значок и текстовая ссылка",
|
|
348
348
|
"Card": "Карта",
|
|
349
349
|
"Select_sdoc_document": "Выбрать документ sdoc",
|
|
350
|
-
"Select_file": "
|
|
350
|
+
"Select_file": "Выбрать файл",
|
|
351
351
|
"Local_file": "Заблокировать файл",
|
|
352
352
|
"Internal_server_exec_operations_error": "На сервере произошло исключение. Обновите страницу и повторите попытку",
|
|
353
353
|
"Failed_to_sync_with_server_operations": "Не удалось синхронизироваться с сервером, обновите страницу.",
|
|
@@ -364,5 +364,16 @@
|
|
|
364
364
|
"Title": "Название",
|
|
365
365
|
"Subtitle": "Подзаголовок",
|
|
366
366
|
"Link_sdoc": "Ссылка на sdoc",
|
|
367
|
-
"Link_file": "
|
|
367
|
+
"Link_file": "Ссылка на файл",
|
|
368
|
+
"Keep_my_modification": "Keep my modification",
|
|
369
|
+
"Keep_other_modification": "Keep other's modification",
|
|
370
|
+
"Keep_both_modification": "Keep my modification",
|
|
371
|
+
"Tip": "Tip",
|
|
372
|
+
"Rebase_delete_no_change_revision_tip": "Revision has not made any change compared to original document. Do you want to delete this revision?",
|
|
373
|
+
"Has_been_replaced_tip": "Document content has been replaced. Please refresh the page.",
|
|
374
|
+
"Has_been_published_tip": "Revision has been published, Automatically jump to source content after {{ time }} seconds.",
|
|
375
|
+
"Has_conflict_before_publish_tip": "There are conflicts in the document, please resolve it before publishing!",
|
|
376
|
+
"Merge_tip": "There are conflicts in the documents. Do you want to merge them?",
|
|
377
|
+
"Has_conflict_before_view_changes_tip": "There are conflicts in the document. Please resolve the conflict before viewing the changes!",
|
|
378
|
+
"Has_been_removed_tip": "Document has been removed, please view other documents."
|
|
368
379
|
}
|
|
@@ -367,11 +367,13 @@
|
|
|
367
367
|
"Link_file": "文件链接",
|
|
368
368
|
"Keep_my_modification": "保留我的更改",
|
|
369
369
|
"Keep_other_modification": "保留其他的更改",
|
|
370
|
-
"Keep_both_modification": "
|
|
370
|
+
"Keep_both_modification": "保留我的更改",
|
|
371
|
+
"Tip": "提示",
|
|
371
372
|
"Rebase_delete_no_change_revision_tip": "修订改没有更改,是否删除修订稿?",
|
|
372
373
|
"Has_been_replaced_tip": "文档内容已经被替换,请刷新页面。",
|
|
373
374
|
"Has_been_published_tip": "修订稿已经发布了,{{ time }} 秒后自动跳转到源文件。",
|
|
374
375
|
"Has_conflict_before_publish_tip": "文档有冲突,请解决冲突后再发布!",
|
|
375
376
|
"Merge_tip": "文档有冲突,是否合并?",
|
|
376
|
-
"Has_conflict_before_view_changes_tip": "文档有冲突,请解决冲突后再查看更改!"
|
|
377
|
+
"Has_conflict_before_view_changes_tip": "文档有冲突,请解决冲突后再查看更改!",
|
|
378
|
+
"Has_been_removed_tip": "文档已经被删除,请查看其他文档"
|
|
377
379
|
}
|