@seafile/sdoc-editor 2.0.126-test-0.0.1 → 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.
@@ -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
- TLDRAW_EDITOR: 'tldraw_editor'
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
- var whiteboardNode = generateWhiteboardNode(repoID, filename, filePath);
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,31 +18,27 @@ 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
- var readOnly = true;
28
+ // const readOnly = true;
27
29
  var handleDoubleClick = function handleDoubleClick(event) {
28
30
  event.preventDefault();
29
- // const siteRoot = window.app.config.siteRoot;
30
31
  var siteRoot = _context["default"].getSetting('siteRoot');
31
32
  var url = "".concat(siteRoot, "lib/").concat(repoID, "/file").concat(filePath);
32
33
  window.open(url, '_blank');
33
34
  return;
34
35
  };
35
- (0, _react.useEffect)(function () {
36
- var eventBus = _eventBus["default"].getInstance();
37
- eventBus.dispatch(_constants.INTERNAL_EVENT.TLDRAW_EDITOR, {
38
- containerId: containerId,
39
- props: {
40
- filePath: filePath,
41
- repoID: repoID,
42
- readOnly: readOnly
43
- }
44
- });
45
- }, [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
+
46
42
  return /*#__PURE__*/_react["default"].createElement("div", {
47
43
  className: (0, _classnames["default"])('sdoc-whiteboard-container', {
48
44
  'isSelected': isSelected
@@ -55,6 +51,20 @@ var Whiteboard = function Whiteboard(_ref) {
55
51
  }, title), /*#__PURE__*/_react["default"].createElement("div", {
56
52
  id: containerId,
57
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
+ }
58
68
  }));
59
69
  };
60
70
  function renderWhiteboard(props, editor) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "2.0.126-test-0.0.1",
3
+ "version": "2.0.126-test-0.0.7",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "jest",