@seafile/sdoc-editor 2.0.143 → 2.0.145
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/comment/components/global-comment/index.js +1 -0
- package/dist/comment/reducer/comment-reducer.js +1 -1
- package/dist/extension/plugins/ai/ai-module/helpers.js +22 -4
- package/dist/extension/plugins/ai/ai-module/style.css +4 -0
- package/dist/extension/plugins/quick-insert/render-elem.js +1 -1
- package/dist/extension/toolbar/insert-element-toolbar/index.js +4 -3
- package/dist/extension/toolbar/side-toolbar/side-menu.js +1 -1
- package/dist/socket/with-socket-io.js +2 -1
- package/package.json +2 -2
|
@@ -83,6 +83,7 @@ var GlobalComment = function GlobalComment(_ref) {
|
|
|
83
83
|
var updateScrollPosition = (0, _react.useCallback)(function () {
|
|
84
84
|
var _contentRef$current3;
|
|
85
85
|
var resolvedDom = document.querySelector('.sdoc-resolved');
|
|
86
|
+
if (!resolvedDom) return;
|
|
86
87
|
(_contentRef$current3 = contentRef.current) === null || _contentRef$current3 === void 0 ? void 0 : _contentRef$current3.scrollTo({
|
|
87
88
|
top: resolvedDom.offsetTop,
|
|
88
89
|
behavior: 'smooth'
|
|
@@ -203,7 +203,7 @@ var commentReducer = exports.commentReducer = function commentReducer(state, act
|
|
|
203
203
|
});
|
|
204
204
|
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), {}, {
|
|
205
205
|
element_comments_map: (0, _objectSpread2["default"])({}, _element_comments_map3),
|
|
206
|
-
comment_list:
|
|
206
|
+
comment_list: _commentList4
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
case 'INSERT_REPLY':
|
|
@@ -245,15 +245,33 @@ var insertHtmlTransferredNodes = exports.insertHtmlTransferredNodes = function i
|
|
|
245
245
|
// Insert paragraph nodes
|
|
246
246
|
if (childNode.type === _constants.PARAGRAPH) {
|
|
247
247
|
if (childNode.children.length > 1) {
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
// Temporary array: Merge links and adjacent content
|
|
249
|
+
var currentParagraphChildren = [];
|
|
250
|
+
childNode.children.forEach(function (textNode) {
|
|
251
|
+
var _textNode$text;
|
|
252
|
+
if (textNode.type !== 'link' && !(textNode !== null && textNode !== void 0 && (_textNode$text = textNode.text) !== null && _textNode$text !== void 0 && _textNode$text.trim())) {
|
|
253
|
+
if (currentParagraphChildren.length > 0) {
|
|
254
|
+
var p = (0, _core.generateEmptyElement)(_constants.PARAGRAPH);
|
|
255
|
+
p.children = [].concat(currentParagraphChildren);
|
|
256
|
+
_slate.Transforms.insertNodes(editor, p, {
|
|
257
|
+
at: nextPath
|
|
258
|
+
});
|
|
259
|
+
nextPath = _slate.Path.next(nextPath);
|
|
260
|
+
currentParagraphChildren.length = 0;
|
|
261
|
+
}
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
currentParagraphChildren.push(textNode);
|
|
265
|
+
});
|
|
266
|
+
// Process the remaining nodes after traversal is completed
|
|
267
|
+
if (currentParagraphChildren.length > 0) {
|
|
250
268
|
var p = (0, _core.generateEmptyElement)(_constants.PARAGRAPH);
|
|
251
|
-
p.children
|
|
269
|
+
p.children = currentParagraphChildren;
|
|
252
270
|
_slate.Transforms.insertNodes(editor, p, {
|
|
253
271
|
at: nextPath
|
|
254
272
|
});
|
|
255
273
|
nextPath = _slate.Path.next(nextPath);
|
|
256
|
-
}
|
|
274
|
+
}
|
|
257
275
|
} else {
|
|
258
276
|
_slate.Transforms.insertNodes(editor, childNode, {
|
|
259
277
|
at: nextPath
|
|
@@ -32,7 +32,7 @@ var RenderQuickInsert = function RenderQuickInsert(_ref, editor, readonly) {
|
|
|
32
32
|
var scrollRef = (0, _useScrollContext.useScrollContext)();
|
|
33
33
|
var insertElmRef = (0, _react.useRef)(null);
|
|
34
34
|
var aboveBlockNode = (0, _core.getAboveBlockNode)(editor);
|
|
35
|
-
var isEmptyNode = _slate.Editor.isEmpty(editor, aboveBlockNode === null || aboveBlockNode === void 0 ? void 0 : aboveBlockNode[0]);
|
|
35
|
+
var isEmptyNode = aboveBlockNode && _slate.Editor.isEmpty(editor, aboveBlockNode === null || aboveBlockNode === void 0 ? void 0 : aboveBlockNode[0]);
|
|
36
36
|
var _useState3 = (0, _react.useState)((0, _helper.isSelectionSameWithInsert)(editor, element)),
|
|
37
37
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
38
38
|
isShowPopover = _useState4[0],
|
|
@@ -37,12 +37,13 @@ var QuickInsertBlockMenu = function QuickInsertBlockMenu(_ref) {
|
|
|
37
37
|
slateNode = _ref.slateNode,
|
|
38
38
|
callback = _ref.callback,
|
|
39
39
|
isEmptyNode = _ref.isEmptyNode,
|
|
40
|
-
handleClosePopover = _ref.handleClosePopover
|
|
41
|
-
t = _ref.t;
|
|
40
|
+
handleClosePopover = _ref.handleClosePopover;
|
|
42
41
|
var editor = (0, _slateReact.useSlateStatic)();
|
|
43
42
|
var tableSizeRef = (0, _react.useRef)(null);
|
|
44
43
|
var inputWrapperRef = (0, _react.useRef)(null);
|
|
45
44
|
var downDownWrapperRef = (0, _react.useRef)(null);
|
|
45
|
+
var _useTranslation = (0, _reactI18next.useTranslation)('sdoc-editor'),
|
|
46
|
+
t = _useTranslation.t;
|
|
46
47
|
var _useState = (0, _react.useState)(-1),
|
|
47
48
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
48
49
|
currentSelectIndex = _useState2[0],
|
|
@@ -433,7 +434,7 @@ var QuickInsertBlockMenu = function QuickInsertBlockMenu(_ref) {
|
|
|
433
434
|
className: "sdoc-side-menu-search-wrapper"
|
|
434
435
|
}, /*#__PURE__*/_react["default"].createElement(_reactstrap.Input, {
|
|
435
436
|
innerRef: inputWrapperRef,
|
|
436
|
-
placeholder: t('
|
|
437
|
+
placeholder: t('Search_1'),
|
|
437
438
|
onChange: onChange,
|
|
438
439
|
onCompositionStart: onCompositionStart,
|
|
439
440
|
onCompositionEnd: onCompositionEnd
|
|
@@ -164,7 +164,7 @@ var SideMenu = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
164
164
|
className: "sdoc-side-menu-search-wrapper"
|
|
165
165
|
}, /*#__PURE__*/_react["default"].createElement(_reactstrap.Input, {
|
|
166
166
|
autoFocus: true,
|
|
167
|
-
placeholder: t('
|
|
167
|
+
placeholder: t('Search_1'),
|
|
168
168
|
onChange: onChange,
|
|
169
169
|
onCompositionStart: onCompositionStart,
|
|
170
170
|
onCompositionEnd: onCompositionEnd
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
|
+
var _deepCopy = _interopRequireDefault(require("deep-copy"));
|
|
8
9
|
var _helper = require("../cursor/helper");
|
|
9
10
|
var _eventBus = _interopRequireDefault(require("../utils/event-bus"));
|
|
10
11
|
var _socketManager2 = _interopRequireDefault(require("./socket-manager"));
|
|
@@ -35,7 +36,7 @@ var withSocketIO = function withSocketIO(editor, options) {
|
|
|
35
36
|
if (JSON.stringify(operations) === JSON.stringify(lastOperations)) {
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
|
-
lastOperations = operations;
|
|
39
|
+
lastOperations = (0, _deepCopy["default"])(operations);
|
|
39
40
|
if (!newEditor.isRemote && operations.length > 0) {
|
|
40
41
|
var isAllSetSelection = operations.every(function (operation) {
|
|
41
42
|
return operation.type === 'set_selection';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.145",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"publishConfig": {
|
|
72
72
|
"access": "public"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "4282c45e1f08d62085784c803721b16afb2fb65f"
|
|
75
75
|
}
|