@seafile/sdoc-editor 0.5.75 → 0.5.76

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.
Files changed (28) hide show
  1. package/dist/basic-sdk/extension/constants/element-type.js +1 -1
  2. package/dist/basic-sdk/extension/constants/index.js +2 -2
  3. package/dist/basic-sdk/extension/constants/menus-config.js +6 -6
  4. package/dist/basic-sdk/extension/plugins/index.js +1 -1
  5. package/dist/basic-sdk/extension/plugins/{seatable-views → seatable-tables}/helpers.js +6 -9
  6. package/dist/basic-sdk/extension/plugins/{seatable-views → seatable-tables}/index.js +4 -4
  7. package/dist/basic-sdk/extension/plugins/{seatable-views → seatable-tables}/menu/index.js +9 -9
  8. package/dist/basic-sdk/extension/plugins/seatable-tables/model.js +11 -0
  9. package/dist/basic-sdk/extension/plugins/{seatable-views → seatable-tables}/plugin.js +6 -6
  10. package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/index.js +8 -0
  11. package/dist/basic-sdk/extension/plugins/{seatable-views → seatable-tables}/render-element/record-item.js +2 -3
  12. package/dist/basic-sdk/extension/plugins/{seatable-views → seatable-tables}/render-element/record-list.js +2 -4
  13. package/dist/basic-sdk/extension/plugins/{seatable-views/render-element/seatable-view.js → seatable-tables/render-element/seatable-table.js} +11 -12
  14. package/dist/basic-sdk/extension/render/custom-element.js +4 -4
  15. package/dist/basic-sdk/extension/toolbar/header-toolbar/insert-toolbar/index.js +2 -2
  16. package/dist/pages/document-plugin-editor.js +11 -8
  17. package/package.json +1 -1
  18. package/public/locales/en/sdoc-editor.json +1 -1
  19. package/public/media/sdoc-editor-font/iconfont.eot +0 -0
  20. package/public/media/sdoc-editor-font/iconfont.svg +2 -2
  21. package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
  22. package/public/media/sdoc-editor-font/iconfont.woff +0 -0
  23. package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
  24. package/public/media/sdoc-editor-font.css +10 -10
  25. package/dist/basic-sdk/extension/plugins/seatable-views/model.js +0 -12
  26. package/dist/basic-sdk/extension/plugins/seatable-views/render-element/index.js +0 -8
  27. /package/dist/basic-sdk/extension/plugins/{seatable-views → seatable-tables}/render-element/index.css +0 -0
  28. /package/dist/basic-sdk/extension/plugins/{seatable-views → seatable-tables}/render-element/record-header.js +0 -0
@@ -30,7 +30,7 @@ export const MENTION_TEMP = 'mention_temp';
30
30
  export const FILE_LINK_INSET_INPUT_TEMP = 'file_link_insert_input_temp';
31
31
  export const QUICK_INSERT = 'quick_insert';
32
32
  export const COLUMN = 'column';
33
- export const SEATABLE_VIEW = 'seatable_view';
33
+ export const SEATABLE_TABLE = 'seatable_table';
34
34
 
35
35
  // font
36
36
  export const FONT_SIZE = 'font-size';
@@ -1,7 +1,7 @@
1
1
  // extension plugin
2
2
  import * as ELEMENT_TYPE from './element-type';
3
3
  // eslint-disable-next-line no-duplicate-imports
4
- import { BLOCKQUOTE, TITLE, SUBTITLE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, TABLE, TABLE_CELL, TABLE_ROW, LINK, SDOC_LINK, FILE_LINK, IMAGE, IMAGE_BLOCK, TOP_LEVEL_TYPES, INLINE_LEVEL_TYPES, CALL_OUT, MENTION, MENTION_TEMP, FILE_LINK_INSET_INPUT_TEMP, QUICK_INSERT, COLUMN, SEATABLE_VIEW } from './element-type';
4
+ import { BLOCKQUOTE, TITLE, SUBTITLE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, TABLE, TABLE_CELL, TABLE_ROW, LINK, SDOC_LINK, FILE_LINK, IMAGE, IMAGE_BLOCK, TOP_LEVEL_TYPES, INLINE_LEVEL_TYPES, CALL_OUT, MENTION, MENTION_TEMP, FILE_LINK_INSET_INPUT_TEMP, QUICK_INSERT, COLUMN, SEATABLE_TABLE } from './element-type';
5
5
  export { DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_LIST, DEFAULT_FONT_COLOR, RECENT_USED_HIGHLIGHT_COLORS_KEY, RECENT_USED_FONT_COLORS_KEY, RECENT_USED_TABLE_CELL_BACKGROUND_COLORS_KEY, DEFAULT_LAST_USED_FONT_COLOR, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, DEFAULT_LAST_USED_TABLE_CELL_BACKGROUND_COLOR } from './color';
6
6
  export { FONT_SIZE, DEFAULT_FONT, FONT, GOOGLE_FONT_CLASS, RECENT_USED_FONTS_KEY, SDOC_FONT_SIZE } from './font';
7
7
  export { DIFF_TYPE, ADDED_STYLE, DELETED_STYLE } from './diff-view';
@@ -57,4 +57,4 @@ export const MOUSE_ENTER_EVENT_DISABLED_MAP = {
57
57
  [CALL_OUT]: [CALL_OUT]
58
58
  };
59
59
  export const ROOT_ELEMENT_TYPES = [PARAGRAPH, TITLE, SUBTITLE, CHECK_LIST_ITEM, ORDERED_LIST, UNORDERED_LIST, BLOCKQUOTE, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, CALL_OUT, TABLE, CODE_BLOCK, IMAGE_BLOCK];
60
- export { ELEMENT_TYPE, BLOCKQUOTE, TITLE, SUBTITLE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, TABLE, TABLE_CELL, TABLE_ROW, LINK, SDOC_LINK, FILE_LINK, IMAGE, IMAGE_BLOCK, TOP_LEVEL_TYPES, INLINE_LEVEL_TYPES, CALL_OUT, MENTION, MENTION_TEMP, FILE_LINK_INSET_INPUT_TEMP, QUICK_INSERT, SEATABLE_VIEW };
60
+ export { ELEMENT_TYPE, BLOCKQUOTE, TITLE, SUBTITLE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, TABLE, TABLE_CELL, TABLE_ROW, LINK, SDOC_LINK, FILE_LINK, IMAGE, IMAGE_BLOCK, TOP_LEVEL_TYPES, INLINE_LEVEL_TYPES, CALL_OUT, MENTION, MENTION_TEMP, FILE_LINK_INSET_INPUT_TEMP, QUICK_INSERT, SEATABLE_TABLE };
@@ -1,5 +1,5 @@
1
1
  import { RECENT_USED_HIGHLIGHT_COLORS_KEY, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, RECENT_USED_FONT_COLORS_KEY, DEFAULT_FONT_COLOR, DEFAULT_LAST_USED_FONT_COLOR } from './color';
2
- import { BLOCKQUOTE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, ORDERED_LIST, UNORDERED_LIST, CHECK_LIST_ITEM, CODE_BLOCK, LINK, IMAGE, TABLE, SDOC_LINK, FILE_LINK, PARAGRAPH, CALL_OUT, COLUMN, SEATABLE_VIEW } from './element-type';
2
+ import { BLOCKQUOTE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, ORDERED_LIST, UNORDERED_LIST, CHECK_LIST_ITEM, CODE_BLOCK, LINK, IMAGE, TABLE, SDOC_LINK, FILE_LINK, PARAGRAPH, CALL_OUT, COLUMN, SEATABLE_TABLE } from './element-type';
3
3
  export const UNDO = 'undo';
4
4
  export const REDO = 'redo';
5
5
  export const CLEAR_FORMAT = 'clear_format';
@@ -197,11 +197,11 @@ export const MENUS_CONFIG_MAP = {
197
197
  iconClass: 'sdocfont sdoc-choose-column',
198
198
  text: 'SeaTable_column'
199
199
  },
200
- [SEATABLE_VIEW]: {
201
- id: SEATABLE_VIEW,
202
- iconClass: 'sdocfont sdoc-seatable-view',
203
- type: SEATABLE_VIEW,
204
- text: 'SeaTable_view'
200
+ [SEATABLE_TABLE]: {
201
+ id: SEATABLE_TABLE,
202
+ iconClass: 'sdocfont sdoc-seatable-table',
203
+ type: SEATABLE_TABLE,
204
+ text: 'SeaTable_table'
205
205
  }
206
206
  };
207
207
 
@@ -20,7 +20,7 @@ import MentionPlugin from './mention';
20
20
  import QuickInsertPlugin from './quick-insert';
21
21
  import WikiLinkPlugin from './wiki-link';
22
22
  import SeaTableColumnPlugin from './seatable-column';
23
- import SeaTableViewsPlugin from './seatable-views';
23
+ import SeaTableViewsPlugin from './seatable-tables';
24
24
  const Plugins = [MarkDownPlugin, HtmlPlugin, HeaderPlugin, LinkPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, CodeBlockPlugin, ImagePlugin, TablePlugin, TextPlugin, TextAlignPlugin, FontPlugin, SdocLinkPlugin, ParagraphPlugin, FileLinkPlugin, CalloutPlugin, SearchReplacePlugin];
25
25
  const WikiPlugins = [...Plugins, QuickInsertPlugin, WikiLinkPlugin];
26
26
  const CommentPlugins = [MarkDownPlugin, HtmlPlugin, ParagraphPlugin, TextPlugin, ListPlugin, ImagePlugin, LinkPlugin, MentionPlugin, BlockquotePlugin];
@@ -1,8 +1,8 @@
1
1
  import { Editor, Transforms } from '@seafile/slate';
2
2
  import slugId from 'slugid';
3
3
  import { getNodeType, isTextNode, getParentNode, generateDefaultText } from '../../core';
4
- import { ELEMENT_TYPE, SEATABLE_VIEW } from '../../constants';
5
- export const isInsertSeaTableViewDisabled = (editor, readonly) => {
4
+ import { ELEMENT_TYPE, SEATABLE_TABLE } from '../../constants';
5
+ export const isInsertSeaTableTableDisabled = (editor, readonly) => {
6
6
  if (readonly) return true;
7
7
  const {
8
8
  selection
@@ -33,18 +33,15 @@ export const isInsertSeaTableViewDisabled = (editor, readonly) => {
33
33
  if (match) return true;
34
34
  return false;
35
35
  };
36
- export const generateSeaTableView = (table_id, view_id) => {
36
+ export const generateSeaTableTable = table_id => {
37
37
  return {
38
38
  id: slugId.nice(),
39
- type: SEATABLE_VIEW,
39
+ type: SEATABLE_TABLE,
40
40
  table_id,
41
- view_id,
42
41
  children: [generateDefaultText()]
43
42
  };
44
43
  };
45
- export const insertSeaTableView = (editor, item) => {
46
- const table_id = editor.table_id;
47
- const view_id = item._id;
48
- const node = generateSeaTableView(table_id, view_id);
44
+ export const insertSeaTableTable = (editor, item) => {
45
+ const node = generateSeaTableTable(item._id);
49
46
  Transforms.setNodes(editor, node);
50
47
  };
@@ -1,14 +1,14 @@
1
- import { SEATABLE_VIEW } from '../../constants';
1
+ import { SEATABLE_TABLE } from '../../constants';
2
2
  import ImageMenu from './menu';
3
3
  import SeaTableView from './model';
4
4
  import withSeaTableView from './plugin';
5
5
  import renderSeaTableView from './render-element';
6
- const SeaTableViewsPlugin = {
7
- type: SEATABLE_VIEW,
6
+ const SeaTableTablesPlugin = {
7
+ type: SEATABLE_TABLE,
8
8
  nodeType: 'element',
9
9
  model: SeaTableView,
10
10
  editorMenus: [ImageMenu],
11
11
  editorPlugin: withSeaTableView,
12
12
  renderElements: [renderSeaTableView]
13
13
  };
14
- export default SeaTableViewsPlugin;
14
+ export default SeaTableTablesPlugin;
@@ -1,18 +1,18 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import { UncontrolledPopover } from 'reactstrap';
3
- import { insertSeaTableView, isInsertSeaTableViewDisabled } from '../helpers';
4
- import { MENUS_CONFIG_MAP, SEATABLE_VIEW } from '../../../constants';
3
+ import { insertSeaTableTable, isInsertSeaTableTableDisabled } from '../helpers';
4
+ import { MENUS_CONFIG_MAP, SEATABLE_TABLE } from '../../../constants';
5
5
  import DropdownMenuItem from '../../../commons/dropdown-menu-item';
6
- const SeaTableViewMenu = _ref => {
6
+ const SeaTableTableMenu = _ref => {
7
7
  let {
8
8
  editor,
9
9
  readonly
10
10
  } = _ref;
11
- const disabled = isInsertSeaTableViewDisabled(editor, readonly);
12
- const menuConfig = MENUS_CONFIG_MAP[SEATABLE_VIEW];
13
- const views = editor.views;
11
+ const disabled = isInsertSeaTableTableDisabled(editor, readonly);
12
+ const menuConfig = MENUS_CONFIG_MAP[SEATABLE_TABLE];
13
+ const tables = editor.tables;
14
14
  const onViewClick = useCallback(item => {
15
- insertSeaTableView(editor, item);
15
+ insertSeaTableTable(editor, item);
16
16
  }, [editor]);
17
17
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownMenuItem, {
18
18
  disabled: disabled,
@@ -29,7 +29,7 @@ const SeaTableViewMenu = _ref => {
29
29
  fade: false
30
30
  }, /*#__PURE__*/React.createElement("div", {
31
31
  className: "sdoc-dropdown-menu-container"
32
- }, views.map(item => {
32
+ }, tables.map(item => {
33
33
  return /*#__PURE__*/React.createElement("div", {
34
34
  key: item._id,
35
35
  className: "sdoc-dropdown-menu-item",
@@ -37,4 +37,4 @@ const SeaTableViewMenu = _ref => {
37
37
  }, item.name);
38
38
  }))));
39
39
  };
40
- export default SeaTableViewMenu;
40
+ export default SeaTableTableMenu;
@@ -0,0 +1,11 @@
1
+ import { SEATABLE_TABLE } from '../../constants/element-type';
2
+ class SeaTableTable {
3
+ constructor(options) {
4
+ this.type = options.type || SEATABLE_TABLE;
5
+ this.table_id = options.table_id;
6
+ this.children = options.children || [{
7
+ text: ''
8
+ }];
9
+ }
10
+ }
11
+ export default SeaTableTable;
@@ -1,6 +1,6 @@
1
1
  import { Transforms, Path, Editor, Element, Range } from '@seafile/slate';
2
2
  import { focusEditor, generateEmptyElement, getNodeType, isBlockAboveEmpty, isLastNode } from '../../core';
3
- import { PARAGRAPH, SEATABLE_VIEW } from '../../constants/element-type';
3
+ import { PARAGRAPH, SEATABLE_TABLE } from '../../constants/element-type';
4
4
  const withSeaTableView = editor => {
5
5
  const {
6
6
  isVoid,
@@ -14,7 +14,7 @@ const withSeaTableView = editor => {
14
14
  const {
15
15
  type
16
16
  } = elem;
17
- if (type === SEATABLE_VIEW) {
17
+ if (type === SEATABLE_TABLE) {
18
18
  return true;
19
19
  }
20
20
  return isVoid(elem);
@@ -29,16 +29,16 @@ const withSeaTableView = editor => {
29
29
  });
30
30
  if (!point) return deleteBackward(unit);
31
31
  const [node, path] = Editor.node(editor, [point.path[0], point.path[1]]);
32
- const isPerviousSeaTableView = node.type === SEATABLE_VIEW;
32
+ const isPerviousSeaTableView = node.type === SEATABLE_TABLE;
33
33
  if (isPerviousSeaTableView && Range.isCollapsed(selection) && isBlockAboveEmpty(editor) && !Path.isCommon(path, selection.anchor.path)) {
34
34
  deleteBackward(unit);
35
35
  focusEditor(newEditor, Editor.end(newEditor, focusPoint));
36
36
  return;
37
37
  }
38
- if (Element.isElement(node) && node.type === SEATABLE_VIEW) {
38
+ if (Element.isElement(node) && node.type === SEATABLE_TABLE) {
39
39
  // If the wrapping element is image_block, delete the wrapping element
40
40
  const [parentNode, p] = Editor.node(editor, [path[0]]);
41
- if (parentNode.type === SEATABLE_VIEW) {
41
+ if (parentNode.type === SEATABLE_TABLE) {
42
42
  Transforms.removeNodes(editor, {
43
43
  at: p
44
44
  });
@@ -53,7 +53,7 @@ const withSeaTableView = editor => {
53
53
  newEditor.normalizeNode = _ref => {
54
54
  let [node, path] = _ref;
55
55
  const type = getNodeType(node);
56
- if (type !== SEATABLE_VIEW) {
56
+ if (type !== SEATABLE_TABLE) {
57
57
  return normalizeNode([node, path]);
58
58
  }
59
59
 
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import SeaTableTable from './seatable-table';
3
+ const renderSeaTableTable = (props, editor) => {
4
+ return /*#__PURE__*/React.createElement(SeaTableTable, Object.assign({}, props, {
5
+ editor: editor
6
+ }));
7
+ };
8
+ export default renderSeaTableTable;
@@ -2,10 +2,9 @@ import React from 'react';
2
2
  import { getColumnWidth } from '../../seatable-column/helpers';
3
3
  export default function RecordItem(_ref) {
4
4
  let {
5
- editor,
6
5
  record,
7
6
  columns,
8
- getViewCellValue
7
+ getTableCellValue
9
8
  } = _ref;
10
9
  return /*#__PURE__*/React.createElement("tr", {
11
10
  className: "seatable-view-body-column-row"
@@ -17,6 +16,6 @@ export default function RecordItem(_ref) {
17
16
  style: {
18
17
  width
19
18
  }
20
- }, getViewCellValue(record, column));
19
+ }, getTableCellValue(record, column));
21
20
  }));
22
21
  }
@@ -4,16 +4,14 @@ export default function RecordList(_ref) {
4
4
  let {
5
5
  records,
6
6
  columns,
7
- editor,
8
- getViewCellValue
7
+ getTableCellValue
9
8
  } = _ref;
10
9
  return /*#__PURE__*/React.createElement("tbody", null, records.map(record => {
11
10
  return /*#__PURE__*/React.createElement(RecordItem, {
12
11
  key: record._id,
13
12
  record: record,
14
13
  columns: columns,
15
- editor: editor,
16
- getViewCellValue: getViewCellValue
14
+ getTableCellValue: getTableCellValue
17
15
  });
18
16
  }));
19
17
  }
@@ -5,7 +5,7 @@ import Loading from '../../../../../components/loading';
5
5
  import RecordHeader from './record-header';
6
6
  import RecordList from './record-list';
7
7
  import './index.css';
8
- function SeaTableView(_ref) {
8
+ function SeaTableTable(_ref) {
9
9
  let {
10
10
  element,
11
11
  className,
@@ -20,25 +20,24 @@ function SeaTableView(_ref) {
20
20
  const [columns, setColumns] = useState([]);
21
21
  useEffect(() => {
22
22
  const {
23
- table_id,
24
- view_id
23
+ table_id
25
24
  } = element;
26
- const rows = editor.getViewRowsById(table_id, view_id);
27
- const columns = editor.getViewColsById(table_id, view_id);
25
+ const table = editor.getTableById(table_id);
26
+ // todo
27
+ const rows = table.rows.slice(0, 50);
28
28
  setRecords(rows);
29
- setColumns(columns);
29
+ setColumns(table.columns);
30
30
  setIsLoading(false);
31
31
  // eslint-disable-next-line react-hooks/exhaustive-deps
32
32
  }, [element]);
33
33
  const containerClass = classNames('seatable-view-container', {
34
34
  selected: isSelected
35
35
  });
36
- const getViewCellValue = useCallback((row, column) => {
36
+ const getTableCellValue = useCallback((row, column) => {
37
37
  const {
38
- table_id,
39
- view_id
38
+ table_id
40
39
  } = element;
41
- return editor.getViewCellValue(table_id, view_id, row, column);
40
+ return editor.getTableCellValue(table_id, row, column);
42
41
  }, [editor, element]);
43
42
  return /*#__PURE__*/React.createElement("div", Object.assign({}, attributes, {
44
43
  className: containerClass,
@@ -51,7 +50,7 @@ function SeaTableView(_ref) {
51
50
  editor: editor,
52
51
  records: records,
53
52
  columns: columns,
54
- getViewCellValue: getViewCellValue
53
+ getTableCellValue: getTableCellValue
55
54
  })), children);
56
55
  }
57
- export default SeaTableView;
56
+ export default SeaTableTable;
@@ -5,7 +5,7 @@ import { BlockquotePlugin, LinkPlugin, CheckListPlugin, HeaderPlugin, ListPlugin
5
5
  import { onDragOver, onDragLeave, onDrop } from '../toolbar/side-toolbar/event';
6
6
  import { getParentNode } from '../core';
7
7
  import { setDataRoot, setMouseEnter } from './helper';
8
- import { COLUMN, WIKI_LINK, SEATABLE_VIEW } from '../constants/element-type';
8
+ import { COLUMN, WIKI_LINK, SEATABLE_TABLE } from '../constants/element-type';
9
9
  import { WIKI_EDITOR, DIFF_VIEWER } from '../../constants';
10
10
  const CustomRenderElement = props => {
11
11
  const editor = useSlateStatic();
@@ -179,10 +179,10 @@ const CustomRenderElement = props => {
179
179
  const [renderColumn] = SeaTableColumnPlugin.renderElements;
180
180
  return renderColumn(props, editor);
181
181
  }
182
- case SEATABLE_VIEW:
182
+ case SEATABLE_TABLE:
183
183
  {
184
- const [renderSeaTableView] = SeaTableViewsPlugin.renderElements;
185
- return renderSeaTableView(props, editor);
184
+ const [renderSeaTableTable] = SeaTableViewsPlugin.renderElements;
185
+ return renderSeaTableTable(props, editor);
186
186
  }
187
187
  default:
188
188
  {
@@ -9,7 +9,7 @@ import CodeBlockMenu from '../../../plugins/code-block/menu';
9
9
  import SdocLinkMenu from '../../../plugins/sdoc-link/menu';
10
10
  import FileLinkMenu from '../../../plugins/file-link/menu';
11
11
  import SeaTableColumnMenu from '../../../plugins/seatable-column/menu';
12
- import SeaTableViewMenu from '../../../plugins/seatable-views/menu';
12
+ import SeaTableTableMenu from '../../../plugins/seatable-tables/menu';
13
13
  import EventBus from '../../../../utils/event-bus';
14
14
  import './index.css';
15
15
  const InsertToolbar = _ref => {
@@ -87,7 +87,7 @@ const InsertToolbar = _ref => {
87
87
  }
88
88
  }, /*#__PURE__*/React.createElement(ImageMenu, props), /*#__PURE__*/React.createElement(TableMenu, props), /*#__PURE__*/React.createElement(LinkMenu, props), /*#__PURE__*/React.createElement(CodeBlockMenu, props), /*#__PURE__*/React.createElement("div", {
89
89
  className: "sdoc-dropdown-menu-divider"
90
- }), editor.columns && /*#__PURE__*/React.createElement(SeaTableColumnMenu, props), editor.views && /*#__PURE__*/React.createElement(SeaTableViewMenu, props), /*#__PURE__*/React.createElement(SdocLinkMenu, props), /*#__PURE__*/React.createElement(FileLinkMenu, props))));
90
+ }), editor.columns && /*#__PURE__*/React.createElement(SeaTableColumnMenu, props), editor.tables && /*#__PURE__*/React.createElement(SeaTableTableMenu, props), /*#__PURE__*/React.createElement(SdocLinkMenu, props), /*#__PURE__*/React.createElement(FileLinkMenu, props))));
91
91
  };
92
92
  InsertToolbar.defaultProps = {
93
93
  isRichEditor: true,
@@ -18,11 +18,10 @@ const DocumentPluginEditor = _ref => {
18
18
  scrollRef,
19
19
  tableId,
20
20
  columns,
21
- views,
22
- getViewRowsById,
23
- getViewColsById,
24
21
  getColumnCellValue,
25
- getViewCellValue
22
+ tables,
23
+ getTableById,
24
+ getTableCellValue
26
25
  } = _ref;
27
26
  context.initApi();
28
27
  const forceUpdate = useForceUpdate();
@@ -39,12 +38,16 @@ const DocumentPluginEditor = _ref => {
39
38
  cursors
40
39
  } = document;
41
40
  newEditor.getColumnCellValue = getColumnCellValue;
41
+
42
+ // insert column
42
43
  newEditor.table_id = tableId;
43
- newEditor.views = views || [];
44
44
  newEditor.columns = columns || [];
45
- newEditor.getViewRowsById = getViewRowsById;
46
- newEditor.getViewColsById = getViewColsById;
47
- newEditor.getViewCellValue = getViewCellValue;
45
+ newEditor.getColumnCellValue = getColumnCellValue;
46
+
47
+ // insert table
48
+ newEditor.tables = tables || [];
49
+ newEditor.getTableById = getTableById;
50
+ newEditor.getTableCellValue = getTableCellValue;
48
51
  newEditor.cursors = cursors || {};
49
52
  newEditor.width = PAGE_EDIT_AREA_WIDTH; // default width
50
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.5.75",
3
+ "version": "0.5.76",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -462,5 +462,5 @@
462
462
  "Vertical_align": "Vertical alignment",
463
463
  "Horizontal_align": "Horizontal alignment",
464
464
  "SeaTable_column": "SeaTable column",
465
- "SeaTable_view": "SeaTable view"
465
+ "SeaTable_table": "SeaTable table"
466
466
  }
@@ -14,9 +14,9 @@
14
14
  />
15
15
  <missing-glyph />
16
16
 
17
- <glyph glyph-name="sdoc-more-vertical-left" unicode="&#58992;" d="M703.629257 704.370743c-54.294956 0-95.814629 41.519672-95.814628 95.814628s41.519672 95.814629 95.814628 95.814629 95.814629-41.519672 95.814629-95.814629-41.519672-95.814629-95.814629-95.814628z m0-415.196724c-54.294956 0-95.814629 41.519672-95.814628 95.814628s41.519672 95.814629 95.814628 95.814629 95.814629-41.519672 95.814629-95.814629-41.519672-95.814629-95.814629-95.814628z m0-415.196724c-54.294956 0-95.814629 41.519672-95.814628 95.814628s41.519672 95.814629 95.814628 95.814629 95.814629-41.519672 95.814629-95.814629-41.519672-95.814629-95.814629-95.814628zM310.78928 857.674149L16.957752 432.895962c-19.162926-28.744389-19.162926-76.651703 0-105.396092L310.78928-94.084496c19.162926-28.744389 60.682598-44.713493 89.426987-25.550568 28.744389 22.356747 38.325851 63.876419 19.162925 92.620808L125.547665 381.794826l287.443885 405.615262c25.550568 35.13203 25.550568 73.457882-12.775283 95.814628s-67.07024 3.193821-89.426987-25.550567z" horiz-adv-x="1024" />
17
+ <glyph glyph-name="sdoc-seatable-table" unicode="&#58991;" d="M384 896c35.2 0 64-28.8 64-64v-320c0-35.2-28.8-64-64-64H64c-35.2 0-64 28.8-64 64V832C0 867.2 28.8 896 64 896h320z m-32-96H96v-256h256V800z m608 96c35.2 0 64-28.8 64-64v-320c0-35.2-28.8-64-64-64H640c-35.2 0-64 28.8-64 64V832c0 35.2 28.8 64 64 64h320z m-32-96h-256v-256h256V800zM384 320c35.2 0 64-28.8 64-64v-320c0-35.2-28.8-64-64-64H64c-35.2 0-64 28.8-64 64V256c0 35.2 28.8 64 64 64h320z m-32-96H96v-256h256v256z m608 96c35.2 0 64-28.8 64-64v-320c0-35.2-28.8-64-64-64H640c-35.2 0-64 28.8-64 64V256c0 35.2 28.8 64 64 64h320z m-32-96h-256v-256h256v256z" horiz-adv-x="1024" />
18
18
 
19
- <glyph glyph-name="sdoc-seatable-view" unicode="&#58991;" d="M384 896c35.2 0 64-28.8 64-64v-320c0-35.2-28.8-64-64-64H64c-35.2 0-64 28.8-64 64V832C0 867.2 28.8 896 64 896h320z m-32-96H96v-256h256V800z m608 96c35.2 0 64-28.8 64-64v-320c0-35.2-28.8-64-64-64H640c-35.2 0-64 28.8-64 64V832c0 35.2 28.8 64 64 64h320z m-32-96h-256v-256h256V800zM384 320c35.2 0 64-28.8 64-64v-320c0-35.2-28.8-64-64-64H64c-35.2 0-64 28.8-64 64V256c0 35.2 28.8 64 64 64h320z m-32-96H96v-256h256v256z m608 96c35.2 0 64-28.8 64-64v-320c0-35.2-28.8-64-64-64H640c-35.2 0-64 28.8-64 64V256c0 35.2 28.8 64 64 64h320z m-32-96h-256v-256h256v256z" horiz-adv-x="1024" />
19
+ <glyph glyph-name="sdoc-more-vertical-left" unicode="&#58992;" d="M703.629257 704.370743c-54.294956 0-95.814629 41.519672-95.814628 95.814628s41.519672 95.814629 95.814628 95.814629 95.814629-41.519672 95.814629-95.814629-41.519672-95.814629-95.814629-95.814628z m0-415.196724c-54.294956 0-95.814629 41.519672-95.814628 95.814628s41.519672 95.814629 95.814628 95.814629 95.814629-41.519672 95.814629-95.814629-41.519672-95.814629-95.814629-95.814628z m0-415.196724c-54.294956 0-95.814629 41.519672-95.814628 95.814628s41.519672 95.814629 95.814628 95.814629 95.814629-41.519672 95.814629-95.814629-41.519672-95.814629-95.814629-95.814628zM310.78928 857.674149L16.957752 432.895962c-19.162926-28.744389-19.162926-76.651703 0-105.396092L310.78928-94.084496c19.162926-28.744389 60.682598-44.713493 89.426987-25.550568 28.744389 22.356747 38.325851 63.876419 19.162925 92.620808L125.547665 381.794826l287.443885 405.615262c25.550568 35.13203 25.550568 73.457882-12.775283 95.814628s-67.07024 3.193821-89.426987-25.550567z" horiz-adv-x="1024" />
20
20
 
21
21
  <glyph glyph-name="sdoc-text-style" unicode="&#58990;" d="M147.2 156.8h160l67.2 153.6h278.4L720 156.8h160L598.4 896H428.8L147.2 156.8z m348.8 512h35.2l83.2-227.2H409.6L496 668.8zM774.4-128V32h160v-160h-160zM419.2 32h160v-160h-160V32zM96 32h160v-160H96V32z" horiz-adv-x="1024" />
22
22
 
@@ -1,14 +1,14 @@
1
1
  @font-face {
2
2
  font-family: "sdocfont";
3
3
  /* Project id 4097705 */
4
- src: url('./sdoc-editor-font/iconfont.eot?t=1718674664011');
4
+ src: url('./sdoc-editor-font/iconfont.eot?t=1718766655905');
5
5
  /* IE9 */
6
- src: url('./sdoc-editor-font/iconfont.eot?t=1718674664011#iefix') format('embedded-opentype'),
6
+ src: url('./sdoc-editor-font/iconfont.eot?t=1718766655905#iefix') format('embedded-opentype'),
7
7
  /* IE6-IE8 */
8
- url('./sdoc-editor-font/iconfont.woff2?t=1718674664011') format('woff2'),
9
- url('./sdoc-editor-font/iconfont.woff?t=1718674664011') format('woff'),
10
- url('./sdoc-editor-font/iconfont.ttf?t=1718674664011') format('truetype'),
11
- url('./sdoc-editor-font/iconfont.svg?t=1718674664011#sdocfont') format('svg');
8
+ url('./sdoc-editor-font/iconfont.woff2?t=1718766655905') format('woff2'),
9
+ url('./sdoc-editor-font/iconfont.woff?t=1718766655905') format('woff'),
10
+ url('./sdoc-editor-font/iconfont.ttf?t=1718766655905') format('truetype'),
11
+ url('./sdoc-editor-font/iconfont.svg?t=1718766655905#sdocfont') format('svg');
12
12
  }
13
13
 
14
14
  .sdocfont {
@@ -19,12 +19,12 @@
19
19
  -moz-osx-font-smoothing: grayscale;
20
20
  }
21
21
 
22
- .sdoc-more-vertical-left:before {
23
- content: "\e670";
22
+ .sdoc-seatable-table:before {
23
+ content: "\e66f";
24
24
  }
25
25
 
26
- .sdoc-seatable-view:before {
27
- content: "\e66f";
26
+ .sdoc-more-vertical-left:before {
27
+ content: "\e670";
28
28
  }
29
29
 
30
30
  .sdoc-text-style:before {
@@ -1,12 +0,0 @@
1
- import { SEATABLE_VIEW } from '../../constants/element-type';
2
- class SeaTableView {
3
- constructor(options) {
4
- this.type = options.type || SEATABLE_VIEW;
5
- this.table_id = options.table_id;
6
- this.view_id = options.view_id;
7
- this.children = options.children || [{
8
- text: ''
9
- }];
10
- }
11
- }
12
- export default SeaTableView;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import SeaTableView from './seatable-view';
3
- const renderSeaTableView = (props, editor) => {
4
- return /*#__PURE__*/React.createElement(SeaTableView, Object.assign({}, props, {
5
- editor: editor
6
- }));
7
- };
8
- export default renderSeaTableView;