@seafile/sdoc-editor 1.0.198-test1.0 → 1.0.198-test1.2

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.
@@ -1,5 +1,5 @@
1
1
  .sdoc-whiteboard-container {
2
2
  width: 670px;
3
- height: auto;
3
+ height: 300px;
4
4
  border: 1px solid #ccc;
5
5
  }
@@ -10,7 +10,11 @@ var _react = _interopRequireWildcard(require("react"));
10
10
  var _eventBus = _interopRequireDefault(require("../../../utils/event-bus"));
11
11
  var _constants = require("../../../../constants");
12
12
  require("./index.css");
13
- const Whiteboard = (editor, element) => {
13
+ const Whiteboard = _ref => {
14
+ let {
15
+ editor,
16
+ element
17
+ } = _ref;
14
18
  const {
15
19
  children,
16
20
  filePath,
@@ -18,29 +22,24 @@ const Whiteboard = (editor, element) => {
18
22
  title
19
23
  } = element;
20
24
  const whiteboardRef = (0, _react.useRef)();
21
- const [TldrawComponent, setTldrawComponent] = (0, _react.useState)(null);
22
25
  console.log(33, repoID, filePath);
23
- const renderWhiteboardEditor = Tldraw => {
24
- console.log(4, Tldraw, repoID, filePath);
25
- if (Tldraw) {
26
- setTldrawComponent(() => Tldraw);
27
- }
28
- };
26
+ const containerId = `whiteboard-${title}-draw`;
29
27
  (0, _react.useEffect)(() => {
30
28
  const eventBus = _eventBus.default.getInstance();
31
- const unsubscribeWhiteboardEditor = eventBus.subscribe(_constants.EXTERNAL_EVENT.TLDRAW_EDITOR, renderWhiteboardEditor);
32
- console.log(3, renderWhiteboardEditor);
33
- return () => {
34
- unsubscribeWhiteboardEditor();
35
- };
36
- }, []);
29
+ eventBus.dispatch(_constants.EXTERNAL_EVENT.TLDRAW_EDITOR, {
30
+ containerId,
31
+ props: {
32
+ filePath,
33
+ repoID
34
+ }
35
+ });
36
+ console.log('dispatch', containerId);
37
+ }, [filePath, repoID]);
37
38
  return /*#__PURE__*/_react.default.createElement("div", {
38
- id: "sdoc-whiteboard-container",
39
+ id: containerId,
40
+ className: "sdoc-whiteboard-container",
39
41
  ref: whiteboardRef
40
- }, TldrawComponent && /*#__PURE__*/_react.default.createElement(TldrawComponent, {
41
- repoID: repoID,
42
- filePath: filePath
43
- }));
42
+ });
44
43
  };
45
44
  function renderWhiteboard(props, editor) {
46
45
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.198-test1.0",
3
+ "version": "1.0.198-test1.2",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",