@seafile/sdoc-editor 1.0.72 → 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.
@@ -50,6 +50,8 @@
50
50
  .sdoc-editor__article .sdoc-checkbox-container .sdoc-checkbox-input-wrapper .sdoc-checkbox-content-container {
51
51
  word-break: normal;
52
52
  width: calc(100% - 1em);
53
+ margin: 0;
54
+ padding: 5px 0;
53
55
  }
54
56
 
55
57
  /* image */
@@ -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: 'Insert_link'
84
+ text: 'Link'
85
85
  },
86
86
  [_elementType.IMAGE]: {
87
87
  id: `sdoc_${_elementType.IMAGE}`,
88
88
  iconClass: 'sdocfont sdoc-image',
89
- text: 'Insert_image'
89
+ text: 'Image'
90
90
  },
91
91
  [_elementType.TABLE]: {
92
92
  id: `sdoc_${_elementType.TABLE}`,
93
93
  iconClass: 'sdocfont sdoc-table',
94
- text: 'Insert_table'
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: 'Insert_image'
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: 'Insert_table'
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: 'Insert_link'
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 && isWikiEditor && _slate.Range.isCollapsed(editor.selection) && (0, _helper.isEmptyNode)(element) && _slateReact.ReactEditor.findPath(editor, element).length === 1 && !isComposing) {
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
- if (blockNode.type === _constants.CODE_BLOCK) return insertText(text);
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
- // Update the placeholder for the wiki editor
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.72",
3
+ "version": "1.0.73",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",