@seafile/sdoc-editor 0.4.35 → 0.4.37
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.
- package/dist/api/seafile-api.js +5 -4
- package/dist/basic-sdk/comment/components/global-comment/index.js +1 -2
- package/dist/basic-sdk/comment/helper.js +2 -2
- package/dist/basic-sdk/comment/utils/index.js +16 -13
- package/dist/basic-sdk/editor/editable-article.js +1 -1
- package/dist/basic-sdk/editor/sdoc-editor.js +1 -2
- package/dist/basic-sdk/extension/commons/element-popover/index.js +3 -2
- package/dist/basic-sdk/extension/commons/history-files/index.js +13 -1
- package/dist/basic-sdk/extension/commons/menu/menu-group.js +3 -2
- package/dist/basic-sdk/extension/constants/font.js +1 -0
- package/dist/basic-sdk/extension/constants/index.js +1 -0
- package/dist/basic-sdk/extension/core/utils/index.js +8 -0
- package/dist/basic-sdk/extension/plugins/blockquote/menu/index.js +7 -6
- package/dist/basic-sdk/extension/plugins/callout/render-elem/index.js +2 -0
- package/dist/basic-sdk/extension/plugins/check-list/menu/index.js +7 -6
- package/dist/basic-sdk/extension/plugins/check-list/render-elem.js +3 -2
- package/dist/basic-sdk/extension/plugins/code-block/helpers.js +4 -2
- package/dist/basic-sdk/extension/plugins/code-block/render-elem.js +2 -0
- package/dist/basic-sdk/extension/plugins/file-link/helpers.js +1 -0
- package/dist/basic-sdk/extension/plugins/header/menu/index.js +21 -20
- package/dist/basic-sdk/extension/plugins/html/helper.js +1 -0
- package/dist/basic-sdk/extension/plugins/image/dialogs/image-previewer.js +7 -6
- package/dist/basic-sdk/extension/plugins/image/helpers.js +13 -8
- package/dist/basic-sdk/extension/plugins/image/hover-menu/index.js +3 -3
- package/dist/basic-sdk/extension/plugins/link/helpers.js +1 -0
- package/dist/basic-sdk/extension/plugins/link/render-elem.js +13 -12
- package/dist/basic-sdk/extension/plugins/list/menu/index.js +9 -8
- package/dist/basic-sdk/extension/plugins/sdoc-link/helpers.js +1 -1
- package/dist/basic-sdk/extension/plugins/table/helpers.js +1 -0
- package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/common-menu.js +9 -8
- package/dist/basic-sdk/extension/plugins/table/menu/table-context-menu/index.js +13 -12
- package/dist/basic-sdk/extension/plugins/table/menu/table-context-menu/insert-table-element.js +9 -8
- package/dist/basic-sdk/extension/plugins/table/render/render-cell.js +9 -9
- package/dist/basic-sdk/extension/plugins/table/render/resize-handlers/column-resize-handler.js +1 -1
- package/dist/basic-sdk/extension/plugins/table/render/resize-handlers/row-resize-handler.js +2 -3
- package/dist/basic-sdk/extension/plugins/table/render/table-header/index.css +4 -1
- package/dist/basic-sdk/extension/plugins/table/render/table-header/rows-header/row-header.js +1 -1
- package/dist/basic-sdk/extension/toolbar/header-toolbar/redo-undo.js +7 -6
- package/dist/basic-sdk/extension/toolbar/side-toolbar/helpers.js +1 -0
- package/dist/basic-sdk/outline/outline-item.js +7 -6
- package/dist/basic-sdk/socket/socket-client.js +49 -48
- package/dist/basic-sdk/socket/socket-manager.js +53 -52
- package/dist/basic-sdk/utils/diff-text.js +21 -20
- package/dist/basic-sdk/utils/dom-utils.js +2 -2
- package/dist/basic-sdk/utils/event-handler.js +8 -7
- package/dist/basic-sdk/utils/object-utils.js +5 -4
- package/dist/components/doc-operations/collaborators-operation/index.js +5 -4
- package/dist/components/draft-dropdown/index.js +11 -10
- package/dist/components/tip-message/index.js +21 -20
- package/dist/components/toast/toast.js +17 -16
- package/dist/components/toast/toastManager.js +14 -13
- package/dist/components/toast/toaster.js +19 -18
- package/dist/context.js +5 -4
- package/dist/slate-convert/html-to-slate/constants.js +34 -0
- package/dist/slate-convert/html-to-slate/helper.js +54 -0
- package/dist/slate-convert/html-to-slate/index.js +131 -0
- package/dist/slate-convert/html-to-slate/rules/blockquote.js +17 -0
- package/dist/slate-convert/html-to-slate/rules/check-list.js +20 -0
- package/dist/slate-convert/html-to-slate/rules/code-block.js +83 -0
- package/dist/slate-convert/html-to-slate/rules/header.js +17 -0
- package/dist/slate-convert/html-to-slate/rules/image.js +22 -0
- package/dist/slate-convert/html-to-slate/rules/index.js +11 -0
- package/dist/slate-convert/html-to-slate/rules/link.js +22 -0
- package/dist/slate-convert/html-to-slate/rules/list.js +50 -0
- package/dist/slate-convert/html-to-slate/rules/paragraph.js +17 -0
- package/dist/slate-convert/html-to-slate/rules/table.js +38 -0
- package/dist/slate-convert/html-to-slate/rules/text.js +56 -0
- package/dist/slate-convert/index.js +8 -0
- package/dist/slate-convert/md-to-html/index.js +48 -0
- package/dist/slate-convert/md-to-html/sanitize-schema.js +17 -0
- package/dist/slate-convert/md-to-slate/index.js +38 -0
- package/dist/slate-convert/md-to-slate/transform.js +360 -0
- package/dist/slate-convert/slate-to-md/index.js +37 -0
- package/dist/slate-convert/slate-to-md/transform.js +311 -0
- package/dist/utils/get-event-transfer.js +3 -1
- package/dist/utils/index.js +6 -6
- package/dist/utils/is-punctuation-mark.js +44 -0
- package/package.json +21 -6
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { Range } from '@seafile/slate';
|
|
3
4
|
import { unWrapLinkNode } from './helpers';
|
|
@@ -8,20 +9,20 @@ import { ELEMENT_TYPE } from '../../constants';
|
|
|
8
9
|
class LinkHoverMenuComponent extends React.Component {
|
|
9
10
|
constructor(props) {
|
|
10
11
|
super(props);
|
|
11
|
-
this
|
|
12
|
+
_defineProperty(this, "registerEventHandle", () => {
|
|
12
13
|
document.addEventListener('click', this.onHideLinkMenu);
|
|
13
|
-
};
|
|
14
|
-
this
|
|
14
|
+
});
|
|
15
|
+
_defineProperty(this, "unregisterEventHandle", () => {
|
|
15
16
|
document.removeEventListener('click', this.onHideLinkMenu);
|
|
16
|
-
};
|
|
17
|
-
this
|
|
17
|
+
});
|
|
18
|
+
_defineProperty(this, "onHideLinkMenu", () => {
|
|
18
19
|
this.setState({
|
|
19
20
|
isShowLinkMenu: false
|
|
20
21
|
}, () => {
|
|
21
22
|
this.unregisterEventHandle();
|
|
22
23
|
});
|
|
23
|
-
};
|
|
24
|
-
this
|
|
24
|
+
});
|
|
25
|
+
_defineProperty(this, "onLinkClick", e => {
|
|
25
26
|
const {
|
|
26
27
|
top,
|
|
27
28
|
left,
|
|
@@ -41,14 +42,14 @@ class LinkHoverMenuComponent extends React.Component {
|
|
|
41
42
|
setTimeout(() => {
|
|
42
43
|
this.registerEventHandle();
|
|
43
44
|
}, 0);
|
|
44
|
-
};
|
|
45
|
-
this
|
|
45
|
+
});
|
|
46
|
+
_defineProperty(this, "deleteLink", () => {
|
|
46
47
|
const {
|
|
47
48
|
editor
|
|
48
49
|
} = this.props;
|
|
49
50
|
unWrapLinkNode(editor);
|
|
50
|
-
};
|
|
51
|
-
this
|
|
51
|
+
});
|
|
52
|
+
_defineProperty(this, "openDialog", () => {
|
|
52
53
|
const {
|
|
53
54
|
element
|
|
54
55
|
} = this.props;
|
|
@@ -56,7 +57,7 @@ class LinkHoverMenuComponent extends React.Component {
|
|
|
56
57
|
type: ELEMENT_TYPE.LINK,
|
|
57
58
|
element
|
|
58
59
|
});
|
|
59
|
-
};
|
|
60
|
+
});
|
|
60
61
|
this.state = {
|
|
61
62
|
isShowLinkMenu: false,
|
|
62
63
|
menuPosition: null
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { MENUS_CONFIG_MAP, ORDERED_LIST, UNORDERED_LIST } from '../../../constants';
|
|
4
5
|
import { focusEditor } from '../../../core';
|
|
@@ -7,21 +8,21 @@ import { getListType, isMenuDisabled, setListType } from '../helpers';
|
|
|
7
8
|
class ListMenu extends React.Component {
|
|
8
9
|
constructor() {
|
|
9
10
|
super(...arguments);
|
|
10
|
-
this
|
|
11
|
+
_defineProperty(this, "isActive", () => {
|
|
11
12
|
const {
|
|
12
13
|
editor,
|
|
13
14
|
type
|
|
14
15
|
} = this.props;
|
|
15
16
|
return getListType(editor, type) === type;
|
|
16
|
-
};
|
|
17
|
-
this
|
|
17
|
+
});
|
|
18
|
+
_defineProperty(this, "isDisabled", () => {
|
|
18
19
|
const {
|
|
19
20
|
editor,
|
|
20
21
|
readonly
|
|
21
22
|
} = this.props;
|
|
22
23
|
return isMenuDisabled(editor, readonly);
|
|
23
|
-
};
|
|
24
|
-
this
|
|
24
|
+
});
|
|
25
|
+
_defineProperty(this, "onMouseDown", e => {
|
|
25
26
|
e.preventDefault();
|
|
26
27
|
e.stopPropagation();
|
|
27
28
|
if (this.isDisabled()) return;
|
|
@@ -33,7 +34,7 @@ class ListMenu extends React.Component {
|
|
|
33
34
|
// 执行命令
|
|
34
35
|
setListType(editor, type);
|
|
35
36
|
focusEditor(editor);
|
|
36
|
-
};
|
|
37
|
+
});
|
|
37
38
|
}
|
|
38
39
|
render() {
|
|
39
40
|
const {
|
|
@@ -53,7 +54,7 @@ class ListMenu extends React.Component {
|
|
|
53
54
|
return /*#__PURE__*/React.createElement(MenuItem, props);
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
ListMenu
|
|
57
|
+
_defineProperty(ListMenu, "defaultProps", {
|
|
57
58
|
type: UNORDERED_LIST
|
|
58
|
-
};
|
|
59
|
+
});
|
|
59
60
|
export default ListMenu;
|
|
@@ -5,7 +5,6 @@ import slugid from 'slugid';
|
|
|
5
5
|
import copy from 'copy-to-clipboard';
|
|
6
6
|
import context from '../../../../context';
|
|
7
7
|
import { focusEditor, getNodeType, getSelectedElems } from '../../core';
|
|
8
|
-
import { LocalStorage } from '../../../../utils';
|
|
9
8
|
import { SDOC_LINK, LINK, INSERT_FILE_DISPLAY_TYPE, CODE_BLOCK, CODE_LINE, PARAGRAPH } from '../../constants';
|
|
10
9
|
export const isMenuDisabled = (editor, readonly) => {
|
|
11
10
|
if (readonly) return true;
|
|
@@ -22,6 +21,7 @@ export const isMenuDisabled = (editor, readonly) => {
|
|
|
22
21
|
if (notMatch) return true; // disabled
|
|
23
22
|
return false; // enable
|
|
24
23
|
};
|
|
24
|
+
|
|
25
25
|
export const generateSdocFileNode = (uuid, text) => {
|
|
26
26
|
const sdocFileNode = {
|
|
27
27
|
id: slugid.nice(),
|
|
@@ -175,6 +175,7 @@ export const isAllInTable = editor => {
|
|
|
175
175
|
if (firstSelectedNode.type !== ELEMENT_TYPE.TABLE) return false;
|
|
176
176
|
return selectedNodes.slice(1).every(node => [ELEMENT_TYPE.TABLE_ROW, ELEMENT_TYPE.TABLE_CELL].includes(node.type)); // same table element
|
|
177
177
|
};
|
|
178
|
+
|
|
178
179
|
export const setCellStyle = (editor, style) => {
|
|
179
180
|
// Select single cell
|
|
180
181
|
if (ObjectUtils.isSameObject(editor.tableSelectedRange, EMPTY_SELECTED_RANGE)) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import React, { Component } from 'react';
|
|
2
3
|
import { UncontrolledPopover } from 'reactstrap';
|
|
3
4
|
class CommonMenu extends Component {
|
|
4
5
|
constructor(props) {
|
|
5
6
|
super(props);
|
|
6
|
-
this
|
|
7
|
+
_defineProperty(this, "getClassName", () => {
|
|
7
8
|
const {
|
|
8
9
|
isRichEditor,
|
|
9
10
|
className,
|
|
@@ -13,11 +14,11 @@ class CommonMenu extends Component {
|
|
|
13
14
|
if (!isRichEditor) return itemClass + ' ' + className + ' sdoc-menu-with-dropdown';
|
|
14
15
|
itemClass = "rich-icon-btn d-flex ".concat(disabled ? 'rich-icon-btn-disabled' : 'rich-icon-btn-hover');
|
|
15
16
|
return itemClass + ' ' + className + ' sdoc-menu-with-dropdown';
|
|
16
|
-
};
|
|
17
|
-
this
|
|
17
|
+
});
|
|
18
|
+
_defineProperty(this, "hidePopover", () => {
|
|
18
19
|
this.ref && this.ref.toggle && this.ref.toggle();
|
|
19
|
-
};
|
|
20
|
-
this
|
|
20
|
+
});
|
|
21
|
+
_defineProperty(this, "setRef", ref => {
|
|
21
22
|
this.ref = ref;
|
|
22
23
|
if (!this.ref) return;
|
|
23
24
|
const {
|
|
@@ -29,7 +30,7 @@ class CommonMenu extends Component {
|
|
|
29
30
|
isShowMenu: !this.state.isShowMenu
|
|
30
31
|
});
|
|
31
32
|
};
|
|
32
|
-
};
|
|
33
|
+
});
|
|
33
34
|
this.state = {
|
|
34
35
|
isShowMenu: false
|
|
35
36
|
};
|
|
@@ -70,8 +71,8 @@ class CommonMenu extends Component {
|
|
|
70
71
|
}, children)));
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
|
-
CommonMenu
|
|
74
|
+
_defineProperty(CommonMenu, "defaultProps", {
|
|
74
75
|
isRichEditor: true,
|
|
75
76
|
className: 'menu-group-item'
|
|
76
|
-
};
|
|
77
|
+
});
|
|
77
78
|
export default CommonMenu;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { withTranslation } from 'react-i18next';
|
|
3
4
|
import ObjectUtils from '../../../../../utils/object-utils';
|
|
@@ -13,7 +14,7 @@ import './index.css';
|
|
|
13
14
|
class TableContextMenu extends React.Component {
|
|
14
15
|
constructor(props) {
|
|
15
16
|
super(props);
|
|
16
|
-
this
|
|
17
|
+
_defineProperty(this, "updateMenuPosition", () => {
|
|
17
18
|
const menuHeight = this.menu.offsetHeight;
|
|
18
19
|
|
|
19
20
|
// get height of context menu when the menu is drawing completed in this page
|
|
@@ -34,36 +35,36 @@ class TableContextMenu extends React.Component {
|
|
|
34
35
|
left
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
|
-
};
|
|
38
|
-
this
|
|
38
|
+
});
|
|
39
|
+
_defineProperty(this, "insertTableElement", (type, position, count) => {
|
|
39
40
|
const {
|
|
40
41
|
editor
|
|
41
42
|
} = this.props;
|
|
42
43
|
insertTableElement(editor, type, position, count);
|
|
43
|
-
};
|
|
44
|
-
this
|
|
44
|
+
});
|
|
45
|
+
_defineProperty(this, "removeTableElement", type => {
|
|
45
46
|
const {
|
|
46
47
|
editor
|
|
47
48
|
} = this.props;
|
|
48
49
|
removeTableElement(editor, type);
|
|
49
|
-
};
|
|
50
|
-
this
|
|
50
|
+
});
|
|
51
|
+
_defineProperty(this, "renderRemoveBtn", (type, title) => {
|
|
51
52
|
return /*#__PURE__*/React.createElement("button", {
|
|
52
53
|
onMouseDown: this.removeTableElement.bind(this, type),
|
|
53
54
|
className: "dropdown-item"
|
|
54
55
|
}, this.props.t(title));
|
|
55
|
-
};
|
|
56
|
-
this
|
|
56
|
+
});
|
|
57
|
+
_defineProperty(this, "combineCells", () => {
|
|
57
58
|
const {
|
|
58
59
|
editor
|
|
59
60
|
} = this.props;
|
|
60
61
|
combineCells(editor);
|
|
61
|
-
};
|
|
62
|
-
this
|
|
62
|
+
});
|
|
63
|
+
_defineProperty(this, "toggleSplitCellSettingDialog", () => {
|
|
63
64
|
this.eventBus.dispatch(INTERNAL_EVENT.INSERT_ELEMENT, {
|
|
64
65
|
type: ELEMENT_TYPE.TABLE_CELL
|
|
65
66
|
});
|
|
66
|
-
};
|
|
67
|
+
});
|
|
67
68
|
this.state = {
|
|
68
69
|
contextStyle: {}
|
|
69
70
|
};
|
package/dist/basic-sdk/extension/plugins/table/menu/table-context-menu/insert-table-element.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import React, { Component } from 'react';
|
|
2
3
|
import { withTranslation } from 'react-i18next';
|
|
3
4
|
import { Input } from 'reactstrap';
|
|
@@ -6,7 +7,7 @@ import { TABLE_MAX_COLUMNS, TABLE_MAX_ROWS, TABLE_ELEMENT, TABLE_ELEMENT_POSITIO
|
|
|
6
7
|
class InsertTableElement extends Component {
|
|
7
8
|
constructor(props) {
|
|
8
9
|
super(props);
|
|
9
|
-
this
|
|
10
|
+
_defineProperty(this, "insertTableElement", () => {
|
|
10
11
|
const {
|
|
11
12
|
type,
|
|
12
13
|
position
|
|
@@ -15,8 +16,8 @@ class InsertTableElement extends Component {
|
|
|
15
16
|
count
|
|
16
17
|
} = this.state;
|
|
17
18
|
this.props.insertTableElement(type, position, count);
|
|
18
|
-
};
|
|
19
|
-
this
|
|
19
|
+
});
|
|
20
|
+
_defineProperty(this, "getTip", () => {
|
|
20
21
|
const {
|
|
21
22
|
type,
|
|
22
23
|
position,
|
|
@@ -26,15 +27,15 @@ class InsertTableElement extends Component {
|
|
|
26
27
|
return position === TABLE_ELEMENT_POSITION.AFTER ? t('Insert_below') : t('Insert_above');
|
|
27
28
|
}
|
|
28
29
|
return position === TABLE_ELEMENT_POSITION.AFTER ? t('Insert_on_the_right') : t('Insert_on_the_left');
|
|
29
|
-
};
|
|
30
|
-
this
|
|
30
|
+
});
|
|
31
|
+
_defineProperty(this, "onKeyDown", event => {
|
|
31
32
|
if (isHotkey('enter', event)) {
|
|
32
33
|
event.preventDefault();
|
|
33
34
|
this.insertTableElement();
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
|
-
};
|
|
37
|
-
this
|
|
37
|
+
});
|
|
38
|
+
_defineProperty(this, "onChange", event => {
|
|
38
39
|
const value = event.target.value || '0';
|
|
39
40
|
const newValue = value ? value.replace(/[^\d,]/g, '') : value;
|
|
40
41
|
if (newValue === this.state.count) return;
|
|
@@ -51,7 +52,7 @@ class InsertTableElement extends Component {
|
|
|
51
52
|
this.setState({
|
|
52
53
|
count: numberValue
|
|
53
54
|
});
|
|
54
|
-
};
|
|
55
|
+
});
|
|
55
56
|
this.state = {
|
|
56
57
|
count: props.count || 1
|
|
57
58
|
};
|
|
@@ -5,9 +5,9 @@ import { useSlateStatic, useReadOnly } from '@seafile/slate-react';
|
|
|
5
5
|
import { Editor, Transforms } from '@seafile/slate';
|
|
6
6
|
import ObjectUtils from '../../../../utils/object-utils';
|
|
7
7
|
import { findPath, focusEditor } from '../../../core';
|
|
8
|
-
import {
|
|
8
|
+
import { useTableSelectedRangeContext } from './hooks';
|
|
9
9
|
import { EMPTY_SELECTED_RANGE, SELECTED_TABLE_CELL_BACKGROUND_COLOR, TABLE_CELL_STYLE } from '../constants';
|
|
10
|
-
import {
|
|
10
|
+
import { colorBlend, getHighlightClass } from '../helpers';
|
|
11
11
|
import EventBus from '../../../../utils/event-bus';
|
|
12
12
|
import { INTERNAL_EVENT } from '../../../../constants';
|
|
13
13
|
const TableCell = _ref => {
|
|
@@ -19,7 +19,6 @@ const TableCell = _ref => {
|
|
|
19
19
|
const editor = useSlateStatic();
|
|
20
20
|
const selectedRange = useTableSelectedRangeContext() || EMPTY_SELECTED_RANGE;
|
|
21
21
|
const cellPath = findPath(editor, element, [0, 0]);
|
|
22
|
-
const columns = useResizeHandlersContext() || getTableColumns(editor, element);
|
|
23
22
|
const pathLength = cellPath.length;
|
|
24
23
|
const rowIndex = cellPath[pathLength - 2];
|
|
25
24
|
const cellIndex = cellPath[pathLength - 1];
|
|
@@ -60,10 +59,10 @@ const TableCell = _ref => {
|
|
|
60
59
|
if (element.is_combined) {
|
|
61
60
|
style.display = 'none';
|
|
62
61
|
}
|
|
63
|
-
if (rowIndex
|
|
62
|
+
if (rowIndex === 0) {
|
|
64
63
|
style.borderTop = '1px solid #ddd';
|
|
65
64
|
}
|
|
66
|
-
if (cellIndex
|
|
65
|
+
if (cellIndex === 0) {
|
|
67
66
|
style.borderLeft = '1px solid #ddd';
|
|
68
67
|
}
|
|
69
68
|
const {
|
|
@@ -85,7 +84,8 @@ const TableCell = _ref => {
|
|
|
85
84
|
tableId
|
|
86
85
|
});
|
|
87
86
|
};
|
|
88
|
-
|
|
87
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
88
|
+
const highlightClass = useMemo(() => getHighlightClass(editor, cellPath), []);
|
|
89
89
|
return /*#__PURE__*/React.createElement("div", Object.assign({}, attributes, {
|
|
90
90
|
style: _objectSpread(_objectSpread({}, element.style), style),
|
|
91
91
|
className: classnames('table-cell', attributes.className, highlightClass, {
|
|
@@ -121,7 +121,7 @@ function renderTableCell(props) {
|
|
|
121
121
|
const cellIndex = cellPath[pathLength - 1];
|
|
122
122
|
|
|
123
123
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
124
|
-
const highlightClass = useMemo(() => getHighlightClass(editor, cellPath), [
|
|
124
|
+
const highlightClass = useMemo(() => getHighlightClass(editor, cellPath), []);
|
|
125
125
|
|
|
126
126
|
// const cellValue = element;
|
|
127
127
|
let style = attributes.style || {};
|
|
@@ -134,10 +134,10 @@ function renderTableCell(props) {
|
|
|
134
134
|
if (element.is_combined) {
|
|
135
135
|
style.display = 'none';
|
|
136
136
|
}
|
|
137
|
-
if (rowIndex
|
|
137
|
+
if (rowIndex === 0) {
|
|
138
138
|
style.borderTop = '1px solid #ddd';
|
|
139
139
|
}
|
|
140
|
-
if (cellIndex
|
|
140
|
+
if (cellIndex === 0) {
|
|
141
141
|
style.borderLeft = '1px solid #ddd';
|
|
142
142
|
}
|
|
143
143
|
const {
|
package/dist/basic-sdk/extension/plugins/table/render/resize-handlers/column-resize-handler.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import React, { useRef, useState, useEffect,
|
|
2
|
+
import React, { useRef, useState, useEffect, useLayoutEffect } from 'react';
|
|
3
3
|
import { useSlateStatic } from '@seafile/slate-react';
|
|
4
4
|
import { useTableRootContext } from '../hooks';
|
|
5
5
|
import { TABLE_CELL_MIN_WIDTH } from '../../constants';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef, useLayoutEffect } from 'react';
|
|
2
|
-
import { useSlateStatic } from '@seafile/slate-react';
|
|
3
|
-
import { ReactEditor } from '@seafile/slate-react';
|
|
2
|
+
import { useSlateStatic, ReactEditor } from '@seafile/slate-react';
|
|
4
3
|
import { TABLE_ROW_MIN_HEIGHT } from '../../constants';
|
|
5
4
|
import { focusClosestCellWhenJustifyCellSize, getRowHeight, updateTableRowHeight } from '../../helpers';
|
|
6
5
|
import { eventStopPropagation, getMouseDownInfo, getMouseMoveInfo, registerResizeEvents, unregisterResizeEvents } from '../../../../../utils/mouse-event';
|
|
@@ -65,7 +64,7 @@ const RowResizeHandler = _ref => {
|
|
|
65
64
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
66
65
|
}, [isDraggingResizeHandler, mouseDownInfo, rowBottom, table, height]);
|
|
67
66
|
useEffect(() => {
|
|
68
|
-
const cell = row.children.filter(cell => !cell.is_combined && (!cell.rowspan || cell.rowspan
|
|
67
|
+
const cell = row.children.filter(cell => !cell.is_combined && (!cell.rowspan || cell.rowspan === 1))[0];
|
|
69
68
|
if (!cell) return;
|
|
70
69
|
const rowDom = ReactEditor.toDOMNode(editor, cell);
|
|
71
70
|
if (!rowDom) return;
|
|
@@ -18,7 +18,10 @@
|
|
|
18
18
|
height: 100%;
|
|
19
19
|
position: absolute;
|
|
20
20
|
left: -12px;
|
|
21
|
-
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.sdoc-table-wrapper .sdoc-table-rows-header .sdoc-table-row-header:first-child {
|
|
24
|
+
border-top: 1px solid rgba(0, 0, 0, .08);
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
.sdoc-table-wrapper .sdoc-table-row-header {
|
package/dist/basic-sdk/extension/plugins/table/render/table-header/rows-header/row-header.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useRef, useCallback, useState, useEffect
|
|
1
|
+
import React, { useRef, useCallback, useState, useEffect } from 'react';
|
|
2
2
|
import { useSlateStatic } from '@seafile/slate-react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import ObjectUtils from '../../../../../../utils/object-utils';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { MenuItem } from '../../commons';
|
|
4
5
|
import { MENUS_CONFIG_MAP, REDO, UNDO } from '../../constants';
|
|
5
6
|
class HistoryMenu extends React.Component {
|
|
6
7
|
constructor() {
|
|
7
8
|
super(...arguments);
|
|
8
|
-
this
|
|
9
|
+
_defineProperty(this, "isDisabled", type => {
|
|
9
10
|
const {
|
|
10
11
|
editor,
|
|
11
12
|
readonly
|
|
@@ -18,19 +19,19 @@ class HistoryMenu extends React.Component {
|
|
|
18
19
|
return history.undos.length === 0;
|
|
19
20
|
}
|
|
20
21
|
return history.redos.length === 0;
|
|
21
|
-
};
|
|
22
|
-
this
|
|
22
|
+
});
|
|
23
|
+
_defineProperty(this, "onUndoMouseDown", () => {
|
|
23
24
|
const {
|
|
24
25
|
editor
|
|
25
26
|
} = this.props;
|
|
26
27
|
editor.undo();
|
|
27
|
-
};
|
|
28
|
-
this
|
|
28
|
+
});
|
|
29
|
+
_defineProperty(this, "onRedoMouseDown", () => {
|
|
29
30
|
const {
|
|
30
31
|
editor
|
|
31
32
|
} = this.props;
|
|
32
33
|
editor.redo();
|
|
33
|
-
};
|
|
34
|
+
});
|
|
34
35
|
}
|
|
35
36
|
render() {
|
|
36
37
|
const {
|
|
@@ -92,6 +92,7 @@ export const getDomTopHeight = (dom, slateNode) => {
|
|
|
92
92
|
if (ADD_POSITION_OFFSET_TYPE.includes(slateNode.type)) {
|
|
93
93
|
offsetY = lightHight / 2 + paddingTop - 12; // side toolbar icon is 12 px
|
|
94
94
|
}
|
|
95
|
+
|
|
95
96
|
const HEADER_HEIGHT = 56 + 44;
|
|
96
97
|
return rect.y - HEADER_HEIGHT + offsetY;
|
|
97
98
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import classNames from 'classnames';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
class OutlineItem extends React.PureComponent {
|
|
4
5
|
constructor(props) {
|
|
5
6
|
super(props);
|
|
6
|
-
this
|
|
7
|
+
_defineProperty(this, "onItemClick", () => {
|
|
7
8
|
const {
|
|
8
9
|
item
|
|
9
10
|
} = this.props;
|
|
@@ -11,17 +12,17 @@ class OutlineItem extends React.PureComponent {
|
|
|
11
12
|
id
|
|
12
13
|
} = item;
|
|
13
14
|
document.getElementById(id).scrollIntoView();
|
|
14
|
-
};
|
|
15
|
-
this
|
|
15
|
+
});
|
|
16
|
+
_defineProperty(this, "onMouseOver", () => {
|
|
16
17
|
this.setState({
|
|
17
18
|
isHighlighted: true
|
|
18
19
|
});
|
|
19
|
-
};
|
|
20
|
-
this
|
|
20
|
+
});
|
|
21
|
+
_defineProperty(this, "onMouseOut", () => {
|
|
21
22
|
this.setState({
|
|
22
23
|
isHighlighted: false
|
|
23
24
|
});
|
|
24
|
-
};
|
|
25
|
+
});
|
|
25
26
|
this.state = {
|
|
26
27
|
isHighlighted: false
|
|
27
28
|
};
|