@seafile/sdoc-editor 0.4.9 → 0.4.10

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.
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import { Editor, Transforms, Element } from '@seafile/slate';
3
3
  import slugid from 'slugid';
4
4
  import { BLOCKQUOTE, CHECK_LIST_ITEM, IMAGE, ORDERED_LIST, PARAGRAPH, UNORDERED_LIST, CODE_BLOCK, TABLE, CALL_OUT } from '../../constants';
5
- import { focusEditor, getNodeType } from '../../core';
5
+ import { getNodeType } from '../../core';
6
6
  export const isMenuDisabled = (editor, readonly) => {
7
7
  if (readonly) return true;
8
8
  if (editor.selection == null) return true;
@@ -64,7 +64,6 @@ export const setBlockQuoteType = (editor, active) => {
64
64
  }
65
65
  });
66
66
  }
67
- focusEditor(editor);
68
67
  };
69
68
  export const getFormattedElements = data => {
70
69
  const elements = [];
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { BLOCKQUOTE, MENUS_CONFIG_MAP } from '../../../constants';
4
4
  import { MenuItem } from '../../../commons';
5
5
  import { getBlockQuoteType, isMenuDisabled, setBlockQuoteType } from '../helpers';
6
+ import { focusEditor } from '../../../core';
6
7
  class QuoteMenu extends React.Component {
7
8
  constructor() {
8
9
  super(...arguments);
@@ -25,6 +26,7 @@ class QuoteMenu extends React.Component {
25
26
  } = this.props;
26
27
  const active = this.isActive(editor);
27
28
  setBlockQuoteType(editor, active);
29
+ focusEditor(editor);
28
30
  };
29
31
  }
30
32
  render() {
@@ -1,4 +1,4 @@
1
- import { Editor, Element, Transforms, Node } from '@seafile/slate';
1
+ import { Editor, Element, Transforms, Node, Path } from '@seafile/slate';
2
2
  import { focusEditor, generateDefaultText, getSelectedNodeByType, isSelectionAtBlockStart } from '../../core';
3
3
  import { BLOCKQUOTE, PARAGRAPH, CODE_BLOCK, TABLE } from '../../constants';
4
4
  import { setBlockQuoteType, getFormattedElements, getFormattedRestElements } from './helpers';
@@ -27,12 +27,11 @@ const withBlockquote = editor => {
27
27
  const isAtEnd = currentLineEntry[1].slice(-1)[0] === quoteBlockEntry[0].children.length - 1;
28
28
  if (isAtEnd) {
29
29
  const isEmptyLine = !(currentLineEntry && Editor.string(newEditor, currentLineEntry[1]).length);
30
- const movePath = quoteBlockEntry[1];
31
- movePath.push(movePath.pop() + 1);
32
30
  if (isEmptyLine) {
31
+ const nextPath = Path.next(quoteBlockEntry[1]);
33
32
  Transforms.moveNodes(newEditor, {
34
33
  at: currentLineEntry[1],
35
- to: movePath
34
+ to: nextPath
36
35
  });
37
36
  return;
38
37
  }
@@ -3,6 +3,7 @@ import { Editor, Transforms, Range } from '@seafile/slate';
3
3
  import { toggleList } from '../list/transforms';
4
4
  import { getSelectedNodeByType } from '../../core';
5
5
  import { HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, UNORDERED_LIST, BLOCKQUOTE, TEXT_STYLE_MAP, PARAGRAPH } from '../../constants';
6
+ import { setBlockQuoteType } from '../blockquote/helpers';
6
7
  const KEY_TO_TYPE_FOR_SPACE = {
7
8
  // Title shortcut
8
9
  '#': HEADER1,
@@ -163,11 +164,7 @@ const withMarkDown = editor => {
163
164
  return;
164
165
  }
165
166
  if (type === BLOCKQUOTE) {
166
- Transforms.setNodes(editor, {
167
- type
168
- }, {
169
- mode: 'highest'
170
- });
167
+ setBlockQuoteType(editor, false);
171
168
  return;
172
169
  }
173
170
  Transforms.setNodes(editor, {
@@ -80,6 +80,7 @@ const SearchReplacePopover = _ref => {
80
80
  }, [editor, handleDrawHighlight, handleDrawHighlightLister, highlightInfos.length, searchContent]);
81
81
  const handleSearchInputChange = useCallback(e => {
82
82
  const keyword = e.target.value;
83
+ shouldScrollIntoView.current = true;
83
84
  setSearchContent(keyword);
84
85
  handleDrawHighlight(editor, keyword);
85
86
  setCurrentSelectIndex(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",