@seafile/sdoc-editor 2.0.126-test-0.0.6 → 2.0.126-test-0.0.7
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/constants/index.js
CHANGED
|
@@ -76,7 +76,7 @@ var INTERNAL_EVENT = exports.INTERNAL_EVENT = {
|
|
|
76
76
|
CREATE_WIKI_PAGE: 'create_wiki_page',
|
|
77
77
|
IMAGE_COLUMN_TOGGLE: 'Image_column_toggle',
|
|
78
78
|
CREATE_WHITEBOARD_FILE: 'create_whiteboard_file',
|
|
79
|
-
|
|
79
|
+
GENERATE_EXDRAW_READ_ONLY_LINK: 'generate_exdraw_read_only_link'
|
|
80
80
|
};
|
|
81
81
|
var PAGE_EDIT_AREA_WIDTH = exports.PAGE_EDIT_AREA_WIDTH = 672; // 672 = 794 - 2[borderLeft + borderRight] - 120[paddingLeft + paddingRight]
|
|
82
82
|
var COMMENT_EDITOR_EDIT_AREA_WIDTH = exports.COMMENT_EDITOR_EDIT_AREA_WIDTH = 364;
|
|
@@ -48,12 +48,14 @@ var isInsertWhiteboardMenuDisabled = exports.isInsertWhiteboardMenuDisabled = fu
|
|
|
48
48
|
var generateWhiteboardNode = exports.generateWhiteboardNode = function generateWhiteboardNode(repoID) {
|
|
49
49
|
var filename = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
50
50
|
var filePath = arguments.length > 2 ? arguments[2] : undefined;
|
|
51
|
+
var exdrawReadOnlyLink = arguments.length > 3 ? arguments[3] : undefined;
|
|
51
52
|
var whiteboardNode = {
|
|
52
53
|
id: _slugid["default"].nice(),
|
|
53
54
|
type: _constants2.WHITEBOARD,
|
|
54
55
|
repoID: repoID,
|
|
55
56
|
title: filename,
|
|
56
57
|
filePath: filePath,
|
|
58
|
+
link: exdrawReadOnlyLink,
|
|
57
59
|
children: [{
|
|
58
60
|
id: _slugid["default"].nice(),
|
|
59
61
|
text: ''
|
|
@@ -66,7 +68,19 @@ var insertWhiteboard = exports.insertWhiteboard = function insertWhiteboard(edit
|
|
|
66
68
|
if (isInsertWhiteboardMenuDisabled(editor)) return;
|
|
67
69
|
if (editor.selection == null) return;
|
|
68
70
|
var repoID = _context["default"].getSetting('repoID');
|
|
69
|
-
|
|
71
|
+
// const whiteboardNode = generateWhiteboardNode(repoID, filename, filePath);
|
|
72
|
+
console.log(44, repoID, filePath);
|
|
73
|
+
var exdrawReadOnlyLink;
|
|
74
|
+
var eventBus = _eventBus["default"].getInstance();
|
|
75
|
+
eventBus.dispatch(_constants.INTERNAL_EVENT.GENERATE_EXDRAW_READ_ONLY_LINK, {
|
|
76
|
+
repoID: repoID,
|
|
77
|
+
filePath: filePath,
|
|
78
|
+
onSuccess: function onSuccess(link) {
|
|
79
|
+
exdrawReadOnlyLink = link;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
console.log(44, repoID, filePath, exdrawReadOnlyLink);
|
|
83
|
+
var whiteboardNode = generateWhiteboardNode(repoID, filename, filePath, exdrawReadOnlyLink);
|
|
70
84
|
var path = (_editor$selection = editor.selection) === null || _editor$selection === void 0 ? void 0 : _editor$selection.anchor.path;
|
|
71
85
|
var position = 'after';
|
|
72
86
|
if (position === _constants2.INSERT_POSITION.AFTER) {
|
|
@@ -18,12 +18,14 @@ var Whiteboard = function Whiteboard(_ref) {
|
|
|
18
18
|
element = _ref.element;
|
|
19
19
|
var filePath = element.filePath,
|
|
20
20
|
repoID = element.repoID,
|
|
21
|
-
title = element.title
|
|
21
|
+
title = element.title,
|
|
22
|
+
link = element.link;
|
|
22
23
|
var whiteboardRef = (0, _react.useRef)();
|
|
23
24
|
var isSelected = (0, _slateReact.useSelected)();
|
|
24
25
|
var containerId = "whiteboard-".concat(title);
|
|
26
|
+
|
|
25
27
|
// Set default whiteboard readonly as true
|
|
26
|
-
|
|
28
|
+
// const readOnly = true;
|
|
27
29
|
var handleDoubleClick = function handleDoubleClick(event) {
|
|
28
30
|
event.preventDefault();
|
|
29
31
|
var siteRoot = _context["default"].getSetting('siteRoot');
|
|
@@ -31,17 +33,12 @@ var Whiteboard = function Whiteboard(_ref) {
|
|
|
31
33
|
window.open(url, '_blank');
|
|
32
34
|
return;
|
|
33
35
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
repoID: repoID,
|
|
41
|
-
readOnly: readOnly
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}, [filePath, repoID, readOnly, containerId]);
|
|
36
|
+
|
|
37
|
+
// useEffect(() => {
|
|
38
|
+
// const eventBus = EventBus.getInstance();
|
|
39
|
+
// eventBus.dispatch(INTERNAL_EVENT.TLDRAW_EDITOR, { containerId, props: { filePath, repoID, readOnly } });
|
|
40
|
+
// }, [filePath, repoID, readOnly, containerId]);
|
|
41
|
+
|
|
45
42
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
46
43
|
className: (0, _classnames["default"])('sdoc-whiteboard-container', {
|
|
47
44
|
'isSelected': isSelected
|
|
@@ -54,6 +51,20 @@ var Whiteboard = function Whiteboard(_ref) {
|
|
|
54
51
|
}, title), /*#__PURE__*/_react["default"].createElement("div", {
|
|
55
52
|
id: containerId,
|
|
56
53
|
className: "sdoc-whiteboard-wrapper"
|
|
54
|
+
}), /*#__PURE__*/_react["default"].createElement("iframe", {
|
|
55
|
+
className: "sdoc-whiteboard-element",
|
|
56
|
+
title: title
|
|
57
|
+
// allow='accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture'
|
|
58
|
+
,
|
|
59
|
+
allowFullScreen: true,
|
|
60
|
+
src: link
|
|
61
|
+
// onLoad={handleVideoLoad}
|
|
62
|
+
,
|
|
63
|
+
style: {
|
|
64
|
+
width: '100%',
|
|
65
|
+
height: '100%',
|
|
66
|
+
border: 'none'
|
|
67
|
+
}
|
|
57
68
|
}));
|
|
58
69
|
};
|
|
59
70
|
function renderWhiteboard(props, editor) {
|