@seafile/sdoc-editor 2.0.195 → 2.0.197
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.
|
@@ -184,6 +184,9 @@ var SdocEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
184
184
|
window.document.exitFullscreen();
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
+
if ((0, _isHotkey["default"])('mod+s', e)) {
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
}
|
|
187
190
|
};
|
|
188
191
|
var onFullscreenChange = function onFullscreenChange() {
|
|
189
192
|
if (!window.document.fullscreenElement) {
|
|
@@ -12,6 +12,7 @@ var _slate = require("@seafile/slate");
|
|
|
12
12
|
var _slugid = _interopRequireDefault(require("slugid"));
|
|
13
13
|
var _constants = require("../../constants");
|
|
14
14
|
var _core = require("../../core");
|
|
15
|
+
var _helper = require("../paragraph/helper");
|
|
15
16
|
var isMenuDisabled = exports.isMenuDisabled = function isMenuDisabled(editor, readonly) {
|
|
16
17
|
if (readonly) return true;
|
|
17
18
|
if (editor.selection == null) return true;
|
|
@@ -143,7 +144,7 @@ var getFormattedElements = exports.getFormattedElements = function getFormattedE
|
|
|
143
144
|
var getFormattedRestElements = exports.getFormattedRestElements = function getFormattedRestElements(data) {
|
|
144
145
|
var restElements = data.slice(0);
|
|
145
146
|
data.forEach(function (item, index) {
|
|
146
|
-
if (
|
|
147
|
+
if ((0, _helper.isEmptyNode)(item)) {
|
|
147
148
|
restElements.splice(index, 1);
|
|
148
149
|
}
|
|
149
150
|
|
|
@@ -29,6 +29,7 @@ var Whiteboard = function Whiteboard(_ref) {
|
|
|
29
29
|
title = element.title,
|
|
30
30
|
link = element.link;
|
|
31
31
|
var whiteboardRef = (0, _react.useRef)();
|
|
32
|
+
var fullscreenRef = (0, _react.useRef)();
|
|
32
33
|
var scrollRef = (0, _useScrollContext.useScrollContext)();
|
|
33
34
|
var isSelected = (0, _slateReact.useSelected)();
|
|
34
35
|
var readOnly = (0, _slateReact.useReadOnly)();
|
|
@@ -47,20 +48,36 @@ var Whiteboard = function Whiteboard(_ref) {
|
|
|
47
48
|
var handleMessage = function handleMessage(event) {
|
|
48
49
|
var _event$data;
|
|
49
50
|
if (((_event$data = event.data) === null || _event$data === void 0 ? void 0 : _event$data.type) === 'checkSdocParent') {
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
var _whiteboardRef$curren, _fullscreenRef$curren;
|
|
52
|
+
var isSdocClass = (_whiteboardRef$curren = whiteboardRef.current) === null || _whiteboardRef$curren === void 0 ? void 0 : _whiteboardRef$curren.classList.contains('sdoc-whiteboard-element');
|
|
53
|
+
var isWhiteboardFullScreen = fullscreenRef === null || fullscreenRef === void 0 ? void 0 : (_fullscreenRef$curren = fullscreenRef.current) === null || _fullscreenRef$curren === void 0 ? void 0 : _fullscreenRef$curren.classList.contains('sdoc-whiteboard-element-full-screen');
|
|
54
|
+
if (whiteboardRef !== null && whiteboardRef !== void 0 && whiteboardRef.current) {
|
|
55
|
+
whiteboardRef === null || whiteboardRef === void 0 ? void 0 : whiteboardRef.current.contentWindow.postMessage({
|
|
56
|
+
type: 'checkSdocParentResult',
|
|
57
|
+
isInSdoc: isSdocClass
|
|
58
|
+
}, '*');
|
|
59
|
+
}
|
|
60
|
+
if (fullscreenRef !== null && fullscreenRef !== void 0 && fullscreenRef.current) {
|
|
61
|
+
fullscreenRef === null || fullscreenRef === void 0 ? void 0 : fullscreenRef.current.contentWindow.postMessage({
|
|
62
|
+
type: 'checkSdocParentResult',
|
|
63
|
+
isFullScreen: isWhiteboardFullScreen
|
|
64
|
+
}, '*');
|
|
65
|
+
}
|
|
57
66
|
}
|
|
58
67
|
};
|
|
59
68
|
var handleWindowResize = function handleWindowResize() {
|
|
60
|
-
whiteboardRef
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
if (whiteboardRef !== null && whiteboardRef !== void 0 && whiteboardRef.current) {
|
|
70
|
+
whiteboardRef === null || whiteboardRef === void 0 ? void 0 : whiteboardRef.current.contentWindow.postMessage({
|
|
71
|
+
type: 'resizeWindowWidth',
|
|
72
|
+
isResize: true
|
|
73
|
+
}, '*');
|
|
74
|
+
}
|
|
75
|
+
if (fullscreenRef !== null && fullscreenRef !== void 0 && fullscreenRef.current) {
|
|
76
|
+
fullscreenRef === null || fullscreenRef === void 0 ? void 0 : fullscreenRef.current.contentWindow.postMessage({
|
|
77
|
+
type: 'resizeWindowWidth',
|
|
78
|
+
isResize: true
|
|
79
|
+
}, '*');
|
|
80
|
+
}
|
|
64
81
|
};
|
|
65
82
|
var eventBus = _eventBus["default"].getInstance();
|
|
66
83
|
var unsubscribeResizeArticle = eventBus.subscribe(_constants.INTERNAL_EVENT.RESIZE_ARTICLE, handleWindowResize);
|
|
@@ -87,10 +104,10 @@ var Whiteboard = function Whiteboard(_ref) {
|
|
|
87
104
|
};
|
|
88
105
|
var handleScroll = (0, _react.useCallback)(function (e) {
|
|
89
106
|
if (readOnly) return;
|
|
90
|
-
if (!isSelected) return;
|
|
107
|
+
if (!isSelected && !isShowZoomOut) return;
|
|
91
108
|
var menuPosition = (0, _utils.getMenuPosition)(whiteboardRef.current, editor);
|
|
92
109
|
setMenuPosition(menuPosition);
|
|
93
|
-
}, [editor, isSelected, readOnly]);
|
|
110
|
+
}, [editor, isSelected, readOnly, isShowZoomOut]);
|
|
94
111
|
(0, _react.useEffect)(function () {
|
|
95
112
|
if (readOnly) return;
|
|
96
113
|
var observerRefValue = null;
|
|
@@ -175,9 +192,10 @@ var Whiteboard = function Whiteboard(_ref) {
|
|
|
175
192
|
return setIsShowZoomOut(false);
|
|
176
193
|
}
|
|
177
194
|
}, /*#__PURE__*/_react["default"].createElement("iframe", {
|
|
195
|
+
title: title,
|
|
178
196
|
className: "sdoc-whiteboard-element-full-screen",
|
|
179
197
|
src: link,
|
|
180
|
-
ref:
|
|
198
|
+
ref: fullscreenRef
|
|
181
199
|
})), document.body)));
|
|
182
200
|
};
|
|
183
201
|
function renderWhiteboard(props, 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.197",
|
|
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": "9050c69c34e1696fbea68aa7b13dd255743cd24f"
|
|
75
75
|
}
|