@seafile/sdoc-editor 0.1.146 → 0.1.148
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/comment/comment/comment-editor.js +4 -4
- package/dist/basic-sdk/extension/plugins/font/helpers.js +1 -1
- package/dist/basic-sdk/extension/plugins/link/hover/index.js +6 -2
- package/dist/basic-sdk/extension/plugins/table/render/render-cell.js +4 -2
- package/dist/basic-sdk/socket/socket-manager.js +9 -2
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ var CommentEditor = function CommentEditor(_ref) {
|
|
|
25
25
|
// onMount
|
|
26
26
|
useEffect(function () {
|
|
27
27
|
if (content) {
|
|
28
|
-
commentRef.current.
|
|
28
|
+
commentRef.current.textContent = content;
|
|
29
29
|
}
|
|
30
30
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
31
|
}, []);
|
|
@@ -39,14 +39,14 @@ var CommentEditor = function CommentEditor(_ref) {
|
|
|
39
39
|
}, [content, insertContent, updateContent]);
|
|
40
40
|
var onSubmit = useCallback(function (event) {
|
|
41
41
|
event && event.stopPropagation();
|
|
42
|
-
var value = commentRef.current.
|
|
42
|
+
var value = commentRef.current.textContent;
|
|
43
43
|
updateValue(value);
|
|
44
|
-
commentRef.current.
|
|
44
|
+
commentRef.current.textContent = '';
|
|
45
45
|
}, [updateValue]);
|
|
46
46
|
var onCancel = useCallback(function (event) {
|
|
47
47
|
event.stopPropagation();
|
|
48
48
|
setIsFocus(false);
|
|
49
|
-
commentRef.current.
|
|
49
|
+
commentRef.current.textContent = '';
|
|
50
50
|
setIsEditing && setIsEditing(false);
|
|
51
51
|
}, [setIsEditing]);
|
|
52
52
|
var onKeyDown = useCallback(function (event) {
|
|
@@ -131,7 +131,7 @@ export var loadFont = function loadFont() {
|
|
|
131
131
|
};
|
|
132
132
|
export var generatorFontFamily = function generatorFontFamily(fontName, fontWeight, leaf) {
|
|
133
133
|
var isCodeBlock = leaf && Object.keys(leaf).includes('token');
|
|
134
|
-
if (isCodeBlock) return
|
|
134
|
+
if (isCodeBlock) return '';
|
|
135
135
|
var lang = context.getSetting('lang') || 'zh-cn';
|
|
136
136
|
if (fontName === DEFAULT_FONT) {
|
|
137
137
|
return "'Arial', ".concat(lang === 'zh-cn' ? "\u5B8B\u4F53" : 'Arial', ", 'sans-serif'");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import '../../../../assets/css/textlink-hovermenu.css';
|
|
@@ -10,10 +10,14 @@ var LinkHover = function LinkHover(_ref) {
|
|
|
10
10
|
onEditLink = _ref.onEditLink;
|
|
11
11
|
var _useTranslation = useTranslation(),
|
|
12
12
|
t = _useTranslation.t;
|
|
13
|
+
var onMouseDown = useCallback(function (event) {
|
|
14
|
+
event.stopPropagation();
|
|
15
|
+
}, []);
|
|
13
16
|
return /*#__PURE__*/React.createElement(React.Fragment, null, createPortal( /*#__PURE__*/React.createElement("div", {
|
|
14
17
|
id: "link-op-menu",
|
|
15
18
|
className: "link-op-menu",
|
|
16
|
-
style: menuPosition
|
|
19
|
+
style: menuPosition,
|
|
20
|
+
onMouseDown: onMouseDown
|
|
17
21
|
}, /*#__PURE__*/React.createElement("a", {
|
|
18
22
|
href: element.href,
|
|
19
23
|
target: "_blank",
|
|
@@ -55,7 +55,8 @@ var TableCell = function TableCell(_ref) {
|
|
|
55
55
|
return /*#__PURE__*/React.createElement("div", Object.assign({}, attributes, {
|
|
56
56
|
style: _objectSpread(_objectSpread(_objectSpread({}, element.style), style), {}, {
|
|
57
57
|
minWidth: columnWidth,
|
|
58
|
-
width: columnWidth
|
|
58
|
+
width: columnWidth,
|
|
59
|
+
maxWidth: columnWidth
|
|
59
60
|
}),
|
|
60
61
|
className: classnames('table-cell', attributes.className, {
|
|
61
62
|
'cell-selected': isSelected,
|
|
@@ -96,7 +97,8 @@ function renderTableCell(props) {
|
|
|
96
97
|
return /*#__PURE__*/React.createElement("div", Object.assign({}, attributes, {
|
|
97
98
|
style: _objectSpread(_objectSpread(_objectSpread({}, element.style), style), {}, {
|
|
98
99
|
minWidth: width,
|
|
99
|
-
width: width
|
|
100
|
+
width: width,
|
|
101
|
+
maxWidth: width
|
|
100
102
|
}),
|
|
101
103
|
className: classnames('table-cell', attributes.className),
|
|
102
104
|
"data-id": element.id
|
|
@@ -5,7 +5,7 @@ var _class;
|
|
|
5
5
|
import EventBus from '../utils/event-bus';
|
|
6
6
|
import { syncRemoteOperations, reExecRevertOperationList, revertOperationList, syncRemoteCursorLocation } from './helpers';
|
|
7
7
|
import SocketClient from './socket-client';
|
|
8
|
-
import { conflictDebug, serverDebug, stateDebug } from '../utils/debug';
|
|
8
|
+
import { clientDebug, conflictDebug, serverDebug, stateDebug } from '../utils/debug';
|
|
9
9
|
import { deleteCursor } from '../cursor/helper';
|
|
10
10
|
|
|
11
11
|
// idle --> sending --> conflict --> idle
|
|
@@ -148,6 +148,12 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
|
|
|
148
148
|
// The version consistency indicates that there is no conflict and no processing is required
|
|
149
149
|
stateDebug("State Changed: ".concat(_this.state, " -> ").concat(STATE.IDLE));
|
|
150
150
|
_this.state = STATE.IDLE;
|
|
151
|
+
if (_this.pendingOperationList.length > 0) {
|
|
152
|
+
clientDebug('After reconnection, manually trigger the execution of ops.');
|
|
153
|
+
stateDebug("State Changed: ".concat(_this.state, " -> ").concat(STATE.SENDING));
|
|
154
|
+
_this.state = STATE.SENDING;
|
|
155
|
+
_this.sendNextOperations();
|
|
156
|
+
}
|
|
151
157
|
};
|
|
152
158
|
this.onConflictHappen = function () {
|
|
153
159
|
stateDebug("State Changed: ".concat(_this.state, " -> ").concat(STATE.CONFLICT));
|
|
@@ -272,11 +278,12 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, doc
|
|
|
272
278
|
_this.editor.onCursor && _this.editor.onCursor(_this.editor.cursors);
|
|
273
279
|
}
|
|
274
280
|
if (type === 'disconnect') {
|
|
281
|
+
// current state is sending
|
|
275
282
|
if (_this._sendingOperations) {
|
|
276
283
|
_this.pendingOperationList.unshift(_this._sendingOperations.slice());
|
|
277
284
|
_this._sendingOperations = null;
|
|
278
285
|
}
|
|
279
|
-
stateDebug("State Changed: ".concat(_this.state, " -> ").concat(STATE.
|
|
286
|
+
stateDebug("State Changed: ".concat(_this.state, " -> ").concat(STATE.DISCONNECT));
|
|
280
287
|
_this.state = STATE.DISCONNECT;
|
|
281
288
|
}
|
|
282
289
|
_this.eventBus.dispatch(type, message);
|