@seafile/sdoc-editor 1.0.39 → 1.0.40
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/basic-sdk/assets/css/dropdown-menu.css +2 -0
- package/dist/basic-sdk/extension/plugins/callout/plugin.js +3 -1
- package/dist/basic-sdk/extension/plugins/seatable-column/menu/column-list-menu.js +18 -5
- package/dist/basic-sdk/extension/plugins/seatable-tables/menu/index.js +11 -16
- package/dist/basic-sdk/extension/plugins/seatable-tables/menu/seatable-list.js +37 -0
- package/package.json +1 -1
|
@@ -17,7 +17,8 @@ const withCallout = editor => {
|
|
|
17
17
|
insertFragment,
|
|
18
18
|
deleteBackward,
|
|
19
19
|
onHotKeyDown,
|
|
20
|
-
insertData
|
|
20
|
+
insertData,
|
|
21
|
+
onCopy
|
|
21
22
|
} = editor;
|
|
22
23
|
const newEditor = editor;
|
|
23
24
|
newEditor.deleteBackward = unit => {
|
|
@@ -105,6 +106,7 @@ const withCallout = editor => {
|
|
|
105
106
|
if (getCalloutEntry(editor)) {
|
|
106
107
|
event.stopPropagation();
|
|
107
108
|
}
|
|
109
|
+
return onCopy(event);
|
|
108
110
|
};
|
|
109
111
|
return newEditor;
|
|
110
112
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useMemo, useCallback } from 'react';
|
|
1
|
+
import React, { useMemo, useCallback, useRef, useEffect, useState } from 'react';
|
|
2
2
|
import { COLUMNS_ICON_CONFIG } from '../constants/column';
|
|
3
3
|
import { insertSeaTableColumn, getColumnType } from '../helpers';
|
|
4
4
|
import { COLUMN } from '../../../constants/element-type';
|
|
@@ -9,7 +9,21 @@ export default function ColumnListMenu(_ref) {
|
|
|
9
9
|
editor,
|
|
10
10
|
insertPosition
|
|
11
11
|
} = _ref;
|
|
12
|
-
const
|
|
12
|
+
const columnRef = useRef(null);
|
|
13
|
+
const [computedStyle, setComputedStyle] = useState({});
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (insertPosition) {
|
|
16
|
+
setComputedStyle({
|
|
17
|
+
bottom: '0px'
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (!insertPosition && (columnRef === null || columnRef === void 0 ? void 0 : columnRef.current)) {
|
|
21
|
+
const centerPosition = parseInt(columnRef.current.getBoundingClientRect().height / 2);
|
|
22
|
+
setComputedStyle({
|
|
23
|
+
top: "-".concat(centerPosition, "px")
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}, [insertPosition]);
|
|
13
27
|
const columns = useMemo(() => {
|
|
14
28
|
if (!editor.columns) return [];
|
|
15
29
|
return editor.columns.filter(column => !NOT_SUPPORT_COLUMN_TYPES.includes(column.type));
|
|
@@ -32,10 +46,9 @@ export default function ColumnListMenu(_ref) {
|
|
|
32
46
|
insertSeaTableColumn(editor, active, option, insertPosition);
|
|
33
47
|
}, [editor, insertPosition]);
|
|
34
48
|
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
ref: columnRef,
|
|
35
50
|
className: "column-list-menu",
|
|
36
|
-
style:
|
|
37
|
-
bottom: computedBottom
|
|
38
|
-
}
|
|
51
|
+
style: computedStyle
|
|
39
52
|
}, options.map(option => {
|
|
40
53
|
return /*#__PURE__*/React.createElement("div", {
|
|
41
54
|
key: option.value,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useRef } from 'react';
|
|
2
2
|
import { UncontrolledPopover } from 'reactstrap';
|
|
3
3
|
import { insertSeaTableTable, isInsertSeaTableTableDisabled } from '../helpers';
|
|
4
4
|
import { MENUS_CONFIG_MAP, SEATABLE_TABLE } from '../../../constants';
|
|
5
5
|
import DropdownMenuItem from '../../../commons/dropdown-menu-item';
|
|
6
|
+
import SeaTableList from './seatable-list';
|
|
6
7
|
import './index.css';
|
|
7
8
|
const SeaTableTableMenu = _ref => {
|
|
8
9
|
let {
|
|
@@ -10,10 +11,9 @@ const SeaTableTableMenu = _ref => {
|
|
|
10
11
|
readonly,
|
|
11
12
|
insertPosition
|
|
12
13
|
} = _ref;
|
|
14
|
+
const seatableRef = useRef(null);
|
|
13
15
|
const disabled = isInsertSeaTableTableDisabled(editor, readonly);
|
|
14
16
|
const menuConfig = MENUS_CONFIG_MAP[SEATABLE_TABLE];
|
|
15
|
-
const computedBottom = insertPosition ? '0px' : '';
|
|
16
|
-
const tables = editor.tables;
|
|
17
17
|
const onViewClick = useCallback(item => {
|
|
18
18
|
insertSeaTableTable(editor, item, insertPosition);
|
|
19
19
|
}, [editor, insertPosition]);
|
|
@@ -29,18 +29,13 @@ const SeaTableTableMenu = _ref => {
|
|
|
29
29
|
className: "sdoc-menu-popover sdoc-dropdown-menu sdoc-sub-dropdown-menu",
|
|
30
30
|
placement: "right-start",
|
|
31
31
|
hideArrow: true,
|
|
32
|
-
fade: false
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
key: item._id,
|
|
41
|
-
className: "sdoc-dropdown-menu-item",
|
|
42
|
-
onClick: () => onViewClick(item)
|
|
43
|
-
}, item.name);
|
|
44
|
-
})))));
|
|
32
|
+
fade: false,
|
|
33
|
+
ref: seatableRef
|
|
34
|
+
}, /*#__PURE__*/React.createElement(SeaTableList, {
|
|
35
|
+
editor: editor,
|
|
36
|
+
readonly: readonly,
|
|
37
|
+
insertPosition: insertPosition,
|
|
38
|
+
onViewClick: onViewClick
|
|
39
|
+
}))));
|
|
45
40
|
};
|
|
46
41
|
export default SeaTableTableMenu;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
const SeaTableList = _ref => {
|
|
3
|
+
let {
|
|
4
|
+
editor,
|
|
5
|
+
insertPosition,
|
|
6
|
+
onViewClick
|
|
7
|
+
} = _ref;
|
|
8
|
+
const seatableRef = useRef(null);
|
|
9
|
+
const [computedStyle, setComputedStyle] = useState({});
|
|
10
|
+
const tables = editor.tables;
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (insertPosition) {
|
|
13
|
+
setComputedStyle({
|
|
14
|
+
bottom: '0px'
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (!insertPosition && (seatableRef === null || seatableRef === void 0 ? void 0 : seatableRef.current)) {
|
|
18
|
+
const centerPosition = parseInt(seatableRef.current.getBoundingClientRect().height / 2);
|
|
19
|
+
// 30 is seatable menu height
|
|
20
|
+
setComputedStyle({
|
|
21
|
+
top: "-".concat(centerPosition + 30, "px")
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}, [insertPosition]);
|
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
ref: seatableRef,
|
|
27
|
+
className: "sdoc-dropdown-menu-container sdoc-seatable-selected-table-list-wrapper",
|
|
28
|
+
style: computedStyle
|
|
29
|
+
}, tables.map(item => {
|
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
key: item._id,
|
|
32
|
+
className: "sdoc-dropdown-menu-item",
|
|
33
|
+
onClick: () => onViewClick(item)
|
|
34
|
+
}, item.name);
|
|
35
|
+
}));
|
|
36
|
+
};
|
|
37
|
+
export default SeaTableList;
|