@seafile/sdoc-editor 1.0.48 → 1.0.49

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.
@@ -56,7 +56,7 @@
56
56
  .sdoc-editor-container .article .sdoc-image-wrapper {
57
57
  position: relative;
58
58
  display: inline-block;
59
- margin: 0 0.15em;
59
+ margin: 5px 0.15em;
60
60
  caret-color: transparent;
61
61
  }
62
62
 
@@ -5,7 +5,7 @@ import { ReactEditor } from '@seafile/slate-react';
5
5
  import slugId from 'slugid';
6
6
  import context from '../../../../context';
7
7
  import EventBus from '../../../utils/event-bus';
8
- import { generateEmptyElement, getNodeType, isTextNode, getParentNode, focusEditor, getAboveBlockNode } from '../../core';
8
+ import { generateEmptyElement, getNodeType, isTextNode, getParentNode, focusEditor, getAboveBlockNode, generateDefaultParagraph } from '../../core';
9
9
  import { isList } from '../../toolbar/side-toolbar/helpers';
10
10
  import { COMMENT_EDITOR, INTERNAL_EVENT } from '../../../constants';
11
11
  import { CODE_BLOCK, ELEMENT_TYPE, IMAGE, IMAGE_BLOCK, INSERT_POSITION, PARAGRAPH, SUBTITLE, TITLE } from '../../constants';
@@ -69,8 +69,17 @@ export const insertImage = function (editor, srcList, selection) {
69
69
  }, {
70
70
  at: validSelection
71
71
  });
72
- const imageEndSelection = Path.next(Path.next(path));
73
- focusEditor(editor, imageEndSelection);
72
+ const nodePath = [aboveNodeEntry[1][0]];
73
+ const nextPath = Path.next(nodePath);
74
+ Transforms.insertNodes(editor, generateDefaultParagraph(), {
75
+ at: nextPath
76
+ });
77
+ const endOfFirstNode = Editor.start(editor, nextPath);
78
+ const range = {
79
+ anchor: endOfFirstNode,
80
+ focus: endOfFirstNode
81
+ };
82
+ focusEditor(editor, range);
74
83
  return;
75
84
  }
76
85
  if (position === INSERT_POSITION.AFTER) {
@@ -318,6 +318,7 @@ export function renderImageBlock(props, editor) {
318
318
  }
319
319
  }, attributes, {
320
320
  onMouseOver: e => selectImageWhenSelectPartial(e, editor, element, isSelected),
321
- contentEditable: "false"
321
+ contentEditable: "false",
322
+ suppressContentEditableWarning: true
322
323
  }), children);
323
324
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.48",
3
+ "version": "1.0.49",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",