@seafile/sdoc-editor 0.1.132 → 0.1.134

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.
@@ -170,7 +170,7 @@ var withCodeBlock = function withCodeBlock(editor) {
170
170
  return normalizeNode([node, path]);
171
171
  };
172
172
  newEditor.codeBlockOnKeyDown = function (event) {
173
- if (isHotkey('command+enter', event)) {
173
+ if (isHotkey(['command+enter', 'ctrl+enter'], event)) {
174
174
  if (newEditor.selection && !Range.isExpanded(newEditor.selection)) {
175
175
  var path = Editor.path(newEditor, newEditor.selection);
176
176
  var p = generateEmptyElement(PARAGRAPH);
@@ -1,4 +1,5 @@
1
- import React, { useCallback, useEffect, useMemo, useRef } from 'react';
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
3
  import { withTranslation } from 'react-i18next';
3
4
  import { useSlateStatic } from '@seafile/slate-react';
4
5
  import EventBus from '../../../utils/event-bus';
@@ -16,6 +17,10 @@ var SideMenu = function SideMenu(_ref) {
16
17
  onReset = _ref.onReset,
17
18
  t = _ref.t;
18
19
  var sideMenuRef = useRef(null);
20
+ var _useState = useState(''),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ menuStyle = _useState2[0],
23
+ setMenuStyle = _useState2[1];
19
24
  var editor = useSlateStatic();
20
25
  useEffect(function () {
21
26
  var eventBus = EventBus.getInstance();
@@ -36,7 +41,7 @@ var SideMenu = function SideMenu(_ref) {
36
41
  onDeleteNode(editor, slateNode);
37
42
  onReset();
38
43
  }, [editor, onReset, slateNode]);
39
- var menuStyle = useMemo(function () {
44
+ useEffect(function () {
40
45
  var top = menuPosition.top;
41
46
  if (sideMenuRef.current) {
42
47
  var overflowY = menuPosition.top + sideMenuRef.current.offsetHeight - document.body.clientHeight;
@@ -44,7 +49,7 @@ var SideMenu = function SideMenu(_ref) {
44
49
  top = menuPosition.top - overflowY - 10;
45
50
  }
46
51
  }
47
- return "top: ".concat(top, "px; left: ").concat(menuPosition.left, "px");
52
+ setMenuStyle("top: ".concat(top, "px; left: ").concat(menuPosition.left, "px"));
48
53
  // eslint-disable-next-line react-hooks/exhaustive-deps
49
54
  }, [menuPosition, sideMenuRef.current]);
50
55
  return /*#__PURE__*/React.createElement(ElementPopover, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.132",
3
+ "version": "0.1.134",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",