@seafile/sdoc-editor 0.1.114 → 0.1.116

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.
@@ -0,0 +1,6 @@
1
+ export var INTERNAL_EVENT = {
2
+ CANCEL_TABLE_SELECT_RANGE: 'cancel_table_select_range',
3
+ SET_TABLE_SELECT_RANGE: 'set_table_select_range',
4
+ HIDDEN_CODE_BLOCK_HOVER_MENU: 'hidden_code_block_hover_menu'
5
+ };
6
+ export var PAGE_EDIT_AREA_WIDTH = 672; // 672 = 794 - 2[borderLeft + borderRight] - 120[paddingLeft + paddingRight]
@@ -8,7 +8,7 @@ import withNodeId from './node-id';
8
8
  import SDocOutline from './outline';
9
9
  import EventProxy from './utils/event-handler';
10
10
  import { useCursors } from './cursor/use-cursors';
11
- import { EXTERNAL_EVENT, PAGE_EDIT_AREA_WIDTH } from '../constants';
11
+ import { INTERNAL_EVENT, PAGE_EDIT_AREA_WIDTH } from './constants';
12
12
  import { SetNodeToDecorations } from './highlight-decorate/setNodeToDecorations';
13
13
  import { ScrollContext } from './hooks/use-scroll-context';
14
14
  import CommentContextProvider from './comment/comment-context-provider';
@@ -88,7 +88,7 @@ var SDocEditor = forwardRef(function (_ref, ref) {
88
88
  if (event.button === 0) {
89
89
  editor.reSetTableSelectedRange();
90
90
  var eventBus = EventBus.getInstance();
91
- eventBus.dispatch(EXTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
91
+ eventBus.dispatch(INTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
92
92
  }
93
93
  // eslint-disable-next-line react-hooks/exhaustive-deps
94
94
  }, []);
@@ -7,7 +7,7 @@ import EventBus from '../../../utils/event-bus';
7
7
  import { useScrollContext } from '../../../hooks/use-scroll-context';
8
8
  import CodeBlockHoverMenu from './hover-menu';
9
9
  import { setClipboardData } from './helpers';
10
- import { EXTERNAL_EVENT } from '../../../../../src';
10
+ import { INTERNAL_EVENT } from '../../../constants';
11
11
  import '../../../assets/css/code-block.css';
12
12
  var CodeBlock = function CodeBlock(_ref) {
13
13
  var codeBlockProps = _ref.codeBlockProps;
@@ -122,7 +122,7 @@ var CodeBlock = function CodeBlock(_ref) {
122
122
  }, []);
123
123
  useEffect(function () {
124
124
  var eventBus = EventBus.getInstance();
125
- eventBus.subscribe(EXTERNAL_EVENT.HIDDEN_CODE_BLOCK_HOVER_MENU, onHiddenHoverMenu);
125
+ eventBus.subscribe(INTERNAL_EVENT.HIDDEN_CODE_BLOCK_HOVER_MENU, onHiddenHoverMenu);
126
126
  // eslint-disable-next-line react-hooks/exhaustive-deps
127
127
  }, []);
128
128
  return /*#__PURE__*/React.createElement("div", {
@@ -9,7 +9,7 @@ import { getNodeType, getParentNode, getSelectedNodeByType, isTextNode, getSelec
9
9
  import { ELEMENT_TYPE, KEYBOARD, CLIPBOARD_FORMAT_KEY } from '../../constants';
10
10
  import { TABLE_MAX_ROWS, TABLE_MAX_COLUMNS, EMPTY_SELECTED_RANGE, TABLE_ROW_MIN_HEIGHT, TABLE_CELL_MIN_WIDTH, TABLE_ELEMENT, TABLE_ELEMENT_POSITION } from './constants';
11
11
  import EventBus from '../../../utils/event-bus';
12
- import { EXTERNAL_EVENT, PAGE_EDIT_AREA_WIDTH } from '../../../../constants';
12
+ import { INTERNAL_EVENT, PAGE_EDIT_AREA_WIDTH } from '../../../constants';
13
13
  import ObjectUtils from '../../../utils/object-utils';
14
14
  import { replacePastedDataId } from '../../../node-id/helpers';
15
15
  export var isTableMenuDisabled = function isTableMenuDisabled(editor) {
@@ -226,7 +226,7 @@ export var insertTableElement = function insertTableElement(editor, type) {
226
226
  rowIndex = _getSelectedInfo2.rowIndex,
227
227
  cellIndex = _getSelectedInfo2.cellIndex;
228
228
  var eventBus = EventBus.getInstance();
229
- eventBus.dispatch(EXTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
229
+ eventBus.dispatch(INTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
230
230
  if (type === TABLE_ELEMENT.ROW) {
231
231
  if (tableSize[0] >= TABLE_MAX_ROWS) return;
232
232
  var targetPath = position === TABLE_ELEMENT_POSITION.AFTER ? [].concat(_toConsumableArray(tablePath), [rowIndex + 1]) : [].concat(_toConsumableArray(tablePath), [rowIndex]);
@@ -287,7 +287,7 @@ export var removeTableElement = function removeTableElement(editor, type) {
287
287
  rowIndex = _getSelectedInfo4.rowIndex,
288
288
  cellIndex = _getSelectedInfo4.cellIndex;
289
289
  var eventBus = EventBus.getInstance();
290
- eventBus.dispatch(EXTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
290
+ eventBus.dispatch(INTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
291
291
  if (type === TABLE_ELEMENT.TABLE) {
292
292
  removeTable(editor, tablePath);
293
293
  return;
@@ -517,7 +517,7 @@ export var insertMultipleRowsAndColumns = function insertMultipleRowsAndColumns(
517
517
  rowIndex = _getSelectedInfo6.rowIndex,
518
518
  cellIndex = _getSelectedInfo6.cellIndex;
519
519
  var eventBus = EventBus.getInstance();
520
- eventBus.dispatch(EXTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
520
+ eventBus.dispatch(INTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
521
521
  var insertRows = rows.slice(tableSize[0] - rowIndex);
522
522
  var insertColumns = columns.slice(tableSize[1] - cellIndex);
523
523
  var validInsertRows = insertRows.slice(0, Math.min(TABLE_MAX_ROWS - tableSize[0], insertRows.length));
@@ -623,7 +623,7 @@ export var deleteTableRangeData = function deleteTableRangeData(editor) {
623
623
  if (forceCellPath) {
624
624
  editor.tableSelectedRange = EMPTY_SELECTED_RANGE;
625
625
  var eventBus = EventBus.getInstance();
626
- eventBus.dispatch(EXTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
626
+ eventBus.dispatch(INTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE);
627
627
  focusEditor(editor, forceCellPath);
628
628
  var newFocus = editor.selection.focus;
629
629
  Transforms.select(editor, {
@@ -9,7 +9,7 @@ import { TABLE_MAX_ROWS, EMPTY_SELECTED_RANGE, TABLE_ELEMENT, TABLE_ELEMENT_POSI
9
9
  import ObjectUtils from '../../../utils/object-utils';
10
10
  import { getSelectedInfo, insertTableElement, removeTable, insertMultipleRowsAndColumns, setTableFragmentData, deleteTableRangeData, focusCell, deleteHandler, isTableLocation, isLastTableCell } from './helpers';
11
11
  import EventBus from '../../../utils/event-bus';
12
- import { EXTERNAL_EVENT } from '../../../../constants';
12
+ import { INTERNAL_EVENT } from '../../../constants';
13
13
  var withTable = function withTable(editor) {
14
14
  var insertBreak = editor.insertBreak,
15
15
  deleteBackward = editor.deleteBackward,
@@ -39,7 +39,7 @@ var withTable = function withTable(editor) {
39
39
  maxColIndex: tableSize[1] - 1
40
40
  };
41
41
  newEditor.tableSelectedRange = allTableRange;
42
- eventBus.dispatch(EXTERNAL_EVENT.SET_TABLE_SELECT_RANGE, table, allTableRange);
42
+ eventBus.dispatch(INTERNAL_EVENT.SET_TABLE_SELECT_RANGE, table, allTableRange);
43
43
  }
44
44
  if (isHotkey(KEYBOARD.UP, event)) {
45
45
  focusCell(newEditor, event, KEYBOARD.UP);
@@ -227,7 +227,7 @@ var withTable = function withTable(editor) {
227
227
  var _getSelectedInfo4 = getSelectedInfo(newEditor),
228
228
  table = _getSelectedInfo4.table,
229
229
  tableSize = _getSelectedInfo4.tableSize;
230
- eventBus.dispatch(EXTERNAL_EVENT.SET_TABLE_SELECT_RANGE, table, {
230
+ eventBus.dispatch(INTERNAL_EVENT.SET_TABLE_SELECT_RANGE, table, {
231
231
  minRowIndex: 0,
232
232
  maxRowIndex: tableSize[0] - 1,
233
233
  minColIndex: 0,
@@ -8,7 +8,7 @@ import { Transforms, Editor } from '@seafile/slate';
8
8
  import { EMPTY_SELECTED_RANGE } from '../constants';
9
9
  import { ResizeHandlersContext, TableSelectedRangeContext, SettingSelectRangeContext } from './hooks';
10
10
  import EventBus from '../../../../utils/event-bus';
11
- import { EXTERNAL_EVENT } from '../../../../../constants';
11
+ import { INTERNAL_EVENT } from '../../../../constants';
12
12
  import { getTableColumns, setTableSelectedRange, getFirstTableCell } from '../helpers';
13
13
  import ObjectUtils from '../../../../utils/object-utils';
14
14
  import ResizeHandlers from './resize-handlers';
@@ -68,8 +68,8 @@ var Table = function Table(_ref) {
68
68
  useEffect(function () {
69
69
  if (isSelected) {
70
70
  var eventBus = EventBus.getInstance();
71
- var cancelTableSelectRangeSubscribe = eventBus.subscribe(EXTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE, clearRange);
72
- var setTableSelectRangeSubscribe = eventBus.subscribe(EXTERNAL_EVENT.SET_TABLE_SELECT_RANGE, setRange);
71
+ var cancelTableSelectRangeSubscribe = eventBus.subscribe(INTERNAL_EVENT.CANCEL_TABLE_SELECT_RANGE, clearRange);
72
+ var setTableSelectRangeSubscribe = eventBus.subscribe(INTERNAL_EVENT.SET_TABLE_SELECT_RANGE, setRange);
73
73
  return function () {
74
74
  cancelTableSelectRangeSubscribe();
75
75
  setTableSelectRangeSubscribe();
@@ -4,7 +4,7 @@ import isHotkey from 'is-hotkey';
4
4
  import EventBus from '../utils/event-bus';
5
5
  import { getSelectedNodeByType } from '../extension/core/queries/';
6
6
  import { ELEMENT_TYPE } from '../extension/constants';
7
- import { EXTERNAL_EVENT } from '../../constants';
7
+ import { INTERNAL_EVENT } from '../constants';
8
8
  var EventProxy = /*#__PURE__*/_createClass(function EventProxy(_editor) {
9
9
  var _this = this;
10
10
  _classCallCheck(this, EventProxy);
@@ -70,7 +70,7 @@ var EventProxy = /*#__PURE__*/_createClass(function EventProxy(_editor) {
70
70
  }
71
71
  if (getSelectedNodeByType(editor, ELEMENT_TYPE.CODE_BLOCK)) {
72
72
  var eventBus = EventBus.getInstance();
73
- eventBus.dispatch(EXTERNAL_EVENT.HIDDEN_CODE_BLOCK_HOVER_MENU);
73
+ eventBus.dispatch(INTERNAL_EVENT.HIDDEN_CODE_BLOCK_HOVER_MENU);
74
74
  }
75
75
  };
76
76
  this.onCopy = function (event) {
@@ -2,9 +2,5 @@ export var EXTERNAL_EVENT = {
2
2
  INTERNAL_LINK_CLICK: 'internal_link_click',
3
3
  TOGGLE_STAR: 'toggle_star',
4
4
  UNMARK_AS_DRAFT: 'unmark_as_draft',
5
- SHARE_SDOC: 'share_sdoc',
6
- CANCEL_TABLE_SELECT_RANGE: 'cancel_table_select_range',
7
- SET_TABLE_SELECT_RANGE: 'set_table_select_range',
8
- HIDDEN_CODE_BLOCK_HOVER_MENU: 'hidden_code_block_hover_menu'
9
- };
10
- export var PAGE_EDIT_AREA_WIDTH = 672; // 672 = 794 - 2[borderLeft + borderRight] - 120[paddingLeft + paddingRight]
5
+ SHARE_SDOC: 'share_sdoc'
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.114",
3
+ "version": "0.1.116",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",