@seafile/sdoc-editor 2.0.25 → 2.0.27
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/extension/constants/element-type.js +2 -1
- package/dist/basic-sdk/extension/constants/index.js +7 -1
- package/dist/basic-sdk/extension/constants/menus-config.js +12 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-edit-dialog/index.css +20 -0
- package/dist/basic-sdk/extension/plugins/chart/chart-edit-dialog/index.js +63 -0
- package/dist/basic-sdk/extension/plugins/chart/helpers.js +68 -0
- package/dist/basic-sdk/extension/plugins/chart/hover-menu/index.css +55 -0
- package/dist/basic-sdk/extension/plugins/chart/hover-menu/index.js +58 -0
- package/dist/basic-sdk/extension/plugins/chart/index.js +19 -0
- package/dist/basic-sdk/extension/plugins/chart/menu/index.js +31 -0
- package/dist/basic-sdk/extension/plugins/chart/plugin.js +26 -0
- package/dist/basic-sdk/extension/plugins/chart/render-elem.css +64 -0
- package/dist/basic-sdk/extension/plugins/chart/render-elem.js +154 -0
- package/dist/basic-sdk/extension/plugins/index.js +8 -1
- package/dist/basic-sdk/extension/render/custom-element.js +5 -0
- package/dist/basic-sdk/extension/toolbar/header-toolbar/insert-toolbar/index.js +2 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/helpers.js +1 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/insert-block-menu.js +14 -2
- package/dist/pages/document-plugin-editor.js +2 -0
- package/package.json +3 -2
- package/public/locales/cs/sdoc-editor.json +4 -1
- package/public/locales/de/sdoc-editor.json +4 -1
- package/public/locales/en/sdoc-editor.json +5 -1
- package/public/locales/es/sdoc-editor.json +4 -1
- package/public/locales/es_AR/sdoc-editor.json +4 -1
- package/public/locales/es_MX/sdoc-editor.json +4 -1
- package/public/locales/fr/sdoc-editor.json +4 -1
- package/public/locales/it/sdoc-editor.json +4 -1
- package/public/locales/ru/sdoc-editor.json +4 -1
- package/public/locales/zh_CN/sdoc-editor.json +4 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WIKI_LINK = exports.VIDEO_LINK = exports.VIDEO = exports.UNORDERED_LIST = exports.TWO_COLUMN = exports.TOP_LEVEL_TYPES = exports.TITLE = exports.THREE_COLUMN = exports.TABLE_ROW = exports.TABLE_CELL = exports.TABLE = exports.SUBTITLE = exports.SEATABLE_TABLE = exports.SEATABLE_ROW = exports.SEATABLE_COLUMN = exports.SDOC_LINK = exports.QUICK_INSERT = exports.PARAGRAPH = exports.ORDERED_LIST = exports.MULTI_COLUMN = exports.MENTION_TEMP = exports.MENTION = exports.LIST_ITEM = exports.LINK = exports.INLINE_LEVEL_TYPES = exports.IMAGE_BLOCK = exports.IMAGE = exports.HEADER6 = exports.HEADER5 = exports.HEADER4 = exports.HEADER3 = exports.HEADER2 = exports.HEADER1 = exports.HEADER = exports.GROUP = exports.FOUR_COLUMN = exports.FONT_SIZE_REDUCE = exports.FONT_SIZE_INCREASE = exports.FONT_SIZE = exports.FIVE_COLUMN = exports.FILE_LINK_INSET_INPUT_TEMP = exports.FILE_LINK = exports.COLUMN = exports.CODE_LINE = exports.CODE_BLOCK = exports.CHECK_LIST_ITEM = exports.CALL_OUT = exports.BLOCKQUOTE = exports.ASK_AI = void 0;
|
|
6
|
+
exports.WIKI_LINK = exports.VIDEO_LINK = exports.VIDEO = exports.UNORDERED_LIST = exports.TWO_COLUMN = exports.TOP_LEVEL_TYPES = exports.TITLE = exports.THREE_COLUMN = exports.TABLE_ROW = exports.TABLE_CELL = exports.TABLE = exports.SUBTITLE = exports.SEATABLE_TABLE = exports.SEATABLE_ROW = exports.SEATABLE_COLUMN = exports.SDOC_LINK = exports.QUICK_INSERT = exports.PARAGRAPH = exports.ORDERED_LIST = exports.MULTI_COLUMN = exports.MENTION_TEMP = exports.MENTION = exports.LIST_ITEM = exports.LINK = exports.INLINE_LEVEL_TYPES = exports.IMAGE_BLOCK = exports.IMAGE = exports.HEADER6 = exports.HEADER5 = exports.HEADER4 = exports.HEADER3 = exports.HEADER2 = exports.HEADER1 = exports.HEADER = exports.GROUP = exports.FOUR_COLUMN = exports.FONT_SIZE_REDUCE = exports.FONT_SIZE_INCREASE = exports.FONT_SIZE = exports.FIVE_COLUMN = exports.FILE_LINK_INSET_INPUT_TEMP = exports.FILE_LINK = exports.COLUMN = exports.CODE_LINE = exports.CODE_BLOCK = exports.CHECK_LIST_ITEM = exports.CHART = exports.CALL_OUT = exports.BLOCKQUOTE = exports.ASK_AI = void 0;
|
|
7
7
|
const BLOCKQUOTE = exports.BLOCKQUOTE = 'blockquote';
|
|
8
8
|
const TITLE = exports.TITLE = 'title';
|
|
9
9
|
const SUBTITLE = exports.SUBTITLE = 'subtitle';
|
|
@@ -43,6 +43,7 @@ const MENTION_TEMP = exports.MENTION_TEMP = 'mention_temp';
|
|
|
43
43
|
const FILE_LINK_INSET_INPUT_TEMP = exports.FILE_LINK_INSET_INPUT_TEMP = 'file_link_insert_input_temp';
|
|
44
44
|
const QUICK_INSERT = exports.QUICK_INSERT = 'quick_insert';
|
|
45
45
|
const VIDEO_LINK = exports.VIDEO_LINK = 'video_link';
|
|
46
|
+
const CHART = exports.CHART = 'chart';
|
|
46
47
|
const SEATABLE_COLUMN = exports.SEATABLE_COLUMN = 'seatable_column';
|
|
47
48
|
const SEATABLE_ROW = exports.SEATABLE_ROW = 'seatable_row';
|
|
48
49
|
const SEATABLE_TABLE = exports.SEATABLE_TABLE = 'seatable_table';
|
|
@@ -23,6 +23,12 @@ Object.defineProperty(exports, "CALL_OUT", {
|
|
|
23
23
|
return _elementType.CALL_OUT;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
+
Object.defineProperty(exports, "CHART", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return _elementType.CHART;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
26
32
|
Object.defineProperty(exports, "CHECK_LIST_ITEM", {
|
|
27
33
|
enumerable: true,
|
|
28
34
|
get: function () {
|
|
@@ -561,4 +567,4 @@ const MOUSE_ENTER_EVENT_DISABLED_MAP = exports.MOUSE_ENTER_EVENT_DISABLED_MAP =
|
|
|
561
567
|
[_elementType.HEADER6]: [_elementType.CALL_OUT],
|
|
562
568
|
[_elementType.CALL_OUT]: [_elementType.CALL_OUT]
|
|
563
569
|
};
|
|
564
|
-
const ROOT_ELEMENT_TYPES = exports.ROOT_ELEMENT_TYPES = [_elementType.PARAGRAPH, _elementType.TITLE, _elementType.SUBTITLE, _elementType.CHECK_LIST_ITEM, _elementType.ORDERED_LIST, _elementType.UNORDERED_LIST, _elementType.BLOCKQUOTE, _elementType.HEADER1, _elementType.HEADER2, _elementType.HEADER3, _elementType.HEADER4, _elementType.HEADER5, _elementType.HEADER6, _elementType.CALL_OUT, _elementType.TABLE, _elementType.CODE_BLOCK, _elementType.IMAGE_BLOCK, _elementType.VIDEO, _elementType.SEATABLE_TABLE, _elementType.SEATABLE_ROW];
|
|
570
|
+
const ROOT_ELEMENT_TYPES = exports.ROOT_ELEMENT_TYPES = [_elementType.PARAGRAPH, _elementType.TITLE, _elementType.SUBTITLE, _elementType.CHECK_LIST_ITEM, _elementType.ORDERED_LIST, _elementType.UNORDERED_LIST, _elementType.BLOCKQUOTE, _elementType.HEADER1, _elementType.HEADER2, _elementType.HEADER3, _elementType.HEADER4, _elementType.HEADER5, _elementType.HEADER6, _elementType.CALL_OUT, _elementType.TABLE, _elementType.CODE_BLOCK, _elementType.IMAGE_BLOCK, _elementType.VIDEO, _elementType.SEATABLE_TABLE, _elementType.SEATABLE_ROW, _elementType.CHART];
|
|
@@ -238,6 +238,11 @@ const MENUS_CONFIG_MAP = exports.MENUS_CONFIG_MAP = {
|
|
|
238
238
|
iconClass: 'sdocfont sdoc-seatable-table',
|
|
239
239
|
type: _elementType.SEATABLE_TABLE,
|
|
240
240
|
text: 'SeaTable_table'
|
|
241
|
+
},
|
|
242
|
+
[_elementType.CHART]: {
|
|
243
|
+
id: `sdoc_${_elementType.CHART}`,
|
|
244
|
+
iconClass: 'sdocfont sdoc-chart',
|
|
245
|
+
text: 'Insert_chart'
|
|
241
246
|
}
|
|
242
247
|
};
|
|
243
248
|
|
|
@@ -359,6 +364,12 @@ const SIDE_INSERT_MENUS_CONFIG = exports.SIDE_INSERT_MENUS_CONFIG = {
|
|
|
359
364
|
type: _elementType.LINK,
|
|
360
365
|
text: 'Link'
|
|
361
366
|
},
|
|
367
|
+
[_elementType.CHART]: {
|
|
368
|
+
id: `sdoc_${_elementType.CHART}`,
|
|
369
|
+
iconClass: 'sdocfont sdoc-chart',
|
|
370
|
+
type: _elementType.CHART,
|
|
371
|
+
text: 'Insert_chart'
|
|
372
|
+
},
|
|
362
373
|
[_elementType.CODE_BLOCK]: {
|
|
363
374
|
id: '',
|
|
364
375
|
iconClass: 'sdocfont sdoc-code-block',
|
|
@@ -447,6 +458,7 @@ const SIDE_INSERT_MENUS_SEARCH_MAP = exports.SIDE_INSERT_MENUS_SEARCH_MAP = {
|
|
|
447
458
|
[_elementType.THREE_COLUMN]: 'Three_column',
|
|
448
459
|
[_elementType.FOUR_COLUMN]: 'Four_column',
|
|
449
460
|
[_elementType.LINK]: 'Link',
|
|
461
|
+
[_elementType.CHART]: 'Chart',
|
|
450
462
|
[_elementType.CODE_BLOCK]: 'Code_block',
|
|
451
463
|
[_elementType.CALL_OUT]: 'Callout',
|
|
452
464
|
[_elementType.UNORDERED_LIST]: 'Unordered_list',
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.sdoc-chart-edit-dialog {
|
|
2
|
+
max-width: 1100px !important;
|
|
3
|
+
width: 1100px !important;
|
|
4
|
+
height: calc(100% - 56px);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.sdoc-chart-edit-dialog .modal-content {
|
|
8
|
+
height: 100%;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.sdoc-chart-edit-dialog .modal-body {
|
|
12
|
+
padding: 0;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
display: flex;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.sdoc-chart-edit-dialog .sdoc-chart-fullscreen-view {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 600px;
|
|
20
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _DTableModalHeader2 = _interopRequireDefault(require("dtable-ui-component/lib/DTableModalHeader"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _reactstrap = require("reactstrap");
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
var _reactI18next = require("react-i18next");
|
|
14
|
+
var _seaChart = require("sea-chart");
|
|
15
|
+
var _context = _interopRequireDefault(require("../../../../../context"));
|
|
16
|
+
require("./index.css");
|
|
17
|
+
const ChartEditDialog = _ref => {
|
|
18
|
+
var _window, _window$app, _window$app$state, _window2, _window2$app, _window2$app$state;
|
|
19
|
+
let {
|
|
20
|
+
editor,
|
|
21
|
+
element,
|
|
22
|
+
api,
|
|
23
|
+
isFullScreen,
|
|
24
|
+
onCloseEditDialog,
|
|
25
|
+
t
|
|
26
|
+
} = _ref;
|
|
27
|
+
const [statItemData, setStatItemData] = (0, _react.useState)(element.stat_item || {});
|
|
28
|
+
const onSettingChange = (0, _react.useCallback)(setting => {
|
|
29
|
+
const newStatItemData = {
|
|
30
|
+
...statItemData,
|
|
31
|
+
...setting
|
|
32
|
+
};
|
|
33
|
+
setStatItemData(newStatItemData);
|
|
34
|
+
}, [statItemData]);
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_reactstrap.Modal, {
|
|
36
|
+
className: "sdoc-chart-edit-dialog",
|
|
37
|
+
isOpen: true,
|
|
38
|
+
toggle: () => onCloseEditDialog(statItemData)
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement(_DTableModalHeader2.default, {
|
|
40
|
+
toggle: () => onCloseEditDialog(statItemData)
|
|
41
|
+
}, t(!isFullScreen ? 'Edit_chart' : 'Chart')), /*#__PURE__*/_react.default.createElement(_reactstrap.ModalBody, {
|
|
42
|
+
className: (0, _classnames.default)({
|
|
43
|
+
'sdoc-chart-fullscreen-view': isFullScreen
|
|
44
|
+
})
|
|
45
|
+
}, !isFullScreen && /*#__PURE__*/_react.default.createElement(_seaChart.Editor, {
|
|
46
|
+
chart: statItemData,
|
|
47
|
+
config: _context.default.getSettings(),
|
|
48
|
+
api: api,
|
|
49
|
+
tables: editor.tables || [],
|
|
50
|
+
collaborators: editor.collaborators || [],
|
|
51
|
+
departments: ((_window = window) === null || _window === void 0 ? void 0 : (_window$app = _window.app) === null || _window$app === void 0 ? void 0 : (_window$app$state = _window$app.state) === null || _window$app$state === void 0 ? void 0 : _window$app$state.departments) || [],
|
|
52
|
+
hideTypeToggle: true,
|
|
53
|
+
onChange: onSettingChange
|
|
54
|
+
}), isFullScreen && /*#__PURE__*/_react.default.createElement(_seaChart.View, {
|
|
55
|
+
chart: statItemData,
|
|
56
|
+
api: api,
|
|
57
|
+
config: _context.default.getSettings(),
|
|
58
|
+
tables: editor.tables,
|
|
59
|
+
collaborators: editor.collaborators || [],
|
|
60
|
+
departments: ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$app = _window2.app) === null || _window2$app === void 0 ? void 0 : (_window2$app$state = _window2$app.state) === null || _window2$app$state === void 0 ? void 0 : _window2$app$state.departments) || []
|
|
61
|
+
})));
|
|
62
|
+
};
|
|
63
|
+
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(ChartEditDialog);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isInsertChartMenuDisabled = exports.isInViewPort = exports.insertChart = exports.generateChartNode = void 0;
|
|
7
|
+
var _slate = require("@seafile/slate");
|
|
8
|
+
var _seaChart = require("sea-chart");
|
|
9
|
+
var _core = require("../../core");
|
|
10
|
+
var _helper = require("../callout/helper");
|
|
11
|
+
var _constants = require("../../constants");
|
|
12
|
+
const isInsertChartMenuDisabled = (editor, readonly) => {
|
|
13
|
+
if (readonly) return true;
|
|
14
|
+
const {
|
|
15
|
+
selection
|
|
16
|
+
} = editor;
|
|
17
|
+
if (selection === null) return true;
|
|
18
|
+
if ((0, _helper.getCalloutEntry)(editor)) return true;
|
|
19
|
+
const selectedElems = (0, _core.getSelectedElems)(editor);
|
|
20
|
+
const hasVoid = selectedElems.some(elem => editor.isVoid(elem));
|
|
21
|
+
if (hasVoid) return true;
|
|
22
|
+
const isMatch = selectedElems.every(elem => {
|
|
23
|
+
const type = (0, _core.getNodeType)(elem);
|
|
24
|
+
if (type === _constants.PARAGRAPH) return true;
|
|
25
|
+
return false;
|
|
26
|
+
});
|
|
27
|
+
if (isMatch) return false; // enable
|
|
28
|
+
return true; // disable
|
|
29
|
+
};
|
|
30
|
+
exports.isInsertChartMenuDisabled = isInsertChartMenuDisabled;
|
|
31
|
+
const generateChartNode = editor => {
|
|
32
|
+
const element = (0, _core.generateEmptyElement)(_constants.CHART);
|
|
33
|
+
const initConfig = {
|
|
34
|
+
option: {
|
|
35
|
+
id: element.id,
|
|
36
|
+
table_id: editor.tables[0]._id // Default first table
|
|
37
|
+
},
|
|
38
|
+
tables: []
|
|
39
|
+
};
|
|
40
|
+
const model = new _seaChart.ChartModel(initConfig.option, initConfig.tables);
|
|
41
|
+
return {
|
|
42
|
+
...element,
|
|
43
|
+
stat_item: {
|
|
44
|
+
...model,
|
|
45
|
+
type: model.config.type
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
exports.generateChartNode = generateChartNode;
|
|
50
|
+
const insertChart = (editor, insertPosition) => {
|
|
51
|
+
const chartNode = generateChartNode(editor);
|
|
52
|
+
let path = _slate.Editor.path(editor, editor.selection)[0];
|
|
53
|
+
if (insertPosition === _constants.INSERT_POSITION.AFTER) {
|
|
54
|
+
path = path + 1;
|
|
55
|
+
}
|
|
56
|
+
_slate.Transforms.insertNodes(editor, chartNode, {
|
|
57
|
+
at: [path]
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
exports.insertChart = insertChart;
|
|
61
|
+
const isInViewPort = element => {
|
|
62
|
+
const viewHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
63
|
+
const {
|
|
64
|
+
top
|
|
65
|
+
} = element.getBoundingClientRect();
|
|
66
|
+
return top >= 0 && top <= viewHeight;
|
|
67
|
+
};
|
|
68
|
+
exports.isInViewPort = isInViewPort;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.sdoc-chart-hover-menu-container {
|
|
2
|
+
position: absolute;
|
|
3
|
+
height: 42px;
|
|
4
|
+
z-index: 101;
|
|
5
|
+
width: auto;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.sdoc-chart-hover-menu-container .hover-menu-container {
|
|
9
|
+
height: 36px;
|
|
10
|
+
padding: 7px 8px;
|
|
11
|
+
background-color: #fff;
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: flex-start;
|
|
14
|
+
align-items: center;
|
|
15
|
+
border-radius: 3px;
|
|
16
|
+
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
|
|
17
|
+
border: 1px solid #e8e8e8;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.sdoc-chart-hover-menu-container .hover-menu-container > span:not(:last-of-type) {
|
|
21
|
+
padding-right: 6px;
|
|
22
|
+
border-right: 1px solid #e5e5e5;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.sdoc-chart-hover-menu-container .hover-menu-container .op-item {
|
|
26
|
+
position: relative;
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
color: #212529;
|
|
29
|
+
padding: 0 5px;
|
|
30
|
+
border-radius: 2px;
|
|
31
|
+
min-width: 24px;
|
|
32
|
+
height: 24px;
|
|
33
|
+
display: inline-flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.sdoc-chart-hover-menu-container .hover-menu-container .op-item:hover {
|
|
39
|
+
color: #212529;
|
|
40
|
+
text-decoration: none;
|
|
41
|
+
background: #f1f1f1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.sdoc-chart-hover-menu-container .op-group-item:last-child .op-item {
|
|
45
|
+
margin-left: 8px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.sdoc-chart-hover-menu-container .hover-menu-container .active {
|
|
49
|
+
background: #f1f1f1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.sdoc-chart-hover-menu-container .hover-menu-container .icon-font {
|
|
53
|
+
font-size: 12px;
|
|
54
|
+
color: #999999;
|
|
55
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactI18next = require("react-i18next");
|
|
11
|
+
var _commons = require("../../../commons");
|
|
12
|
+
var _tooltip = _interopRequireDefault(require("../../../../../components/tooltip"));
|
|
13
|
+
require("./index.css");
|
|
14
|
+
const ChartHoverMenu = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
menuPosition,
|
|
17
|
+
onEditChart,
|
|
18
|
+
onFullscreen,
|
|
19
|
+
t
|
|
20
|
+
} = _ref;
|
|
21
|
+
const [isShowTooltip, setIsShowTooltip] = (0, _react.useState)(false);
|
|
22
|
+
(0, _react.useEffect)(() => {
|
|
23
|
+
setIsShowTooltip(true);
|
|
24
|
+
}, []);
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_commons.ElementPopover, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
26
|
+
className: "sdoc-chart-hover-menu-container",
|
|
27
|
+
style: menuPosition
|
|
28
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
29
|
+
className: "hover-menu-container"
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
31
|
+
className: "op-group-item"
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
33
|
+
id: "sdoc_chart_edit",
|
|
34
|
+
role: "button",
|
|
35
|
+
className: "op-item",
|
|
36
|
+
onClick: onEditChart
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
38
|
+
className: "sdocfont sdoc-rename icon-font"
|
|
39
|
+
}), isShowTooltip && /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
40
|
+
target: "sdoc_chart_edit",
|
|
41
|
+
placement: "top",
|
|
42
|
+
fade: true
|
|
43
|
+
}, t('Edit_chart')))), /*#__PURE__*/_react.default.createElement("span", {
|
|
44
|
+
className: "op-group-item"
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
46
|
+
id: "sdoc_chart_full_screen_mode",
|
|
47
|
+
role: "button",
|
|
48
|
+
className: "op-item",
|
|
49
|
+
onClick: onFullscreen
|
|
50
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
51
|
+
className: "sdocfont sdoc-fullscreen icon-font"
|
|
52
|
+
}), isShowTooltip && /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
53
|
+
target: "sdoc_chart_full_screen_mode",
|
|
54
|
+
placement: "top",
|
|
55
|
+
fade: true
|
|
56
|
+
}, t('Full_screen_mode')))))));
|
|
57
|
+
};
|
|
58
|
+
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(ChartHoverMenu);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _constants = require("../../constants");
|
|
9
|
+
var _menu = _interopRequireDefault(require("./menu"));
|
|
10
|
+
var _plugin = _interopRequireDefault(require("./plugin"));
|
|
11
|
+
var _renderElem = _interopRequireDefault(require("./render-elem"));
|
|
12
|
+
const ChartPlugin = {
|
|
13
|
+
type: _constants.CHART,
|
|
14
|
+
nodeType: 'element',
|
|
15
|
+
editorMenus: [_menu.default],
|
|
16
|
+
editorPlugin: _plugin.default,
|
|
17
|
+
renderElements: [_renderElem.default]
|
|
18
|
+
};
|
|
19
|
+
var _default = exports.default = ChartPlugin;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _helpers = require("../helpers");
|
|
11
|
+
var _constants = require("../../../constants");
|
|
12
|
+
var _dropdownMenuItem = _interopRequireDefault(require("../../../commons/dropdown-menu-item"));
|
|
13
|
+
const ChartMenu = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
editor,
|
|
16
|
+
readonly,
|
|
17
|
+
toggle
|
|
18
|
+
} = _ref;
|
|
19
|
+
const disabled = (0, _helpers.isInsertChartMenuDisabled)(editor, readonly);
|
|
20
|
+
const menuConfig = _constants.MENUS_CONFIG_MAP[_constants.CHART];
|
|
21
|
+
const onInsertChart = (0, _react.useCallback)(() => {
|
|
22
|
+
(0, _helpers.insertChart)(editor);
|
|
23
|
+
toggle && toggle();
|
|
24
|
+
}, [editor, toggle]);
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
26
|
+
disabled: disabled,
|
|
27
|
+
menuConfig: menuConfig,
|
|
28
|
+
onClick: onInsertChart
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var _default = exports.default = ChartMenu;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _constants = require("../../constants");
|
|
8
|
+
const withChart = editor => {
|
|
9
|
+
const {
|
|
10
|
+
isVoid
|
|
11
|
+
} = editor;
|
|
12
|
+
const newEditor = editor;
|
|
13
|
+
|
|
14
|
+
// Rewrite isVoid
|
|
15
|
+
newEditor.isVoid = elem => {
|
|
16
|
+
const {
|
|
17
|
+
type
|
|
18
|
+
} = elem;
|
|
19
|
+
if (type === _constants.CHART) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return isVoid(elem);
|
|
23
|
+
};
|
|
24
|
+
return newEditor;
|
|
25
|
+
};
|
|
26
|
+
var _default = exports.default = withChart;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.sdoc-chart-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 300px;
|
|
4
|
+
padding: 8px;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.sdoc-chart-container .sdoc-chart-view {
|
|
9
|
+
position: relative;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
padding: 10px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.sdoc-chart-container .sdoc-chart-view.init {
|
|
16
|
+
background-color: #f5f5f5;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.sdoc-chart-container .sdoc-chart-view .sdoc-chart-view-content {
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.sdoc-chart-container .active {
|
|
25
|
+
box-shadow: 0 0 0 2px #007bff;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.sdoc-chart-container .active .sdoc-chart-view-rect {
|
|
29
|
+
display: inline-block;
|
|
30
|
+
width: 8px;
|
|
31
|
+
height: 8px;
|
|
32
|
+
background-color: #007bff;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.sdoc-chart-container .active .sdoc-chart-view-rect-lt {
|
|
36
|
+
position: absolute;
|
|
37
|
+
left: -5px;
|
|
38
|
+
top: -5px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.sdoc-chart-container .active .sdoc-chart-view-rect-lb {
|
|
42
|
+
position: absolute;
|
|
43
|
+
left: -5px;
|
|
44
|
+
bottom: -5px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.sdoc-chart-container .active .sdoc-chart-view-rect-rt {
|
|
48
|
+
position: absolute;
|
|
49
|
+
right: -5px;
|
|
50
|
+
top: -5px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.sdoc-chart-container .active .sdoc-chart-view-rect-rb {
|
|
54
|
+
position: absolute;
|
|
55
|
+
right: -5px;
|
|
56
|
+
bottom: -5px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.sdoc-chart-container .sdoc-chart-view .sdoc-chart-tip {
|
|
60
|
+
top: 50%;
|
|
61
|
+
left: 50%;
|
|
62
|
+
transform: translate(-50%, -50%);
|
|
63
|
+
position: absolute;
|
|
64
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _slateReact = require("@seafile/slate-react");
|
|
11
|
+
var _slate = require("@seafile/slate");
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
var _seaChart = require("sea-chart");
|
|
14
|
+
var _reactI18next = require("react-i18next");
|
|
15
|
+
var _hoverMenu = _interopRequireDefault(require("./hover-menu/"));
|
|
16
|
+
var _chartEditDialog = _interopRequireDefault(require("./chart-edit-dialog"));
|
|
17
|
+
var _context = _interopRequireDefault(require("../../../../context"));
|
|
18
|
+
var _useScrollContext = require("../../../hooks/use-scroll-context");
|
|
19
|
+
var _helpers = require("./helpers");
|
|
20
|
+
require("./render-elem.css");
|
|
21
|
+
const Chart = _ref => {
|
|
22
|
+
var _window, _window$app, _window2, _window2$app, _window2$app$state;
|
|
23
|
+
let {
|
|
24
|
+
element,
|
|
25
|
+
editor,
|
|
26
|
+
attributes,
|
|
27
|
+
children,
|
|
28
|
+
isSelected,
|
|
29
|
+
t
|
|
30
|
+
} = _ref;
|
|
31
|
+
const {
|
|
32
|
+
stat_item
|
|
33
|
+
} = element;
|
|
34
|
+
const api = {
|
|
35
|
+
queryUsers: (_window = window) !== null && _window !== void 0 && (_window$app = _window.app) !== null && _window$app !== void 0 && _window$app.queryUsers ? window.app.queryUsers : () => {},
|
|
36
|
+
sqlQuery: editor.sqlQuery
|
|
37
|
+
};
|
|
38
|
+
const scrollRef = (0, _useScrollContext.useScrollContext)();
|
|
39
|
+
const readOnly = (0, _slateReact.useReadOnly)();
|
|
40
|
+
const chartRef = (0, _react.useRef)(null);
|
|
41
|
+
const [menuPosition, setMenuPosition] = (0, _react.useState)({});
|
|
42
|
+
const [isShowHoverMenu, setIsShowHoverMenu] = (0, _react.useState)(false);
|
|
43
|
+
const [isShowDialog, setIsShowDialog] = (0, _react.useState)(false);
|
|
44
|
+
const [isFullScreen, setIsFullScreen] = (0, _react.useState)(false);
|
|
45
|
+
const [isRender, setIsRender] = (0, _react.useState)(false);
|
|
46
|
+
const setPosition = (0, _react.useCallback)(() => {
|
|
47
|
+
if (chartRef.current) {
|
|
48
|
+
const {
|
|
49
|
+
top,
|
|
50
|
+
left
|
|
51
|
+
} = chartRef.current.getBoundingClientRect();
|
|
52
|
+
setMenuPosition({
|
|
53
|
+
top: top - 42,
|
|
54
|
+
left: left - 3
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}, []);
|
|
58
|
+
const onScroll = (0, _react.useCallback)(e => {
|
|
59
|
+
setPosition();
|
|
60
|
+
// Unrendered chart scrolls into viewport for the first time
|
|
61
|
+
if (!isRender && (0, _helpers.isInViewPort)(chartRef.current)) {
|
|
62
|
+
setIsRender(true);
|
|
63
|
+
}
|
|
64
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
|
+
}, [isRender]);
|
|
66
|
+
const onClickChart = (0, _react.useCallback)(() => {
|
|
67
|
+
const path = _slateReact.ReactEditor.findPath(editor, element);
|
|
68
|
+
_slate.Transforms.select(editor, [path[0]]);
|
|
69
|
+
setPosition();
|
|
70
|
+
setIsShowHoverMenu(true);
|
|
71
|
+
}, [editor, element, setPosition]);
|
|
72
|
+
const onCloseEditDialog = (0, _react.useCallback)(newStatItemData => {
|
|
73
|
+
const path = _slateReact.ReactEditor.findPath(editor, element);
|
|
74
|
+
_slate.Transforms.setNodes(editor, {
|
|
75
|
+
stat_item: newStatItemData
|
|
76
|
+
}, {
|
|
77
|
+
at: [path[0]]
|
|
78
|
+
});
|
|
79
|
+
setIsShowDialog(false);
|
|
80
|
+
}, [editor, element]);
|
|
81
|
+
|
|
82
|
+
// Mount
|
|
83
|
+
(0, _react.useEffect)(() => {
|
|
84
|
+
if (!isRender && (0, _helpers.isInViewPort)(chartRef.current)) {
|
|
85
|
+
setIsRender(true);
|
|
86
|
+
}
|
|
87
|
+
let observerRefValue = null;
|
|
88
|
+
if (scrollRef.current) {
|
|
89
|
+
scrollRef.current.addEventListener('scroll', onScroll);
|
|
90
|
+
observerRefValue = scrollRef.current;
|
|
91
|
+
}
|
|
92
|
+
return () => {
|
|
93
|
+
observerRefValue.removeEventListener('scroll', onScroll);
|
|
94
|
+
};
|
|
95
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
96
|
+
}, [isRender]);
|
|
97
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", Object.assign({
|
|
98
|
+
id: element.id,
|
|
99
|
+
className: "sdoc-chart-container"
|
|
100
|
+
}, attributes, {
|
|
101
|
+
onClick: onClickChart
|
|
102
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
103
|
+
className: (0, _classnames.default)('sdoc-chart-view', {
|
|
104
|
+
'active': isSelected
|
|
105
|
+
}, {
|
|
106
|
+
'init': !isRender
|
|
107
|
+
}),
|
|
108
|
+
ref: chartRef
|
|
109
|
+
}, children, /*#__PURE__*/_react.default.createElement("div", {
|
|
110
|
+
className: "sdoc-chart-view-content",
|
|
111
|
+
contentEditable: false
|
|
112
|
+
}, isRender && /*#__PURE__*/_react.default.createElement(_seaChart.View, {
|
|
113
|
+
chart: stat_item,
|
|
114
|
+
api: api,
|
|
115
|
+
config: _context.default.getSettings(),
|
|
116
|
+
tables: editor.tables,
|
|
117
|
+
collaborators: editor.collaborators || [],
|
|
118
|
+
departments: ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$app = _window2.app) === null || _window2$app === void 0 ? void 0 : (_window2$app$state = _window2$app.state) === null || _window2$app$state === void 0 ? void 0 : _window2$app$state.departments) || []
|
|
119
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
120
|
+
className: "sdoc-chart-view-rect sdoc-chart-view-rect-lt"
|
|
121
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
122
|
+
className: "sdoc-chart-view-rect sdoc-chart-view-rect-lb"
|
|
123
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
124
|
+
className: "sdoc-chart-view-rect sdoc-chart-view-rect-rt"
|
|
125
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
126
|
+
className: "sdoc-chart-view-rect sdoc-chart-view-rect-rb"
|
|
127
|
+
}))), isSelected && isShowHoverMenu && !readOnly && /*#__PURE__*/_react.default.createElement(_hoverMenu.default, {
|
|
128
|
+
menuPosition: menuPosition,
|
|
129
|
+
onEditChart: () => {
|
|
130
|
+
setIsFullScreen(false);
|
|
131
|
+
setIsShowDialog(true);
|
|
132
|
+
},
|
|
133
|
+
onFullscreen: () => {
|
|
134
|
+
setIsFullScreen(true);
|
|
135
|
+
setIsShowDialog(true);
|
|
136
|
+
}
|
|
137
|
+
}), isShowDialog && /*#__PURE__*/_react.default.createElement(_chartEditDialog.default, {
|
|
138
|
+
editor: editor,
|
|
139
|
+
element: element,
|
|
140
|
+
api: api,
|
|
141
|
+
isFullScreen: isFullScreen,
|
|
142
|
+
onCloseEditDialog: onCloseEditDialog
|
|
143
|
+
}));
|
|
144
|
+
};
|
|
145
|
+
const SdocChart = (0, _reactI18next.withTranslation)('sdoc-editor')(Chart);
|
|
146
|
+
function renderChart(props, editor) {
|
|
147
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
148
|
+
const isSelected = (0, _slateReact.useSelected)();
|
|
149
|
+
return /*#__PURE__*/_react.default.createElement(SdocChart, Object.assign({}, props, {
|
|
150
|
+
editor: editor,
|
|
151
|
+
isSelected: isSelected
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
var _default = exports.default = renderChart;
|
|
@@ -16,6 +16,12 @@ Object.defineProperty(exports, "CalloutPlugin", {
|
|
|
16
16
|
return _callout.default;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
+
Object.defineProperty(exports, "ChartPlugin", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _chart.default;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
19
25
|
Object.defineProperty(exports, "CheckListPlugin", {
|
|
20
26
|
enumerable: true,
|
|
21
27
|
get: function () {
|
|
@@ -195,7 +201,8 @@ var _seatableColumn = _interopRequireDefault(require("./seatable-column"));
|
|
|
195
201
|
var _seatableRow = _interopRequireDefault(require("./seatable-row"));
|
|
196
202
|
var _seatableTables = _interopRequireDefault(require("./seatable-tables"));
|
|
197
203
|
var _group = _interopRequireDefault(require("./group"));
|
|
198
|
-
|
|
204
|
+
var _chart = _interopRequireDefault(require("./chart"));
|
|
205
|
+
const Plugins = [_markdown.default, _html.default, _header.default, _link.default, _blockquote.default, _list.default, _checkList.default, _codeBlock.default, _image.default, _video.default, _table.default, _multiColumn.default, _textStyle.default, _textAlign.default, _font.default, _sdocLink.default, _paragraph.default, _fileLink.default, _callout.default, _searchReplace.default, _quickInsert.default, _group.default, _chart.default];
|
|
199
206
|
const WikiPlugins = exports.WikiPlugins = [...Plugins, _wikiLink.default];
|
|
200
207
|
const CommentPlugins = exports.CommentPlugins = [_markdown.default, _html.default, _paragraph.default, _textStyle.default, _list.default, _image.default, _link.default, _mention.default, _blockquote.default];
|
|
201
208
|
var _default = exports.default = Plugins;
|
|
@@ -220,6 +220,11 @@ const CustomRenderElement = props => {
|
|
|
220
220
|
const [renderGroup] = _plugins.GroupPlugin.renderElements;
|
|
221
221
|
return renderGroup(props);
|
|
222
222
|
}
|
|
223
|
+
case _constants.CHART:
|
|
224
|
+
{
|
|
225
|
+
const [renderChart] = _plugins.ChartPlugin.renderElements;
|
|
226
|
+
return renderChart(props, editor);
|
|
227
|
+
}
|
|
223
228
|
default:
|
|
224
229
|
{
|
|
225
230
|
const [renderParagraph] = _plugins.ParagraphPlugin.renderElements;
|
|
@@ -20,6 +20,7 @@ var _menu6 = _interopRequireDefault(require("../../../plugins/file-link/menu"));
|
|
|
20
20
|
var _menu7 = _interopRequireDefault(require("../../../plugins/seatable-column/menu"));
|
|
21
21
|
var _menu8 = _interopRequireDefault(require("../../../plugins/seatable-row/menu"));
|
|
22
22
|
var _menu9 = _interopRequireDefault(require("../../../plugins/seatable-tables/menu"));
|
|
23
|
+
var _menu10 = _interopRequireDefault(require("../../../plugins/chart/menu"));
|
|
23
24
|
var _eventBus = _interopRequireDefault(require("../../../../utils/event-bus"));
|
|
24
25
|
var _constants = require("../../../../constants");
|
|
25
26
|
require("./index.css");
|
|
@@ -100,7 +101,7 @@ const InsertToolbar = _ref => {
|
|
|
100
101
|
style: {
|
|
101
102
|
maxHeight: window.innerHeight - bottom - 100
|
|
102
103
|
}
|
|
103
|
-
}, /*#__PURE__*/_react.default.createElement(_menu.default, props), /*#__PURE__*/_react.default.createElement(_tableMenu.default, props), (editor === null || editor === void 0 ? void 0 : editor.editorType) !== _constants.DOCUMENT_PLUGIN_EDITOR && /*#__PURE__*/_react.default.createElement(_menu2.default, props), /*#__PURE__*/_react.default.createElement(_menu3.default, props), /*#__PURE__*/_react.default.createElement(_menu4.default, props), /*#__PURE__*/_react.default.createElement("div", {
|
|
104
|
+
}, /*#__PURE__*/_react.default.createElement(_menu.default, props), /*#__PURE__*/_react.default.createElement(_tableMenu.default, props), (editor === null || editor === void 0 ? void 0 : editor.editorType) !== _constants.DOCUMENT_PLUGIN_EDITOR && /*#__PURE__*/_react.default.createElement(_menu2.default, props), /*#__PURE__*/_react.default.createElement(_menu3.default, props), (editor === null || editor === void 0 ? void 0 : editor.editorType) === _constants.DOCUMENT_PLUGIN_EDITOR && /*#__PURE__*/_react.default.createElement(_menu10.default, props), /*#__PURE__*/_react.default.createElement(_menu4.default, props), /*#__PURE__*/_react.default.createElement("div", {
|
|
104
105
|
className: "sdoc-dropdown-menu-divider"
|
|
105
106
|
}), editor.tables && /*#__PURE__*/_react.default.createElement(_menu8.default, props), editor.columns && /*#__PURE__*/_react.default.createElement(_menu7.default, props), editor.tables && /*#__PURE__*/_react.default.createElement(_menu9.default, props), !editor.tables && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_menu5.default, props), /*#__PURE__*/_react.default.createElement(_menu6.default, props)))));
|
|
106
107
|
};
|
|
@@ -357,7 +357,7 @@ const getSearchedOperations = (sourceMenuSearchMap, isNodeEmpty, event, t, edito
|
|
|
357
357
|
const targetStr = event.target.value.trim().toUpperCase();
|
|
358
358
|
if (sourceStr.includes(targetStr)) {
|
|
359
359
|
// Only the documentation plugin has this operation
|
|
360
|
-
if ([_constants.SEATABLE_COLUMN, _constants.SEATABLE_TABLE].includes(key) && editor.editorType !== _constants3.DOCUMENT_PLUGIN_EDITOR) {
|
|
360
|
+
if ([_constants.SEATABLE_COLUMN, _constants.SEATABLE_TABLE, _constants.CHART].includes(key) && editor.editorType !== _constants3.DOCUMENT_PLUGIN_EDITOR) {
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
363
|
menuSearchMap[key] = value;
|
|
@@ -14,8 +14,9 @@ var _helpers = require("./helpers");
|
|
|
14
14
|
var _helpers2 = require("../../plugins/table/helpers");
|
|
15
15
|
var _tableSizePopover = _interopRequireDefault(require("../../plugins/table/popover/table-size-popover"));
|
|
16
16
|
var _helpers3 = require("../../plugins/code-block/helpers");
|
|
17
|
+
var _helpers4 = require("../../plugins/chart/helpers");
|
|
17
18
|
var _transforms = require("../../plugins/list/transforms");
|
|
18
|
-
var
|
|
19
|
+
var _helpers5 = require("../../plugins/check-list/helpers");
|
|
19
20
|
var _constants = require("../../constants");
|
|
20
21
|
var _eventBus = _interopRequireDefault(require("../../../utils/event-bus"));
|
|
21
22
|
var _constants2 = require("../../../constants");
|
|
@@ -76,6 +77,11 @@ const InsertBlockMenu = _ref => {
|
|
|
76
77
|
|
|
77
78
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
78
79
|
}, [insertPosition]);
|
|
80
|
+
const onInsertChart = (0, _react.useCallback)(() => {
|
|
81
|
+
const newInsertPosition = slateNode.type === _constants.ELEMENT_TYPE.LIST_ITEM ? _constants.INSERT_POSITION.AFTER : insertPosition;
|
|
82
|
+
(0, _helpers4.insertChart)(editor, newInsertPosition);
|
|
83
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
84
|
+
}, [editor, insertPosition, slateNode]);
|
|
79
85
|
const onInsertCodeBlock = (0, _react.useCallback)(() => {
|
|
80
86
|
const newInsertPosition = slateNode.type === _constants.ELEMENT_TYPE.LIST_ITEM ? _constants.INSERT_POSITION.AFTER : insertPosition;
|
|
81
87
|
(0, _helpers3.changeToCodeBlock)(editor, 'plaintext', newInsertPosition);
|
|
@@ -87,7 +93,7 @@ const InsertBlockMenu = _ref => {
|
|
|
87
93
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
88
94
|
}, [editor, insertPosition, slateNode]);
|
|
89
95
|
const onInsertCheckList = (0, _react.useCallback)(() => {
|
|
90
|
-
(0,
|
|
96
|
+
(0, _helpers5.setCheckListItemType)(editor, _constants.ELEMENT_TYPE.CHECK_LIST_ITEM, insertPosition);
|
|
91
97
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
92
98
|
}, [editor, insertPosition, slateNode]);
|
|
93
99
|
const onInsert = (0, _react.useCallback)(type => {
|
|
@@ -171,6 +177,12 @@ const InsertBlockMenu = _ref => {
|
|
|
171
177
|
..._constants.SIDE_INSERT_MENUS_CONFIG[_constants.ELEMENT_TYPE.LINK]
|
|
172
178
|
},
|
|
173
179
|
onClick: openLinkDialog
|
|
180
|
+
}), editor.editorType === _constants2.DOCUMENT_PLUGIN_EDITOR && /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
181
|
+
isHidden: !insertMenuSearchMap[_constants.ELEMENT_TYPE.CHART],
|
|
182
|
+
menuConfig: {
|
|
183
|
+
..._constants.SIDE_INSERT_MENUS_CONFIG[_constants.ELEMENT_TYPE.CHART]
|
|
184
|
+
},
|
|
185
|
+
onClick: onInsertChart
|
|
174
186
|
}), /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
175
187
|
isHidden: !insertMenuSearchMap[_constants.ELEMENT_TYPE.CODE_BLOCK],
|
|
176
188
|
menuConfig: {
|
|
@@ -34,6 +34,7 @@ const DocumentPluginEditor = _ref => {
|
|
|
34
34
|
collaborators,
|
|
35
35
|
formulaRows,
|
|
36
36
|
getTableFormulaResults,
|
|
37
|
+
sqlQuery,
|
|
37
38
|
getArticleStyle
|
|
38
39
|
} = _ref;
|
|
39
40
|
_context.default.initApi();
|
|
@@ -67,6 +68,7 @@ const DocumentPluginEditor = _ref => {
|
|
|
67
68
|
newEditor.collaborators = collaborators;
|
|
68
69
|
newEditor.formulaRows = formulaRows;
|
|
69
70
|
newEditor.getTableFormulaResults = getTableFormulaResults;
|
|
71
|
+
newEditor.sqlQuery = sqlQuery;
|
|
70
72
|
newEditor.cursors = cursors || {};
|
|
71
73
|
newEditor.width = _constants.PAGE_EDIT_AREA_WIDTH; // default width
|
|
72
74
|
newEditor.editorType = _constants.DOCUMENT_PLUGIN_EDITOR;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.27",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This is a sdoc editor",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"copy-to-clipboard": "^3.3.3",
|
|
17
17
|
"dayjs": "1.10.7",
|
|
18
18
|
"deep-copy": "1.4.2",
|
|
19
|
-
"dtable-ui-component": "
|
|
19
|
+
"dtable-ui-component": "~6.0.5",
|
|
20
20
|
"is-hotkey": "0.2.0",
|
|
21
21
|
"is-url": "^1.2.4",
|
|
22
22
|
"lodash.isequal": "4.5.0",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"remark-parse": "11.0.0",
|
|
39
39
|
"remark-rehype": "11.0.0",
|
|
40
40
|
"remark-stringify": "11.0.0",
|
|
41
|
+
"sea-chart": "~2.0.3",
|
|
41
42
|
"slugid": "3.2.0",
|
|
42
43
|
"socket.io-client": "4.8.1",
|
|
43
44
|
"type-of": "2.0.1",
|
|
@@ -619,5 +619,8 @@
|
|
|
619
619
|
"Selected_row_records_cannot_exceed_10_rows": "Selected row records cannot exceed 10 rows",
|
|
620
620
|
"Select_seatable_rows": "Select seatable rows",
|
|
621
621
|
"Add_rows_record": "Add rows record",
|
|
622
|
-
"Double_click_then_adjust_field_width": "Double click, then adjust field width"
|
|
622
|
+
"Double_click_then_adjust_field_width": "Double click, then adjust field width",
|
|
623
|
+
"Insert_chart": "Insert chart",
|
|
624
|
+
"Edit_chart": "Edit chart",
|
|
625
|
+
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first"
|
|
623
626
|
}
|
|
@@ -619,5 +619,8 @@
|
|
|
619
619
|
"Selected_row_records_cannot_exceed_10_rows": "Sie können höchstens zehn Einträge in einer Zeile auswählen",
|
|
620
620
|
"Select_seatable_rows": "Seatable-Zeilen auswählen",
|
|
621
621
|
"Add_rows_record": "Zeileneintrag hinzufügen",
|
|
622
|
-
"Double_click_then_adjust_field_width": "Klicken Sie doppelt, dann passen Sie die Breite des Felds an"
|
|
622
|
+
"Double_click_then_adjust_field_width": "Klicken Sie doppelt, dann passen Sie die Breite des Felds an",
|
|
623
|
+
"Insert_chart": "Insert chart",
|
|
624
|
+
"Edit_chart": "Edit chart",
|
|
625
|
+
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first"
|
|
623
626
|
}
|
|
@@ -622,5 +622,9 @@
|
|
|
622
622
|
"Double_click_then_adjust_field_width": "Double click, then adjust field width",
|
|
623
623
|
"SeaTable_row": "SeaTable row",
|
|
624
624
|
"Please_select_one_row_record": "Please select one row record",
|
|
625
|
-
"No_linked_records": "No linked records"
|
|
625
|
+
"No_linked_records": "No linked records",
|
|
626
|
+
"Insert_chart": "Insert chart",
|
|
627
|
+
"Edit_chart": "Edit chart",
|
|
628
|
+
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first",
|
|
629
|
+
"chart": "chart"
|
|
626
630
|
}
|
|
@@ -619,5 +619,8 @@
|
|
|
619
619
|
"Selected_row_records_cannot_exceed_10_rows": "Selected row records cannot exceed 10 rows",
|
|
620
620
|
"Select_seatable_rows": "Select seatable rows",
|
|
621
621
|
"Add_rows_record": "Add rows record",
|
|
622
|
-
"Double_click_then_adjust_field_width": "Double click, then adjust field width"
|
|
622
|
+
"Double_click_then_adjust_field_width": "Double click, then adjust field width",
|
|
623
|
+
"Insert_chart": "Insert chart",
|
|
624
|
+
"Edit_chart": "Edit chart",
|
|
625
|
+
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first"
|
|
623
626
|
}
|
|
@@ -619,5 +619,8 @@
|
|
|
619
619
|
"Selected_row_records_cannot_exceed_10_rows": "Selected row records cannot exceed 10 rows",
|
|
620
620
|
"Select_seatable_rows": "Select seatable rows",
|
|
621
621
|
"Add_rows_record": "Add rows record",
|
|
622
|
-
"Double_click_then_adjust_field_width": "Double click, then adjust field width"
|
|
622
|
+
"Double_click_then_adjust_field_width": "Double click, then adjust field width",
|
|
623
|
+
"Insert_chart": "Insert chart",
|
|
624
|
+
"Edit_chart": "Edit chart",
|
|
625
|
+
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first"
|
|
623
626
|
}
|
|
@@ -619,5 +619,8 @@
|
|
|
619
619
|
"Selected_row_records_cannot_exceed_10_rows": "Selected row records cannot exceed 10 rows",
|
|
620
620
|
"Select_seatable_rows": "Select seatable rows",
|
|
621
621
|
"Add_rows_record": "Add rows record",
|
|
622
|
-
"Double_click_then_adjust_field_width": "Double click, then adjust field width"
|
|
622
|
+
"Double_click_then_adjust_field_width": "Double click, then adjust field width",
|
|
623
|
+
"Insert_chart": "Insert chart",
|
|
624
|
+
"Edit_chart": "Edit chart",
|
|
625
|
+
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first"
|
|
623
626
|
}
|
|
@@ -619,5 +619,8 @@
|
|
|
619
619
|
"Selected_row_records_cannot_exceed_10_rows": "Selected row records cannot exceed 10 rows",
|
|
620
620
|
"Select_seatable_rows": "Select seatable rows",
|
|
621
621
|
"Add_rows_record": "Add rows record",
|
|
622
|
-
"Double_click_then_adjust_field_width": "Double click, then adjust field width"
|
|
622
|
+
"Double_click_then_adjust_field_width": "Double click, then adjust field width",
|
|
623
|
+
"Insert_chart": "Insert chart",
|
|
624
|
+
"Edit_chart": "Edit chart",
|
|
625
|
+
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first"
|
|
623
626
|
}
|
|
@@ -619,5 +619,8 @@
|
|
|
619
619
|
"Selected_row_records_cannot_exceed_10_rows": "Selected row records cannot exceed 10 rows",
|
|
620
620
|
"Select_seatable_rows": "Select seatable rows",
|
|
621
621
|
"Add_rows_record": "Add rows record",
|
|
622
|
-
"Double_click_then_adjust_field_width": "Double click, then adjust field width"
|
|
622
|
+
"Double_click_then_adjust_field_width": "Double click, then adjust field width",
|
|
623
|
+
"Insert_chart": "Insert chart",
|
|
624
|
+
"Edit_chart": "Edit chart",
|
|
625
|
+
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first"
|
|
623
626
|
}
|
|
@@ -619,5 +619,8 @@
|
|
|
619
619
|
"Selected_row_records_cannot_exceed_10_rows": "Выбранные записи строк не могут превышать 10 строк",
|
|
620
620
|
"Select_seatable_rows": "Выберите доступные для размещения строки",
|
|
621
621
|
"Add_rows_record": "Добавить записи строк",
|
|
622
|
-
"Double_click_then_adjust_field_width": "Дважды щелкните, затем отрегулируйте ширину поля"
|
|
622
|
+
"Double_click_then_adjust_field_width": "Дважды щелкните, затем отрегулируйте ширину поля",
|
|
623
|
+
"Insert_chart": "Insert chart",
|
|
624
|
+
"Edit_chart": "Edit chart",
|
|
625
|
+
"Please_complete_the_chart_configuration_first": "Please complete the chart configuration first"
|
|
623
626
|
}
|
|
@@ -619,5 +619,8 @@
|
|
|
619
619
|
"Selected_row_records_cannot_exceed_10_rows": "选择的行记录不能超过10条",
|
|
620
620
|
"Select_seatable_rows": "选择 Seatable 行",
|
|
621
621
|
"Add_rows_record": "添加行记录",
|
|
622
|
-
"Double_click_then_adjust_field_width": "双击后调节字段宽度"
|
|
622
|
+
"Double_click_then_adjust_field_width": "双击后调节字段宽度",
|
|
623
|
+
"Insert_chart": "插入图表",
|
|
624
|
+
"Edit_chart": "编辑图表",
|
|
625
|
+
"Please_complete_the_chart_configuration_first": "请先完成图表配置"
|
|
623
626
|
}
|