@seafile/sdoc-editor 3.0.47 → 3.0.48
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.
|
@@ -76,8 +76,9 @@ var SdocEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
76
76
|
// Fix: The editor's children are not updated when the document is updated in revision
|
|
77
77
|
// In revision mode, the document is updated, but the editor's children are not updated,as onValueChange override the new document.elements. This unexpected action cause the editor to display the old content
|
|
78
78
|
(0, _react.useEffect)(function () {
|
|
79
|
+
validEditor.children = document.elements;
|
|
79
80
|
_setSlateValue(document.elements);
|
|
80
|
-
}, [document.elements]);
|
|
81
|
+
}, [document.elements, validEditor]);
|
|
81
82
|
(0, _react.useEffect)(function () {
|
|
82
83
|
validEditor.readonly = false;
|
|
83
84
|
return function () {
|
|
@@ -62,8 +62,9 @@ var WikiEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
62
62
|
// Fix: The editor's children are not updated when the document is updated in revision
|
|
63
63
|
// In revision mode, the document is updated, but the editor's children are not updated,as onValueChange override the new document.elements. This unexpected action cause the editor to display the old content
|
|
64
64
|
(0, _react.useEffect)(function () {
|
|
65
|
+
validEditor.children = document.elements;
|
|
65
66
|
_setSlateValue(document.elements);
|
|
66
|
-
}, [document.elements]);
|
|
67
|
+
}, [document.elements, validEditor]);
|
|
67
68
|
(0, _react.useEffect)(function () {
|
|
68
69
|
validEditor.readonly = false;
|
|
69
70
|
return function () {
|
|
@@ -29,6 +29,26 @@ var withVideo = function withVideo(editor) {
|
|
|
29
29
|
_ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
30
30
|
videoNode = _ref2[0],
|
|
31
31
|
path = _ref2[1];
|
|
32
|
+
if ((0, _isHotkey["default"])(['left', 'right'], event)) {
|
|
33
|
+
var selection = editor.selection;
|
|
34
|
+
if (!_slate.Range.isCollapsed(selection)) return true;
|
|
35
|
+
if ((0, _isHotkey["default"])('right', event)) {
|
|
36
|
+
var _nextEntry$;
|
|
37
|
+
var nextEntry = (0, _core.getNextNode)(editor);
|
|
38
|
+
if (nextEntry && ((_nextEntry$ = nextEntry[0]) === null || _nextEntry$ === void 0 ? void 0 : _nextEntry$.type) === _constants.VIDEO) {
|
|
39
|
+
_slate.Transforms.select(editor, nextEntry[1]);
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if ((0, _isHotkey["default"])('left', event)) {
|
|
44
|
+
var _prevEntry$;
|
|
45
|
+
var prevEntry = (0, _core.getPrevNode)(editor);
|
|
46
|
+
if (prevEntry && ((_prevEntry$ = prevEntry[0]) === null || _prevEntry$ === void 0 ? void 0 : _prevEntry$.type) === _constants.VIDEO) {
|
|
47
|
+
_slate.Transforms.select(editor, prevEntry[1]);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
32
52
|
if (path) {
|
|
33
53
|
// Insert empty paragraph node after video when clicking 'enter' on selected video
|
|
34
54
|
if ((0, _isHotkey["default"])('enter', event)) {
|
|
@@ -74,9 +74,8 @@ var Video = function Video(_ref) {
|
|
|
74
74
|
setIsLoaded(true);
|
|
75
75
|
};
|
|
76
76
|
var onClickVideo = (0, _react.useCallback)(function (e) {
|
|
77
|
+
e.preventDefault();
|
|
77
78
|
e.stopPropagation();
|
|
78
|
-
var path = _slateReact.ReactEditor.findPath(editor, element);
|
|
79
|
-
_slate.Transforms.select(editor, path);
|
|
80
79
|
setIsSelected(true);
|
|
81
80
|
}, [editor, element]);
|
|
82
81
|
var setPosition = (0, _react.useCallback)(function (elem) {
|
|
@@ -239,16 +238,17 @@ var Video = function Video(_ref) {
|
|
|
239
238
|
}))))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
240
239
|
"data-id": element.id,
|
|
241
240
|
className: "sdoc-video-wrapper",
|
|
241
|
+
contentEditable: false,
|
|
242
242
|
style: {
|
|
243
243
|
display: isLoaded ? 'flex' : 'none'
|
|
244
|
-
}
|
|
244
|
+
},
|
|
245
|
+
onClick: onClickVideo
|
|
245
246
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
246
247
|
className: "sdoc-video-inner",
|
|
247
248
|
ref: wrapperRef,
|
|
248
249
|
style: (0, _objectSpread4["default"])({
|
|
249
250
|
visibility: isLoaded ? 'visible' : 'hidden'
|
|
250
|
-
}, getVideoWidthStyle())
|
|
251
|
-
onClick: onClickVideo
|
|
251
|
+
}, getVideoWidthStyle())
|
|
252
252
|
}, !isEmbeddableLink && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("video", {
|
|
253
253
|
className: "sdoc-video-element",
|
|
254
254
|
ref: videoRef,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.48",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"description": "",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@seafile/comment-editor": "1.0.
|
|
20
|
+
"@seafile/comment-editor": "1.0.8",
|
|
21
21
|
"@seafile/print-js": "1.6.6",
|
|
22
|
-
"@seafile/react-image-lightbox": "5.0.
|
|
22
|
+
"@seafile/react-image-lightbox": "5.0.4",
|
|
23
23
|
"@seafile/seafile-database": "0.0.17",
|
|
24
24
|
"@seafile/slate": "0.91.8",
|
|
25
25
|
"@seafile/slate-history": "0.86.2",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "a1510ef659d09923a6c7a1133d153fa1f74e55cb"
|
|
76
76
|
}
|