@seafile/sdoc-editor 1.0.199 → 1.0.201
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/plugins/blockquote/plugin.js +3 -1
- package/dist/basic-sdk/extension/plugins/seatable-tables/helpers.js +2 -2
- package/dist/basic-sdk/extension/plugins/seatable-tables/op-menu/index.js +34 -12
- package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/seatable-table.js +48 -5
- package/dist/basic-sdk/extension/toolbar/side-toolbar/index.js +1 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/side-menu.js +7 -7
- package/package.json +1 -1
|
@@ -80,7 +80,9 @@ const withBlockquote = editor => {
|
|
|
80
80
|
const [, currentLinePath] = currentLineEntry;
|
|
81
81
|
const currentLineIndex = currentLinePath[blockQuotePath.length];
|
|
82
82
|
// Transforms to paragraph when Select at the beginning of the first line
|
|
83
|
-
if (currentLineIndex === 0) {
|
|
83
|
+
if (currentLineIndex === 0 && (0, _core.isSelectionAtBlockStart)(editor, {
|
|
84
|
+
at: currentLinePath
|
|
85
|
+
})) {
|
|
84
86
|
_slate.Transforms.liftNodes(editor, {
|
|
85
87
|
at: currentLinePath
|
|
86
88
|
});
|
|
@@ -80,9 +80,9 @@ const insertSeaTableTable = function (editor, item) {
|
|
|
80
80
|
_slate.Transforms.setNodes(editor, node);
|
|
81
81
|
};
|
|
82
82
|
exports.insertSeaTableTable = insertSeaTableTable;
|
|
83
|
-
const updateSeaTableTable = (editor, props) => {
|
|
83
|
+
const updateSeaTableTable = (editor, props, options) => {
|
|
84
84
|
_slate.Transforms.setNodes(editor, {
|
|
85
85
|
...props
|
|
86
|
-
});
|
|
86
|
+
}, options);
|
|
87
87
|
};
|
|
88
88
|
exports.updateSeaTableTable = updateSeaTableTable;
|
|
@@ -107,14 +107,32 @@ function OpMenu(_ref3) {
|
|
|
107
107
|
const [isShowHideColumn, setIsShowHideColumn] = (0, _react.useState)(false);
|
|
108
108
|
const [isShowSeaTableSetting, setIsShowSeaTableSetting] = (0, _react.useState)(false);
|
|
109
109
|
const onCloseOther = (0, _react.useCallback)(closeList => {
|
|
110
|
+
const {
|
|
111
|
+
filterData,
|
|
112
|
+
sortsData
|
|
113
|
+
} = seaTableRef.current;
|
|
110
114
|
closeList.forEach(item => {
|
|
111
115
|
item === 'tableList' && setIsShowTablesList(false);
|
|
112
|
-
item === 'tableFilter'
|
|
113
|
-
|
|
116
|
+
if (item === 'tableFilter') {
|
|
117
|
+
if (filterData && Object.keys(filterData).length > 0) {
|
|
118
|
+
(0, _helpers.updateSeaTableTable)(editor, filterData);
|
|
119
|
+
seaTableRef.current['filterData'] = {};
|
|
120
|
+
}
|
|
121
|
+
setTimeout(() => {
|
|
122
|
+
setIsShowFilter(false);
|
|
123
|
+
}, 1000);
|
|
124
|
+
}
|
|
125
|
+
if (item === 'tableSort') {
|
|
126
|
+
if (sortsData && Object.keys(sortsData).length > 0) {
|
|
127
|
+
(0, _helpers.updateSeaTableTable)(editor, sortsData);
|
|
128
|
+
seaTableRef.current['sortsData'] = {};
|
|
129
|
+
}
|
|
130
|
+
setIsShowSort(false);
|
|
131
|
+
}
|
|
114
132
|
item === 'tableColumnHidden' && setIsShowHideColumn(false);
|
|
115
133
|
item === 'tableSetting' && setIsShowSeaTableSetting(false);
|
|
116
134
|
});
|
|
117
|
-
}, []);
|
|
135
|
+
}, [editor, seaTableRef]);
|
|
118
136
|
const onClickOutside = (0, _react.useCallback)(e => {
|
|
119
137
|
if (seaTableRef !== null && seaTableRef !== void 0 && seaTableRef.current.contains(e.target)) {
|
|
120
138
|
onCloseOther(['tableList', 'tableFilter', 'tableSort', 'tableColumnHidden', 'tableSetting']);
|
|
@@ -190,21 +208,25 @@ function OpMenu(_ref3) {
|
|
|
190
208
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
191
209
|
}, [isShowFilter]);
|
|
192
210
|
const onFiltersChange = (0, _react.useCallback)((filters, filter_conjunction) => {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
211
|
+
if (seaTableRef.current) {
|
|
212
|
+
seaTableRef.current['filterData'] = {
|
|
213
|
+
filters,
|
|
214
|
+
filter_conjunction
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
}, [seaTableRef]);
|
|
198
218
|
const onSort = (0, _react.useCallback)(() => {
|
|
199
219
|
setIsShowSort(!isShowSort);
|
|
200
220
|
onCloseOther(['tableList', 'tableFilter', 'tableColumnHidden', 'tableSetting']);
|
|
201
221
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
202
222
|
}, [isShowSort]);
|
|
203
223
|
const onSortsChange = (0, _react.useCallback)(sorts => {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
224
|
+
if (seaTableRef.current) {
|
|
225
|
+
seaTableRef.current['sortsData'] = {
|
|
226
|
+
sorts
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}, [seaTableRef]);
|
|
208
230
|
const onHiddenColumn = (0, _react.useCallback)(() => {
|
|
209
231
|
setIsShowHideColumn(!isShowHideColumn);
|
|
210
232
|
onCloseOther(['tableList', 'tableSort', 'tableFilter', 'tableSetting']);
|
|
@@ -18,6 +18,7 @@ var _recordList = _interopRequireDefault(require("./record-list"));
|
|
|
18
18
|
var _opMenu = _interopRequireDefault(require("../op-menu"));
|
|
19
19
|
var _useScrollContext = require("../../../../hooks/use-scroll-context");
|
|
20
20
|
var _helpers = require("../../seatable-column/helpers");
|
|
21
|
+
var _helpers2 = require("../helpers");
|
|
21
22
|
require("./index.css");
|
|
22
23
|
function SeaTableTable(_ref) {
|
|
23
24
|
var _tableInfoRef$current, _tableInfoRef$current2;
|
|
@@ -218,13 +219,54 @@ function SeaTableTable(_ref) {
|
|
|
218
219
|
observerRefValue.removeEventListener('scroll', handleScroll);
|
|
219
220
|
};
|
|
220
221
|
}, [handleScroll, readOnly, scrollRef]);
|
|
222
|
+
const handleSaveData = (0, _react.useCallback)(() => {
|
|
223
|
+
const {
|
|
224
|
+
filterData,
|
|
225
|
+
sortsData
|
|
226
|
+
} = seaTableRef.current;
|
|
227
|
+
if (filterData && Object.keys(filterData).length > 0) {
|
|
228
|
+
const path = _slateReact.ReactEditor.findPath(editor, element);
|
|
229
|
+
(0, _helpers2.updateSeaTableTable)(editor, filterData, {
|
|
230
|
+
at: {
|
|
231
|
+
anchor: {
|
|
232
|
+
offset: 0,
|
|
233
|
+
path
|
|
234
|
+
},
|
|
235
|
+
focus: {
|
|
236
|
+
offset: 0,
|
|
237
|
+
path
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
seaTableRef.current['filterData'] = {};
|
|
242
|
+
}
|
|
243
|
+
if (sortsData && Object.keys(sortsData).length > 0) {
|
|
244
|
+
const path = _slateReact.ReactEditor.findPath(editor, element);
|
|
245
|
+
(0, _helpers2.updateSeaTableTable)(editor, sortsData, {
|
|
246
|
+
at: {
|
|
247
|
+
anchor: {
|
|
248
|
+
offset: 0,
|
|
249
|
+
path
|
|
250
|
+
},
|
|
251
|
+
focus: {
|
|
252
|
+
offset: 0,
|
|
253
|
+
path
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
seaTableRef.current['sortsData'] = {};
|
|
258
|
+
}
|
|
259
|
+
}, [editor, element]);
|
|
221
260
|
(0, _react.useEffect)(() => {
|
|
222
261
|
if (!isSelected) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
262
|
+
handleSaveData();
|
|
263
|
+
queueMicrotask(() => {
|
|
264
|
+
setIsShowMenu(false);
|
|
265
|
+
setIsShowColumnWidth(false);
|
|
266
|
+
setIsCanModifyColumnWidth(false);
|
|
267
|
+
});
|
|
226
268
|
}
|
|
227
|
-
}, [isSelected]);
|
|
269
|
+
}, [editor, element, handleSaveData, isSelected]);
|
|
228
270
|
const onTableClick = (0, _react.useCallback)(event => {
|
|
229
271
|
if (readOnly) return;
|
|
230
272
|
const {
|
|
@@ -254,7 +296,8 @@ function SeaTableTable(_ref) {
|
|
|
254
296
|
});
|
|
255
297
|
return /*#__PURE__*/_react.default.createElement("div", Object.assign({}, attributes, {
|
|
256
298
|
className: "seatable-table-wrapper",
|
|
257
|
-
contentEditable: true
|
|
299
|
+
contentEditable: true,
|
|
300
|
+
suppressContentEditableWarning: true
|
|
258
301
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
259
302
|
ref: seaTableRef,
|
|
260
303
|
className: containerClass,
|
|
@@ -34,7 +34,7 @@ const SideToolbar = () => {
|
|
|
34
34
|
const [menuPosition, setMenuPosition] = (0, _react.useState)({});
|
|
35
35
|
const [isEnterMoreVertical, setIsEnterMoreVertical] = (0, _react.useState)(false);
|
|
36
36
|
const [isMoving, setIsMoving] = (0, _react.useState)(false);
|
|
37
|
-
const sideMenuRef = (0, _react.useRef)();
|
|
37
|
+
const sideMenuRef = (0, _react.useRef)(null);
|
|
38
38
|
const draggedSourcePaths = (0, _react.useRef)(null);
|
|
39
39
|
const selectedNodesRef = (0, _react.useRef)(null);
|
|
40
40
|
const showSelectedNodesRef = (0, _react.useRef)(null);
|
|
@@ -23,14 +23,16 @@ var _toast = _interopRequireDefault(require("../../../../components/toast"));
|
|
|
23
23
|
var _constants = require("../../constants");
|
|
24
24
|
var _aiMenu = require("../../plugins/ai/ai-menu");
|
|
25
25
|
require("./side-menu.css");
|
|
26
|
-
const SideMenu = (_ref, ref) => {
|
|
26
|
+
const SideMenu = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
27
27
|
let {
|
|
28
28
|
slateNode,
|
|
29
29
|
isNodeEmpty,
|
|
30
30
|
menuPosition,
|
|
31
|
-
onReset
|
|
32
|
-
t
|
|
31
|
+
onReset
|
|
33
32
|
} = _ref;
|
|
33
|
+
const {
|
|
34
|
+
t
|
|
35
|
+
} = (0, _reactI18next.useTranslation)('sdoc-editor');
|
|
34
36
|
const sideMenuRef = (0, _react.useRef)(null);
|
|
35
37
|
const [menuStyle, setMenuStyle] = (0, _react.useState)('');
|
|
36
38
|
const [insertMenuSearchMap, setInsertMenuSearchMap] = (0, _react.useState)();
|
|
@@ -245,7 +247,5 @@ const SideMenu = (_ref, ref) => {
|
|
|
245
247
|
}).length === 1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
246
248
|
className: "sdoc-dropdown-menu-item-no-results"
|
|
247
249
|
}, t('No_results')))));
|
|
248
|
-
};
|
|
249
|
-
var _default = exports.default =
|
|
250
|
-
withRef: true
|
|
251
|
-
})( /*#__PURE__*/(0, _react.forwardRef)(SideMenu));
|
|
250
|
+
});
|
|
251
|
+
var _default = exports.default = SideMenu;
|