@seafile/sdoc-editor 1.0.71 → 1.0.73
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/sdoc-editor-plugins.css +2 -0
- package/dist/basic-sdk/extension/constants/menus-config.js +6 -6
- package/dist/basic-sdk/extension/plugins/paragraph/render-elem.js +1 -2
- package/dist/basic-sdk/extension/plugins/quick-insert/plugin/index.js +10 -1
- package/dist/basic-sdk/extension/render/custom-element.js +1 -2
- package/dist/basic-sdk/right-panel/index.js +9 -9
- package/package.json +1 -1
|
@@ -81,17 +81,17 @@ const MENUS_CONFIG_MAP = exports.MENUS_CONFIG_MAP = {
|
|
|
81
81
|
[_elementType.LINK]: {
|
|
82
82
|
id: `sdoc_${_elementType.LINK}`,
|
|
83
83
|
iconClass: 'sdocfont sdoc-link',
|
|
84
|
-
text: '
|
|
84
|
+
text: 'Link'
|
|
85
85
|
},
|
|
86
86
|
[_elementType.IMAGE]: {
|
|
87
87
|
id: `sdoc_${_elementType.IMAGE}`,
|
|
88
88
|
iconClass: 'sdocfont sdoc-image',
|
|
89
|
-
text: '
|
|
89
|
+
text: 'Image'
|
|
90
90
|
},
|
|
91
91
|
[_elementType.TABLE]: {
|
|
92
92
|
id: `sdoc_${_elementType.TABLE}`,
|
|
93
93
|
iconClass: 'sdocfont sdoc-table',
|
|
94
|
-
text: '
|
|
94
|
+
text: 'Table'
|
|
95
95
|
},
|
|
96
96
|
[TEXT_STYLE]: [{
|
|
97
97
|
id: ITALIC,
|
|
@@ -292,19 +292,19 @@ const SIDE_INSERT_MENUS_CONFIG = exports.SIDE_INSERT_MENUS_CONFIG = {
|
|
|
292
292
|
id: '',
|
|
293
293
|
iconClass: 'sdocfont sdoc-image',
|
|
294
294
|
type: _elementType.IMAGE,
|
|
295
|
-
text: '
|
|
295
|
+
text: 'Image'
|
|
296
296
|
},
|
|
297
297
|
[_elementType.TABLE]: {
|
|
298
298
|
id: 'sdoc-side-menu-item-table',
|
|
299
299
|
iconClass: 'sdocfont sdoc-table',
|
|
300
300
|
type: _elementType.TABLE,
|
|
301
|
-
text: '
|
|
301
|
+
text: 'Table'
|
|
302
302
|
},
|
|
303
303
|
[_elementType.LINK]: {
|
|
304
304
|
id: '',
|
|
305
305
|
iconClass: 'sdocfont sdoc-link',
|
|
306
306
|
type: _elementType.LINK,
|
|
307
|
-
text: '
|
|
307
|
+
text: 'Link'
|
|
308
308
|
},
|
|
309
309
|
[_elementType.CODE_BLOCK]: {
|
|
310
310
|
id: '',
|
|
@@ -27,7 +27,6 @@ const Paragraph = _ref => {
|
|
|
27
27
|
const editor = (0, _slateReact.useSlateStatic)();
|
|
28
28
|
const isSelected = (0, _slateReact.useSelected)();
|
|
29
29
|
const isCommentEditor = editor.editorType === _constants.COMMENT_EDITOR;
|
|
30
|
-
const isWikiEditor = editor.editorType === _constants.WIKI_EDITOR;
|
|
31
30
|
let isShowPlaceHolder = false;
|
|
32
31
|
if (editor.children.length === 1) {
|
|
33
32
|
const node = editor.children[0];
|
|
@@ -39,7 +38,7 @@ const Paragraph = _ref => {
|
|
|
39
38
|
const node = editor.children[1];
|
|
40
39
|
isShowPlaceHolder = _slate.Node.string(element) === '' && (node === null || node === void 0 ? void 0 : node.id) === (element === null || element === void 0 ? void 0 : element.id) && !isComposing;
|
|
41
40
|
}
|
|
42
|
-
if (isSelected &&
|
|
41
|
+
if (isSelected && _slate.Range.isCollapsed(editor.selection) && (0, _helper.isEmptyNode)(element) && _slateReact.ReactEditor.findPath(editor, element).length === 1 && !isComposing) {
|
|
43
42
|
isShowPlaceHolder = true;
|
|
44
43
|
}
|
|
45
44
|
const style = {
|
|
@@ -22,7 +22,16 @@ const withQuickInsert = editor => {
|
|
|
22
22
|
newEditor.insertText = text => {
|
|
23
23
|
if (!editor.selection) return insertText(text);
|
|
24
24
|
const [blockNode] = (0, _core.getTopLevelBlockNode)(editor);
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
// Disable quick insert for code block and table
|
|
27
|
+
if ([_constants.CODE_BLOCK, _constants.TABLE].includes(blockNode.type)) {
|
|
28
|
+
return insertText(text);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Disable quick insert for non-empty nodes
|
|
32
|
+
if (_slate.Node.string(blockNode) !== '') {
|
|
33
|
+
return insertText(text);
|
|
34
|
+
}
|
|
26
35
|
if (text === '/') {
|
|
27
36
|
// Avoid triggering quick insert when the cursor is in the quick insert
|
|
28
37
|
const isInQuickInsert = (0, _helper.getQuickInsertEntity)(editor);
|
|
@@ -42,8 +42,7 @@ const CustomRenderElement = props => {
|
|
|
42
42
|
placeholder
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
if (editor.editorType === _constants2.WIKI_EDITOR) placeholder = 'Enter_text_or_press_forward_slash_to_insert_element';
|
|
45
|
+
placeholder = 'Enter_text_or_press_forward_slash_to_insert_element';
|
|
47
46
|
const [renderParagraph] = _plugins.ParagraphPlugin.renderElements;
|
|
48
47
|
return renderParagraph({
|
|
49
48
|
...props,
|
|
@@ -43,17 +43,17 @@ const RightPanel = _ref => {
|
|
|
43
43
|
setWidth(width);
|
|
44
44
|
}, []);
|
|
45
45
|
const resizeWidthEnd = (0, _react.useCallback)(width => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
...panelWidth,
|
|
49
|
-
[displayPluginName]: width
|
|
50
|
-
}));
|
|
51
|
-
}, [displayPluginName]);
|
|
46
|
+
window.localStorage.setItem('sdoc-panel-width', width);
|
|
47
|
+
}, []);
|
|
52
48
|
(0, _react.useEffect)(() => {
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
let width = parseInt(window.localStorage.getItem('sdoc-panel-width', '0')) || MIN_PANEL_WIDTH;
|
|
50
|
+
if (width < MIN_PANEL_WIDTH) {
|
|
51
|
+
width = MIN_PANEL_WIDTH;
|
|
52
|
+
} else if (width > MAX_PANEL_WIDTH) {
|
|
53
|
+
width = MAX_PANEL_WIDTH;
|
|
54
|
+
}
|
|
55
55
|
setWidth(width);
|
|
56
|
-
}, [
|
|
56
|
+
}, []);
|
|
57
57
|
if (!displayPluginName) return null;
|
|
58
58
|
const plugin = plugins.find(p => p.name === displayPluginName);
|
|
59
59
|
if (!plugin) return null;
|