@seafile/sdoc-editor 0.5.77 → 0.5.78

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.
@@ -45,7 +45,6 @@
45
45
  .sdoc-dropdown-menu .sdoc-dropdown-menu-item .sdoc-dropdown-item-content {
46
46
  display: flex;
47
47
  align-items: center;
48
- justify-content: space-between;
49
48
  flex: 1;
50
49
  font-size: 14px;
51
50
  }
@@ -65,6 +65,7 @@ const EditorComment = _ref => {
65
65
  zIndex: Z_INDEX.COMMENT_ADD
66
66
  };
67
67
  }, [selectionElement, element_comments_map, cursor.y, isShowComments]);
68
+ if (!selectionElement) return null;
68
69
  return /*#__PURE__*/React.createElement("div", {
69
70
  className: "sdoc-comment-container"
70
71
  }, /*#__PURE__*/React.createElement("div", {
@@ -2,3 +2,7 @@
2
2
  .sdoc-dropdown-item-with-left-icon .sdoc-dropdown-item-content .sdoc-dropdown-item-content-icon {
3
3
  color: #444;
4
4
  }
5
+
6
+ .sdoc-link-dropdown-menu-item .sdoc-dropdown-item-content{
7
+ justify-content: space-between;
8
+ }
@@ -28,7 +28,8 @@ const DropdownMenuItem = _ref => {
28
28
  return /*#__PURE__*/React.createElement("div", {
29
29
  className: classnames('sdoc-dropdown-menu-item', className, {
30
30
  'disabled': disabled,
31
- 'sdoc-dropdown-item-with-left-icon': iconClass
31
+ 'sdoc-dropdown-item-with-left-icon': iconClass,
32
+ 'sdoc-link-dropdown-menu-item': shortcut
32
33
  }),
33
34
  id: menuConfig.id || '',
34
35
  onClick: disabled ? () => {} : onClick || (() => {})
@@ -67,8 +67,7 @@ const CodeBlock = _ref => {
67
67
  });
68
68
  focusEditor(editor);
69
69
  Transforms.select(editor, editor.selection);
70
- // eslint-disable-next-line react-hooks/exhaustive-deps
71
- }, []);
70
+ }, [editor, element]);
72
71
  const onFocusCodeBlock = useCallback(e => {
73
72
  if (readOnly) return;
74
73
  if (codeBlockRef.current) {
@@ -1,7 +1,7 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import React from 'react';
3
3
  import { Node, Range } from '@seafile/slate';
4
- import { useSelected, useSlateStatic } from '@seafile/slate-react';
4
+ import { ReactEditor, useSelected, useSlateStatic } from '@seafile/slate-react';
5
5
  import { Placeholder } from '../../core';
6
6
  import { isEmptyNode } from './helper';
7
7
  import { COMMENT_EDITOR, WIKI_EDITOR } from '../../../constants';
@@ -33,7 +33,7 @@ const Paragraph = _ref => {
33
33
  const node = editor.children[1];
34
34
  isShowPlaceHolder = Node.string(element) === '' && (node === null || node === void 0 ? void 0 : node.id) === (element === null || element === void 0 ? void 0 : element.id) && !isComposing;
35
35
  }
36
- if (isSelected && isWikiEditor && Range.isCollapsed(editor.selection) && isEmptyNode(element) && !isComposing) {
36
+ if (isSelected && isWikiEditor && Range.isCollapsed(editor.selection) && isEmptyNode(element) && ReactEditor.findPath(editor, element).length === 1 && !isComposing) {
37
37
  isShowPlaceHolder = true;
38
38
  }
39
39
  const style = {
@@ -69,7 +69,7 @@
69
69
 
70
70
  .sdoc-link-hover-menu-container .hover-menu-container .icon-font {
71
71
  font-size: 12px;
72
- color: #999999;
72
+ color: #444;
73
73
  }
74
74
 
75
75
  .sdoc-link-hover-menu-container .sdoc-file-display-style-popover {
@@ -1,8 +1,7 @@
1
1
  .seatable-view-container {
2
2
  width: 100%;
3
- min-height: 200px;
4
- max-height: 400px;
5
3
  overflow: auto;
4
+ border: 1px solid transparent;
6
5
  }
7
6
 
8
7
  .seatable-view-container.selected {
@@ -1,5 +1,6 @@
1
1
  import React, { useCallback, useEffect, useState } from 'react';
2
2
  import classNames from 'classnames';
3
+ import { useTranslation } from 'react-i18next';
3
4
  import { useSelected } from '@seafile/slate-react';
4
5
  import Loading from '../../../../../components/loading';
5
6
  import RecordHeader from './record-header';
@@ -11,21 +12,21 @@ function SeaTableTable(_ref) {
11
12
  className,
12
13
  attributes,
13
14
  children,
14
- editor,
15
- t
15
+ editor
16
16
  } = _ref;
17
17
  const isSelected = useSelected();
18
18
  const [isLoading, setIsLoading] = useState(true);
19
19
  const [records, setRecords] = useState([]);
20
20
  const [columns, setColumns] = useState([]);
21
+ const {
22
+ t
23
+ } = useTranslation();
21
24
  useEffect(() => {
22
25
  const {
23
26
  table_id
24
27
  } = element;
25
28
  const table = editor.getTableById(table_id);
26
- // todo
27
- const rows = table.rows.slice(0, 50);
28
- setRecords(rows);
29
+ setRecords(table.rows);
29
30
  setColumns(table.columns);
30
31
  setIsLoading(false);
31
32
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -39,18 +40,23 @@ function SeaTableTable(_ref) {
39
40
  } = element;
40
41
  return editor.getTableCellValue(table_id, row, column);
41
42
  }, [editor, element]);
43
+ const isShowMoreMessage = records.length - 10 > 0 ? true : false;
42
44
  return /*#__PURE__*/React.createElement("div", Object.assign({}, attributes, {
43
45
  className: containerClass,
44
46
  contentEditable: false
45
- }), isLoading && /*#__PURE__*/React.createElement(Loading, null), !isLoading && /*#__PURE__*/React.createElement("table", {
47
+ }), isLoading && /*#__PURE__*/React.createElement(Loading, null), !isLoading && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("table", {
46
48
  className: "seatable-view-records"
47
49
  }, /*#__PURE__*/React.createElement(RecordHeader, {
48
50
  columns: columns
49
51
  }), /*#__PURE__*/React.createElement(RecordList, {
50
52
  editor: editor,
51
- records: records,
53
+ records: records.slice(0, 10),
52
54
  columns: columns,
53
55
  getTableCellValue: getTableCellValue
54
- })), children);
56
+ })), isShowMoreMessage && /*#__PURE__*/React.createElement("div", {
57
+ className: "ml-2 m-2"
58
+ }, t('And_x_more_records', {
59
+ count: records.length - 10
60
+ }))), children);
55
61
  }
56
62
  export default SeaTableTable;
@@ -0,0 +1,6 @@
1
+ .sdocfont.sdoc-check-mark {
2
+ position: absolute;
3
+ left: 8px;
4
+ transform: scale(.8);
5
+ color: #798d99;
6
+ }
@@ -5,6 +5,7 @@ import classnames from 'classnames';
5
5
  import { getAlignType, isMenuDisabled, setAlignType } from '../helpers';
6
6
  import { TEXT_ALIGN, MENUS_CONFIG_MAP } from '../../../constants';
7
7
  import Tooltip from '../../../../../components/tooltip';
8
+ import './index.css';
8
9
  const TextAlignMenu = _ref => {
9
10
  let {
10
11
  isRichEditor,
@@ -42,9 +43,10 @@ const TextAlignMenu = _ref => {
42
43
  'rich-icon-btn-hover': isRichEditor && !disabled,
43
44
  'btn btn-icon btn-secondary btn-active d-flex': !isRichEditor
44
45
  });
45
- const curType = getCurrentType();
46
+ let curType = getCurrentType();
46
47
  const curIcon = MENUS_CONFIG_MAP[TEXT_ALIGN].filter(item => item.type === curType)[0].iconClass;
47
48
  const caretIconClass = "sdoc-menu-with-dropdown-triangle-icon sdocfont sdoc-".concat(isShowMenu ? 'caret-up' : 'drop-down');
49
+ curType = 'align_' + curType;
48
50
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
49
51
  type: "button",
50
52
  className: validClassName,
@@ -72,11 +74,14 @@ const TextAlignMenu = _ref => {
72
74
  }, /*#__PURE__*/React.createElement("div", {
73
75
  className: "pt-2 pb-2"
74
76
  }, MENUS_CONFIG_MAP[TEXT_ALIGN].map((item, index) => {
77
+ const isSelected = curType === item.id;
75
78
  return /*#__PURE__*/React.createElement("div", {
76
79
  key: index,
77
80
  className: "sdoc-dropdown-menu-item",
78
81
  onClick: () => setType(item.type)
79
- }, /*#__PURE__*/React.createElement("i", {
82
+ }, isSelected && /*#__PURE__*/React.createElement("i", {
83
+ className: "sdocfont sdoc-check-mark"
84
+ }), /*#__PURE__*/React.createElement("i", {
80
85
  className: item.iconClass
81
86
  }));
82
87
  }))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.5.77",
3
+ "version": "0.5.78",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -462,5 +462,6 @@
462
462
  "Vertical_align": "Vertical alignment",
463
463
  "Horizontal_align": "Horizontal alignment",
464
464
  "SeaTable_column": "SeaTable column",
465
- "SeaTable_table": "SeaTable table"
465
+ "SeaTable_table": "SeaTable table",
466
+ "And_x_more_records": "and {{count}} more records"
466
467
  }