@seafile/sdoc-editor 0.5.25 → 0.5.26

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.
@@ -32,7 +32,7 @@ export const isMenuDisabled = (editor, readonly) => {
32
32
  * @param {keyof CALLOUT_COLOR_MAP} [background_color] fill color
33
33
  */
34
34
  export const generateCallout = function () {
35
- let background_color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Object.keys(CALLOUT_COLOR_MAP)[0];
35
+ let background_color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Object.keys(CALLOUT_COLOR_MAP)[5];
36
36
  const props = {
37
37
  style: {
38
38
  background_color
@@ -1,12 +1,13 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import React, { useCallback, useEffect, useState, useRef } from 'react';
3
- import { Range, Transforms } from '@seafile/slate';
3
+ import { Editor, Range } from '@seafile/slate';
4
4
  import { ReactEditor, useReadOnly } from '@seafile/slate-react';
5
5
  import { useScrollContext } from '../../../hooks/use-scroll-context';
6
6
  import { unwrapLinkNode, getUrl } from './helpers';
7
7
  import HoverMenu from './hover-menu';
8
8
  import { DELETED_STYLE, ADDED_STYLE } from '../../constants';
9
9
  import { SDOC_LINK_TYPE } from './constants';
10
+ import { focusEditor } from '../../core';
10
11
  import './render-elem.css';
11
12
  const SdocFileLink = _ref => {
12
13
  let {
@@ -78,16 +79,8 @@ const SdocFileLink = _ref => {
78
79
  e.stopPropagation();
79
80
  }
80
81
  const path = ReactEditor.findPath(editor, element);
81
- Transforms.setSelection(editor, {
82
- anchor: {
83
- offset: 1,
84
- path: [path[0], path[1], 0]
85
- },
86
- focus: {
87
- offset: 1,
88
- path: [path[0], path[1], 0]
89
- }
90
- });
82
+ const focusPoint = Editor.end(editor, path);
83
+ focusEditor(editor, focusPoint);
91
84
  setPosition(e.currentTarget);
92
85
  setIsShowInsertHoverMenu(true);
93
86
  setTimeout(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.5.25",
3
+ "version": "0.5.26",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",