@seafile/sdoc-editor 1.0.154 → 1.0.156
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/assets/css/dropdown-menu.css +4 -3
- package/dist/basic-sdk/extension/constants/index.js +6 -0
- package/dist/basic-sdk/extension/constants/menus-config.js +0 -2
- package/dist/basic-sdk/extension/plugins/font/menu/font-size/index.css +0 -1
- package/dist/basic-sdk/extension/plugins/header/menu/style.css +0 -1
- package/dist/basic-sdk/extension/plugins/quick-insert/render-elem.js +2 -2
- package/dist/basic-sdk/extension/plugins/table/menu/vertical-align-popover/style.css +6 -3
- package/dist/basic-sdk/extension/plugins/table/popover/table-size-popover/index.css +4 -0
- package/dist/basic-sdk/extension/plugins/text-align/menu/index.css +0 -1
- package/dist/basic-sdk/extension/toolbar/insert-element-toolbar/const.js +2 -28
- package/dist/basic-sdk/extension/toolbar/insert-element-toolbar/index.js +47 -29
- package/dist/basic-sdk/extension/toolbar/insert-element-toolbar/style.css +5 -0
- package/dist/basic-sdk/extension/toolbar/side-toolbar/helpers.js +5 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/insert-block-menu.js +1 -0
- package/dist/basic-sdk/extension/toolbar/side-toolbar/side-menu.js +5 -5
- package/dist/basic-sdk/layout/article-container.js +6 -2
- package/package.json +1 -1
- package/public/media/sdoc-editor-font/iconfont.eot +0 -0
- package/public/media/sdoc-editor-font/iconfont.svg +2 -2
- package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
- package/public/media/sdoc-editor-font.css +14 -11
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
.sdoc-dropdown-menu .sdoc-dropdown-menu-item-hidden {
|
|
52
|
-
|
|
52
|
+
display: none;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
.sdoc-dropdown-menu .sdoc-dropdown-menu-item.disabled,
|
|
@@ -82,11 +82,12 @@
|
|
|
82
82
|
|
|
83
83
|
.sdoc-dropdown-menu .sdoc-dropdown-item-content .sdoc-dropdown-item-content-icon {
|
|
84
84
|
margin-right: 10px;
|
|
85
|
+
vertical-align: 1px;
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
.sdoc-dropdown-menu .sdoc-dropdown-item-right-icon {
|
|
88
89
|
color: #999;
|
|
89
|
-
transform: scale(.
|
|
90
|
+
transform: scale(.8);
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
.sdoc-dropdown-menu .sdoc-dropdown-item-with-left-icon {
|
|
@@ -95,8 +96,8 @@
|
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
.sdoc-dropdown-menu .sdoc-check-mark {
|
|
98
|
-
transform: scale(.8);
|
|
99
99
|
color: #798d99;
|
|
100
|
+
transform: scale(1);
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
/* sub menu */
|
|
@@ -337,6 +337,12 @@ Object.defineProperty(exports, "SDOC_LINK", {
|
|
|
337
337
|
return _elementType.SDOC_LINK;
|
|
338
338
|
}
|
|
339
339
|
});
|
|
340
|
+
Object.defineProperty(exports, "SEATABLE_COLUMN", {
|
|
341
|
+
enumerable: true,
|
|
342
|
+
get: function () {
|
|
343
|
+
return _elementType.SEATABLE_COLUMN;
|
|
344
|
+
}
|
|
345
|
+
});
|
|
340
346
|
Object.defineProperty(exports, "SEATABLE_TABLE", {
|
|
341
347
|
enumerable: true,
|
|
342
348
|
get: function () {
|
|
@@ -414,12 +414,10 @@ const SIDE_INSERT_MENUS_SEARCH_MAP = exports.SIDE_INSERT_MENUS_SEARCH_MAP = {
|
|
|
414
414
|
[_elementType.IMAGE]: 'Image',
|
|
415
415
|
[_elementType.VIDEO]: 'Video',
|
|
416
416
|
[_elementType.TABLE]: 'Table',
|
|
417
|
-
[_elementType.MULTI_COLUMN]: 'Multi_column',
|
|
418
417
|
[_elementType.COLUMN]: 'Column',
|
|
419
418
|
[_elementType.TWO_COLUMN]: 'Two_column',
|
|
420
419
|
[_elementType.THREE_COLUMN]: 'Three_column',
|
|
421
420
|
[_elementType.FOUR_COLUMN]: 'Four_column',
|
|
422
|
-
[_elementType.FIVE_COLUMN]: 'Five_column',
|
|
423
421
|
[_elementType.LINK]: 'Link',
|
|
424
422
|
[_elementType.CODE_BLOCK]: 'Code_block',
|
|
425
423
|
[_elementType.CALL_OUT]: 'Callout',
|
|
@@ -31,9 +31,10 @@ const RenderQuickInsert = (_ref, editor, readonly) => {
|
|
|
31
31
|
const scrollRef = (0, _useScrollContext.useScrollContext)();
|
|
32
32
|
const insertElmRef = (0, _react.useRef)(null);
|
|
33
33
|
const aboveBlockNode = (0, _core.getAboveBlockNode)(editor);
|
|
34
|
-
const searchText = _slate.Node.string(element);
|
|
35
34
|
const isEmptyNode = (0, _helpers.isVoidNode)(aboveBlockNode === null || aboveBlockNode === void 0 ? void 0 : aboveBlockNode[0]);
|
|
36
35
|
const handleClick = (0, _react.useCallback)(e => {
|
|
36
|
+
// Click the search input
|
|
37
|
+
if (sideMenuRef.current.contains(e.target) && e.target.tagName === 'INPUT') return;
|
|
37
38
|
if (!insertElmRef.current.contains(e.target)) {
|
|
38
39
|
(0, _helper.transformToText)(editor, element);
|
|
39
40
|
}
|
|
@@ -88,7 +89,6 @@ const RenderQuickInsert = (_ref, editor, readonly) => {
|
|
|
88
89
|
isEmptyNode: isEmptyNode,
|
|
89
90
|
insertPosition: isEmptyNode ? _constants.INSERT_POSITION.CURRENT : _constants.INSERT_POSITION.AFTER,
|
|
90
91
|
slateNode: aboveBlockNode === null || aboveBlockNode === void 0 ? void 0 : aboveBlockNode[0],
|
|
91
|
-
searchText: searchText,
|
|
92
92
|
callback: handleInsertBlock
|
|
93
93
|
})))));
|
|
94
94
|
};
|
|
@@ -9,13 +9,16 @@
|
|
|
9
9
|
|
|
10
10
|
.sdoc-table-alignment-menu .sdoc-dropdown-menu-item .sdoc-checked {
|
|
11
11
|
margin-right: 6px;
|
|
12
|
-
|
|
13
|
-
height:
|
|
12
|
+
height: 21px;
|
|
13
|
+
line-height: 21px;
|
|
14
|
+
width: 12px;
|
|
14
15
|
}
|
|
16
|
+
|
|
15
17
|
.sdoc-table-alignment-menu .sdoc-dropdown-menu-item .sdoc-check-mark {
|
|
16
18
|
display: none;
|
|
17
|
-
font-size:
|
|
19
|
+
font-size: 12px !important;
|
|
18
20
|
}
|
|
21
|
+
|
|
19
22
|
.sdoc-table-alignment-menu .sdoc-dropdown-menu-item .sdoc-check-mark.active {
|
|
20
23
|
display: inline;
|
|
21
24
|
}
|
|
@@ -3,31 +3,5 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
const SELECTED_ITEM_CLASS_NAME = exports.SELECTED_ITEM_CLASS_NAME = 'sdoc-dropdown-item-selected';
|
|
9
|
-
const SHORT_INSERT_ELEMENT_USER_INPUT_MAP = exports.SHORT_INSERT_ELEMENT_USER_INPUT_MAP = {
|
|
10
|
-
[_constants.IMAGE]: 'image',
|
|
11
|
-
[_constants.TABLE]: 'table',
|
|
12
|
-
[_constants.LINK]: 'link',
|
|
13
|
-
[_constants.CODE_BLOCK]: 'code block',
|
|
14
|
-
[_constants.CALL_OUT]: 'callout',
|
|
15
|
-
[_constants.UNORDERED_LIST]: 'unorder list',
|
|
16
|
-
[_constants.ORDERED_LIST]: 'order list',
|
|
17
|
-
[_constants.CHECK_LIST_ITEM]: 'check list',
|
|
18
|
-
[_constants.PARAGRAPH]: 'paragraph',
|
|
19
|
-
[_constants.HEADER1]: 'header 1',
|
|
20
|
-
[_constants.HEADER2]: 'header 2',
|
|
21
|
-
[_constants.HEADER3]: 'header 3',
|
|
22
|
-
[_constants.HEADER4]: 'header 4',
|
|
23
|
-
[_constants.HEADER5]: 'header 5',
|
|
24
|
-
[_constants.HEADER6]: 'header 6',
|
|
25
|
-
[_constants.BLOCKQUOTE]: 'quote',
|
|
26
|
-
[_constants.MULTI_COLUMN]: 'multi_column',
|
|
27
|
-
[_constants.COLUMN]: 'column',
|
|
28
|
-
[_constants.TWO_COLUMN]: 'two_column',
|
|
29
|
-
[_constants.THREE_COLUMN]: 'three_column',
|
|
30
|
-
[_constants.FOUR_COLUMN]: 'four_column',
|
|
31
|
-
[_constants.FIVE_COLUMN]: 'five_column',
|
|
32
|
-
[_constants.VIDEO]: 'video'
|
|
33
|
-
};
|
|
6
|
+
exports.SELECTED_ITEM_CLASS_NAME = void 0;
|
|
7
|
+
const SELECTED_ITEM_CLASS_NAME = exports.SELECTED_ITEM_CLASS_NAME = 'sdoc-dropdown-item-selected';
|
|
@@ -9,6 +9,8 @@ exports.default = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _slateReact = require("@seafile/slate-react");
|
|
11
11
|
var _slate = require("@seafile/slate");
|
|
12
|
+
var _reactI18next = require("react-i18next");
|
|
13
|
+
var _reactstrap = require("reactstrap");
|
|
12
14
|
var _helpers = require("../side-toolbar/helpers");
|
|
13
15
|
var _helpers2 = require("../../plugins/table/helpers");
|
|
14
16
|
var _tableSizePopover = _interopRequireDefault(require("../../plugins/table/popover/table-size-popover"));
|
|
@@ -30,14 +32,14 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
30
32
|
let {
|
|
31
33
|
insertPosition,
|
|
32
34
|
slateNode,
|
|
33
|
-
searchText,
|
|
34
35
|
callback,
|
|
35
|
-
isEmptyNode
|
|
36
|
+
isEmptyNode,
|
|
37
|
+
t
|
|
36
38
|
} = _ref;
|
|
37
39
|
const editor = (0, _slateReact.useSlateStatic)();
|
|
38
|
-
const [currentSelectIndex, setCurrentSelectIndex] = (0, _react.useState)(0);
|
|
39
|
-
const renderItemListRef = (0, _react.useRef)([]);
|
|
40
40
|
const downDownWrapperRef = (0, _react.useRef)(null);
|
|
41
|
+
const [currentSelectIndex, setCurrentSelectIndex] = (0, _react.useState)(0);
|
|
42
|
+
const [quickInsertMenuSearchMap, setQuickInsertMenuSearchMap] = (0, _react.useState)(_constants.SIDE_INSERT_MENUS_SEARCH_MAP);
|
|
41
43
|
const onInsertImageToggle = (0, _react.useCallback)(() => {
|
|
42
44
|
callback && callback();
|
|
43
45
|
const eventBus = _eventBus.default.getInstance();
|
|
@@ -145,6 +147,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
145
147
|
const dropDownItems = (0, _react.useMemo)(() => {
|
|
146
148
|
let items = {
|
|
147
149
|
[_constants.IMAGE]: /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
150
|
+
isHidden: !quickInsertMenuSearchMap[_constants.IMAGE],
|
|
148
151
|
disabled: isDisableImage,
|
|
149
152
|
key: "sdoc-insert-menu-image",
|
|
150
153
|
menuConfig: {
|
|
@@ -153,6 +156,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
153
156
|
onClick: onInsertImageToggle
|
|
154
157
|
}),
|
|
155
158
|
[_constants.VIDEO]: /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
159
|
+
isHidden: !quickInsertMenuSearchMap[_constants.VIDEO],
|
|
156
160
|
disabled: isDisableVideo,
|
|
157
161
|
key: "sdoc-insert-menu-video",
|
|
158
162
|
menuConfig: {
|
|
@@ -164,6 +168,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
164
168
|
/*#__PURE__*/
|
|
165
169
|
// eslint-disable-next-line react/jsx-indent
|
|
166
170
|
_react.default.createElement(_dropdownMenuItem.default, {
|
|
171
|
+
isHidden: !quickInsertMenuSearchMap[_constants.TABLE],
|
|
167
172
|
key: "sdoc-insert-menu-tabe",
|
|
168
173
|
menuConfig: {
|
|
169
174
|
..._constants.SIDE_INSERT_MENUS_CONFIG[_constants.ELEMENT_TYPE.TABLE]
|
|
@@ -180,6 +185,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
180
185
|
createTable: createTable
|
|
181
186
|
})),
|
|
182
187
|
[_constants.LINK]: /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
188
|
+
isHidden: !quickInsertMenuSearchMap[_constants.LINK],
|
|
183
189
|
key: "sdoc-insert-menu-link",
|
|
184
190
|
menuConfig: {
|
|
185
191
|
..._constants.SIDE_INSERT_MENUS_CONFIG[_constants.ELEMENT_TYPE.LINK]
|
|
@@ -187,6 +193,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
187
193
|
onClick: openLinkDialog
|
|
188
194
|
}),
|
|
189
195
|
[_constants.BLOCKQUOTE]: /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
196
|
+
isHidden: !quickInsertMenuSearchMap[_constants.BLOCKQUOTE],
|
|
190
197
|
key: "sdoc-insert-menu-blockquote",
|
|
191
198
|
menuConfig: {
|
|
192
199
|
..._constants.SIDE_INSERT_MENUS_CONFIG[_constants.ELEMENT_TYPE.BLOCKQUOTE]
|
|
@@ -194,6 +201,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
194
201
|
onClick: onInsertBlockQuote
|
|
195
202
|
}),
|
|
196
203
|
[_constants.CODE_BLOCK]: /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
204
|
+
isHidden: !quickInsertMenuSearchMap[_constants.CODE_BLOCK],
|
|
197
205
|
key: "sdoc-insert-menu-code-block",
|
|
198
206
|
menuConfig: {
|
|
199
207
|
..._constants.SIDE_INSERT_MENUS_CONFIG[_constants.ELEMENT_TYPE.CODE_BLOCK]
|
|
@@ -201,6 +209,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
201
209
|
onClick: onInsertCodeBlock
|
|
202
210
|
}),
|
|
203
211
|
[_constants.CALL_OUT]: /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
212
|
+
isHidden: !quickInsertMenuSearchMap[_constants.CALL_OUT],
|
|
204
213
|
disabled: isDisableCallout,
|
|
205
214
|
key: "sdoc-insert-menu-callout",
|
|
206
215
|
menuConfig: {
|
|
@@ -209,6 +218,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
209
218
|
onClick: () => onInsertCallout(_constants.PARAGRAPH)
|
|
210
219
|
}),
|
|
211
220
|
[_constants.UNORDERED_LIST]: /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
221
|
+
isHidden: !quickInsertMenuSearchMap[_constants.UNORDERED_LIST],
|
|
212
222
|
key: "sdoc-insert-menu-unorder-list",
|
|
213
223
|
menuConfig: {
|
|
214
224
|
..._constants.SIDE_INSERT_MENUS_CONFIG[_constants.ELEMENT_TYPE.UNORDERED_LIST]
|
|
@@ -218,6 +228,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
218
228
|
}
|
|
219
229
|
}),
|
|
220
230
|
[_constants.ORDERED_LIST]: /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
231
|
+
isHidden: !quickInsertMenuSearchMap[_constants.ORDERED_LIST],
|
|
221
232
|
key: "sdoc-insert-menu-order-list",
|
|
222
233
|
menuConfig: {
|
|
223
234
|
..._constants.SIDE_INSERT_MENUS_CONFIG[_constants.ELEMENT_TYPE.ORDERED_LIST]
|
|
@@ -227,6 +238,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
227
238
|
}
|
|
228
239
|
}),
|
|
229
240
|
[_constants.CHECK_LIST_ITEM]: /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
241
|
+
isHidden: !quickInsertMenuSearchMap[_constants.CHECK_LIST_ITEM],
|
|
230
242
|
key: "sdoc-insert-menu-check-list",
|
|
231
243
|
menuConfig: {
|
|
232
244
|
..._constants.SIDE_INSERT_MENUS_CONFIG[_constants.ELEMENT_TYPE.CHECK_LIST_ITEM]
|
|
@@ -234,6 +246,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
234
246
|
onClick: onInsertCheckList
|
|
235
247
|
}),
|
|
236
248
|
[_constants.PARAGRAPH]: /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
249
|
+
isHidden: !quickInsertMenuSearchMap[_constants.PARAGRAPH],
|
|
237
250
|
disabled: isEmptyNode,
|
|
238
251
|
key: "sdoc-insert-menu-paragraph",
|
|
239
252
|
menuConfig: {
|
|
@@ -244,6 +257,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
244
257
|
};
|
|
245
258
|
_constants.SIDE_INSERT_MENUS_CONFIG[_constants.ELEMENT_TYPE.HEADER].forEach(item => {
|
|
246
259
|
items[item.id.toLowerCase()] = /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
260
|
+
isHidden: !quickInsertMenuSearchMap[item.type],
|
|
247
261
|
key: item.id,
|
|
248
262
|
menuConfig: item,
|
|
249
263
|
onClick: () => onInsert(item.type)
|
|
@@ -251,6 +265,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
251
265
|
});
|
|
252
266
|
_constants.SIDE_INSERT_MENUS_CONFIG[_constants.ELEMENT_TYPE.MULTI_COLUMN].forEach(item => {
|
|
253
267
|
items[item.id.toLowerCase()] = /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
268
|
+
isHidden: !quickInsertMenuSearchMap[item.type],
|
|
254
269
|
className: "sdoc-insert-menu-multi-column",
|
|
255
270
|
key: item.id,
|
|
256
271
|
menuConfig: item,
|
|
@@ -258,7 +273,7 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
258
273
|
});
|
|
259
274
|
});
|
|
260
275
|
return items;
|
|
261
|
-
}, [isDisableImage, isDisableVideo,
|
|
276
|
+
}, [isDisableImage, onInsertImageToggle, isDisableVideo, onInsertVideoToggle, editor, createTable, openLinkDialog, onInsertBlockQuote, onInsertCodeBlock, isDisableCallout, onInsertCheckList, isEmptyNode, onInsertCallout, onInsertList, onInsert, createMultiColumn, quickInsertMenuSearchMap]);
|
|
262
277
|
const getSelectItemDom = selectIndex => {
|
|
263
278
|
const dropDownItemWrapper = downDownWrapperRef.current;
|
|
264
279
|
const currentSelectItem = dropDownItemWrapper.children[selectIndex];
|
|
@@ -321,35 +336,38 @@ const QuickInsertBlockMenu = _ref => {
|
|
|
321
336
|
currentSelectItem.classList.add(_const.SELECTED_ITEM_CLASS_NAME);
|
|
322
337
|
}
|
|
323
338
|
}, [clearSelectStyle, currentSelectIndex, dropDownItems]);
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
const inputText = _const.SHORT_INSERT_ELEMENT_USER_INPUT_MAP[key];
|
|
329
|
-
if (inputText.toLowerCase().indexOf(searchText.toLowerCase()) !== -1) {
|
|
330
|
-
renderList.push(dropDownItems[key]);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
339
|
+
const onChange = (0, _react.useCallback)(e => {
|
|
340
|
+
if (!downDownWrapperRef.current.isInputtingChinese) {
|
|
341
|
+
const newMenuSearchMap = (0, _helpers.getSearchedOperations)(_constants.SIDE_INSERT_MENUS_SEARCH_MAP, true, e, t, editor);
|
|
342
|
+
setQuickInsertMenuSearchMap(newMenuSearchMap);
|
|
333
343
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
renderItemListRef.current = renderList;
|
|
343
|
-
} else {
|
|
344
|
-
// setRenderItemList(dropDownItems);
|
|
345
|
-
renderItemListRef.current = Object.values(dropDownItems);
|
|
346
|
-
}
|
|
344
|
+
}, [editor, t]);
|
|
345
|
+
const onCompositionStart = (0, _react.useCallback)(() => {
|
|
346
|
+
downDownWrapperRef.current.isInputtingChinese = true;
|
|
347
|
+
}, []);
|
|
348
|
+
const onCompositionEnd = (0, _react.useCallback)(e => {
|
|
349
|
+
downDownWrapperRef.current.isInputtingChinese = false;
|
|
350
|
+
onChange(e);
|
|
351
|
+
}, [onChange]);
|
|
347
352
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
348
353
|
className: "sdoc-insert-element-toolbar",
|
|
349
354
|
ref: downDownWrapperRef
|
|
350
|
-
},
|
|
355
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
356
|
+
className: "sdoc-side-menu-search-wrapper"
|
|
357
|
+
}, /*#__PURE__*/_react.default.createElement(_reactstrap.Input, {
|
|
358
|
+
placeholder: t('Search_action'),
|
|
359
|
+
onChange: onChange,
|
|
360
|
+
onCompositionStart: onCompositionStart,
|
|
361
|
+
onCompositionEnd: onCompositionEnd
|
|
362
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
363
|
+
className: "sdoc-insert-element-content-wrapper"
|
|
364
|
+
}, Object.keys(dropDownItems).map(key => {
|
|
365
|
+
return dropDownItems[key];
|
|
366
|
+
}), Object.keys(quickInsertMenuSearchMap).length === 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
367
|
+
className: "sdoc-dropdown-menu-item-no-results"
|
|
368
|
+
}, t('No_results'))));
|
|
351
369
|
};
|
|
352
370
|
QuickInsertBlockMenu.defaultProps = {
|
|
353
371
|
insertPosition: _constants.INSERT_POSITION.CURRENT
|
|
354
372
|
};
|
|
355
|
-
var _default = exports.default = QuickInsertBlockMenu;
|
|
373
|
+
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(QuickInsertBlockMenu);
|
|
@@ -248,7 +248,7 @@ const getTransformMenusConfig = (editor, slateNode) => {
|
|
|
248
248
|
return newSideMenusConfig;
|
|
249
249
|
};
|
|
250
250
|
exports.getTransformMenusConfig = getTransformMenusConfig;
|
|
251
|
-
const getSearchedOperations = (sourceMenuSearchMap, isNodeEmpty, event, t) => {
|
|
251
|
+
const getSearchedOperations = (sourceMenuSearchMap, isNodeEmpty, event, t, editor) => {
|
|
252
252
|
let menuSearchMap = {};
|
|
253
253
|
if (event.target.value.trim()) {
|
|
254
254
|
Object.keys(sourceMenuSearchMap).forEach(key => {
|
|
@@ -256,6 +256,10 @@ const getSearchedOperations = (sourceMenuSearchMap, isNodeEmpty, event, t) => {
|
|
|
256
256
|
const sourceStr = t(value).toUpperCase();
|
|
257
257
|
const targetStr = event.target.value.trim().toUpperCase();
|
|
258
258
|
if (sourceStr.includes(targetStr)) {
|
|
259
|
+
// Only the documentation plugin has this operation
|
|
260
|
+
if ([_constants.SEATABLE_COLUMN, _constants.SEATABLE_TABLE].includes(key) && editor.editorType !== _constants3.DOCUMENT_PLUGIN_EDITOR) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
259
263
|
menuSearchMap[key] = value;
|
|
260
264
|
}
|
|
261
265
|
});
|
|
@@ -183,6 +183,7 @@ const InsertBlockMenu = _ref => {
|
|
|
183
183
|
});
|
|
184
184
|
}), _constants.SIDE_INSERT_MENUS_CONFIG[_constants.ELEMENT_TYPE.MULTI_COLUMN].map(item => {
|
|
185
185
|
return /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
186
|
+
isHidden: !insertMenuSearchMap[item.type],
|
|
186
187
|
key: item.id,
|
|
187
188
|
menuConfig: item,
|
|
188
189
|
onClick: () => createMultiColumn(item.type)
|
|
@@ -94,13 +94,13 @@ const SideMenu = (_ref, ref) => {
|
|
|
94
94
|
const onChange = (0, _react.useCallback)(e => {
|
|
95
95
|
if (!sideMenuRef.current.isInputtingChinese) {
|
|
96
96
|
if (isNodeEmpty) {
|
|
97
|
-
const newMenuSearchMap = (0, _helpers.getSearchedOperations)(_constants.SIDE_INSERT_MENUS_SEARCH_MAP, isNodeEmpty, e, t);
|
|
97
|
+
const newMenuSearchMap = (0, _helpers.getSearchedOperations)(_constants.SIDE_INSERT_MENUS_SEARCH_MAP, isNodeEmpty, e, t, editor);
|
|
98
98
|
setInsertMenuSearchMap(newMenuSearchMap);
|
|
99
99
|
}
|
|
100
100
|
if (!isNodeEmpty) {
|
|
101
|
-
const newTransformMenuSearchMap = (0, _helpers.getSearchedOperations)(_constants.SIDE_TRANSFORM_MENUS_SEARCH_MAP, isNodeEmpty, e, t);
|
|
102
|
-
const newInsertBelowMenuSearchMap = (0, _helpers.getSearchedOperations)(_constants.SIDE_INSERT_MENUS_SEARCH_MAP, isNodeEmpty, e, t);
|
|
103
|
-
const newOtherOperationsMenuSearchMap = (0, _helpers.getSearchedOperations)(_constants.SIDE_OTHER_OPERATIONS_MENUS_SEARCH_MAP, isNodeEmpty, e, t);
|
|
101
|
+
const newTransformMenuSearchMap = (0, _helpers.getSearchedOperations)(_constants.SIDE_TRANSFORM_MENUS_SEARCH_MAP, isNodeEmpty, e, t, editor);
|
|
102
|
+
const newInsertBelowMenuSearchMap = (0, _helpers.getSearchedOperations)(_constants.SIDE_INSERT_MENUS_SEARCH_MAP, isNodeEmpty, e, t, editor);
|
|
103
|
+
const newOtherOperationsMenuSearchMap = (0, _helpers.getSearchedOperations)(_constants.SIDE_OTHER_OPERATIONS_MENUS_SEARCH_MAP, isNodeEmpty, e, t, editor);
|
|
104
104
|
setTransformMenuSearchMap(newTransformMenuSearchMap);
|
|
105
105
|
setInsertBelowMenuSearchMap(newInsertBelowMenuSearchMap);
|
|
106
106
|
setOtherOperatonsMenuSearchMap(newOtherOperationsMenuSearchMap);
|
|
@@ -113,7 +113,7 @@ const SideMenu = (_ref, ref) => {
|
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
}, [isNodeEmpty, t, onUpdateMenuLocation]);
|
|
116
|
+
}, [isNodeEmpty, t, onUpdateMenuLocation, editor]);
|
|
117
117
|
const onCompositionStart = (0, _react.useCallback)(() => {
|
|
118
118
|
sideMenuRef.current.isInputtingChinese = true;
|
|
119
119
|
}, []);
|
|
@@ -49,6 +49,7 @@ function ArticleContainer(_ref) {
|
|
|
49
49
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
50
|
}, [editor.editorType, scrollRef]);
|
|
51
51
|
(0, _react.useEffect)(() => {
|
|
52
|
+
if (editor.editorType === _constants.DOCUMENT_PLUGIN_EDITOR) return;
|
|
52
53
|
const eventBus = _eventBus.default.getInstance();
|
|
53
54
|
const unsubscribeOutline = eventBus.subscribe(_constants.INTERNAL_EVENT.OUTLINE_STATE_CHANGED, handleWindowResize);
|
|
54
55
|
const unsubscribeResizeArticle = eventBus.subscribe(_constants.INTERNAL_EVENT.RESIZE_ARTICLE, handleWindowResize);
|
|
@@ -56,7 +57,7 @@ function ArticleContainer(_ref) {
|
|
|
56
57
|
unsubscribeOutline();
|
|
57
58
|
unsubscribeResizeArticle();
|
|
58
59
|
};
|
|
59
|
-
}, [handleWindowResize]);
|
|
60
|
+
}, [editor.editorType, handleWindowResize]);
|
|
60
61
|
(0, _react.useEffect)(() => {
|
|
61
62
|
if (editor.editorType === _constants.WIKI_EDITOR) return;
|
|
62
63
|
if (editor.editorType === _constants.DOCUMENT_PLUGIN_EDITOR) return;
|
|
@@ -68,9 +69,12 @@ function ArticleContainer(_ref) {
|
|
|
68
69
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
70
|
}, []);
|
|
70
71
|
const articleStyle = editor.getArticleStyle && editor.getArticleStyle();
|
|
72
|
+
const articleContainerStyle = editor.getArticleStyle ? {
|
|
73
|
+
width: articleStyle.width
|
|
74
|
+
} : containerStyle;
|
|
71
75
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
72
76
|
className: "sdoc-article-container",
|
|
73
|
-
style:
|
|
77
|
+
style: articleContainerStyle
|
|
74
78
|
}, _react.default.Children.count(children) === 1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
75
79
|
className: "article sdoc-editor__article",
|
|
76
80
|
style: articleStyle,
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
/>
|
|
15
15
|
<missing-glyph />
|
|
16
16
|
|
|
17
|
+
<glyph glyph-name="sdoc-check-mark" unicode="" d="M44.8 371.2c-19.2 22.4-16 54.4 6.4 73.6s54.4 16 73.6-6.4l243.2-300.8L896 745.6c19.2 22.4 54.4 28.8 76.8 9.6 22.4-19.2 25.6-51.2 6.4-76.8-384-441.6-576-665.6-588.8-678.4-12.8-16-35.2-12.8-44.8 0-6.4 6.4-105.6 134.4-300.8 371.2z" horiz-adv-x="1024" />
|
|
18
|
+
|
|
17
19
|
<glyph glyph-name="sdoc-play" unicode="" d="M512 896C230.4 896 0 665.6 0 384s230.4-512 512-512 512 230.4 512 512c0 134.4-54.4 265.6-150.4 361.6S646.4 896 512 896z m0-944c-236.8 0-432 192-432 432S275.2 816 512 816s432-192 432-432c0-115.2-44.8-224-124.8-304s-192-128-307.2-128z m185.6 457.6l-134.4 76.8-140.8 83.2c-9.6 3.2-19.2 3.2-25.6-3.2-6.4-6.4-12.8-16-9.6-25.6v-320c0-9.6 3.2-19.2 9.6-25.6s16-6.4 25.6-3.2l140.8 83.2 134.4 76.8c9.6 6.4 12.8 16 12.8 25.6s-6.4 28.8-12.8 32z" horiz-adv-x="1024" />
|
|
18
20
|
|
|
19
21
|
<glyph glyph-name="sdoc-video" unicode="" d="M969.6 832c28.8 0 54.4-25.6 54.4-57.6v-784c0-32-25.6-57.6-54.4-57.6H54.4C25.6-64 0-38.4 0-6.4V774.4C0 806.4 25.6 832 54.4 832h915.2zM928 736H96v-704h832V736zM348.8 608l380.8-227.2-380.8-227.2V608z" horiz-adv-x="1024" />
|
|
@@ -142,8 +144,6 @@
|
|
|
142
144
|
|
|
143
145
|
<glyph glyph-name="sdoc-align-center" unicode="" d="M800 832v-96H224V832h576z m224-352v96H0v-96h1024z m0-544v96H0v-96h1024zM224 288v-96h576v96H224z" horiz-adv-x="1024" />
|
|
144
146
|
|
|
145
|
-
<glyph glyph-name="sdoc-check-mark" unicode="" d="M329.6 96l-284.8 275.2c-25.6 22.4-25.6 60.8-3.2 86.4 25.6 25.6 64 25.6 89.6 0l265.6-256L892.8 697.6c22.4 22.4 64 25.6 86.4 0 22.4-22.4 25.6-60.8 3.2-83.2L464 99.2c-35.2-38.4-96-38.4-134.4-3.2z" horiz-adv-x="1024" />
|
|
146
|
-
|
|
147
147
|
<glyph glyph-name="sdoc-table" unicode="" d="M992 864c19.2 0 32-12.8 32-32v-896c0-19.2-12.8-32-32-32H32c-19.2 0-32 12.8-32 32V832c0 19.2 12.8 32 32 32h960zM96 192v-192h256v192H96z m832 0H448v-192h480v192z m0 288H448v-192h480v192z m0 288H448v-192h480V768zM352 768H96v-192h256V768zM96 288h256v192H96v-192z" horiz-adv-x="1024" />
|
|
148
148
|
|
|
149
149
|
<glyph glyph-name="sdoc-list-ol" unicode="" d="M288 432v-96h736v96H288zM288 768v-96h736V768H288z m0-672v-96h736v96H288zM144 608c9.6 0 16 6.4 16 16v25.6c0 9.6-6.4 16-16 16h-25.6V816c0 9.6-6.4 16-16 16H64c-6.4 0-12.8-3.2-16-9.6l-12.8-25.6c-3.2-3.2-3.2-9.6 0-12.8 3.2-3.2 6.4-6.4 12.8-6.4H64v-112H32c-6.4-3.2-12.8-9.6-12.8-16v-28.8c0-6.4 6.4-12.8 12.8-12.8h112zM25.6 272h115.2c9.6 0 16 6.4 16 16v25.6c0 9.6-6.4 16-16 16h-64c6.4 19.2 83.2 32 83.2 99.2 0 51.2-44.8 67.2-76.8 67.2-35.2 0-60.8-19.2-67.2-32-9.6-12.8-6.4-22.4 3.2-28.8l12.8-12.8c9.6-9.6 19.2-3.2 25.6 3.2 3.2 3.2 9.6 6.4 16 6.4s16-3.2 16-16c0-22.4-89.6-38.4-89.6-118.4v-6.4c6.4-12.8 16-19.2 25.6-19.2z m80-198.4l28.8 35.2c6.4 6.4 9.6 16 9.6 22.4v6.4c0 12.8-6.4 22.4-22.4 22.4h-96c-9.6 0-16-6.4-16-16v-28.8c0-9.6 6.4-16 16-16H64c-6.4-6.4-12.8-16-19.2-22.4l-9.6-12.8c-3.2-6.4-6.4-16-3.2-22.4l3.2-3.2c6.4-9.6 12.8-12.8 22.4-12.8H64c19.2 0 25.6-3.2 25.6-16 0-9.6-6.4-16-22.4-16-9.6 0-19.2 3.2-25.6 6.4-12.8 6.4-22.4 6.4-25.6-6.4l-9.6-16c-6.4-12.8-6.4-22.4 6.4-25.6 9.6-9.6 32-19.2 60.8-19.2 60.8 0 83.2 38.4 83.2 76.8 0 28.8-19.2 54.4-51.2 64z" horiz-adv-x="1024" />
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
@font-face {
|
|
2
|
-
font-family: "sdocfont";
|
|
3
|
-
|
|
4
|
-
src: url('./sdoc-editor-font/iconfont.eot?t=
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
font-family: "sdocfont";
|
|
3
|
+
/* Project id 4097705 */
|
|
4
|
+
src: url('./sdoc-editor-font/iconfont.eot?t=1732777032005');
|
|
5
|
+
/* IE9 */
|
|
6
|
+
src: url('./sdoc-editor-font/iconfont.eot?t=1732777032005#iefix') format('embedded-opentype'),
|
|
7
|
+
/* IE6-IE8 */
|
|
8
|
+
url('./sdoc-editor-font/iconfont.woff2?t=1732777032005') format('woff2'),
|
|
9
|
+
url('./sdoc-editor-font/iconfont.woff?t=1732777032005') format('woff'),
|
|
10
|
+
url('./sdoc-editor-font/iconfont.ttf?t=1732777032005') format('truetype'),
|
|
11
|
+
url('./sdoc-editor-font/iconfont.svg?t=1732777032005#sdocfont') format('svg');
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
.sdocfont {
|
|
@@ -16,6 +19,10 @@
|
|
|
16
19
|
-moz-osx-font-smoothing: grayscale;
|
|
17
20
|
}
|
|
18
21
|
|
|
22
|
+
.sdoc-check-mark:before {
|
|
23
|
+
content: "\e67d";
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
.sdoc-play:before {
|
|
20
27
|
content: "\e67c";
|
|
21
28
|
}
|
|
@@ -272,10 +279,6 @@
|
|
|
272
279
|
content: "\e62e";
|
|
273
280
|
}
|
|
274
281
|
|
|
275
|
-
.sdoc-check-mark:before {
|
|
276
|
-
content: "\e64f";
|
|
277
|
-
}
|
|
278
|
-
|
|
279
282
|
.sdoc-table:before {
|
|
280
283
|
content: "\e643";
|
|
281
284
|
}
|