@seafile/sdoc-editor 1.0.198-test1.1 → 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
  }
@@ -22,29 +22,24 @@ const Whiteboard = _ref => {
22
22
  title
23
23
  } = element;
24
24
  const whiteboardRef = (0, _react.useRef)();
25
- const [TldrawComponent, setTldrawComponent] = (0, _react.useState)(null);
26
25
  console.log(33, repoID, filePath);
27
- const renderWhiteboardEditor = Tldraw => {
28
- console.log(4, Tldraw, repoID, filePath);
29
- if (Tldraw) {
30
- setTldrawComponent(() => Tldraw);
31
- }
32
- };
26
+ const containerId = `whiteboard-${title}-draw`;
33
27
  (0, _react.useEffect)(() => {
34
28
  const eventBus = _eventBus.default.getInstance();
35
- const unsubscribeWhiteboardEditor = eventBus.subscribe(_constants.EXTERNAL_EVENT.TLDRAW_EDITOR, renderWhiteboardEditor);
36
- console.log(3, renderWhiteboardEditor);
37
- return () => {
38
- unsubscribeWhiteboardEditor();
39
- };
40
- }, []);
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]);
41
38
  return /*#__PURE__*/_react.default.createElement("div", {
39
+ id: containerId,
42
40
  className: "sdoc-whiteboard-container",
43
41
  ref: whiteboardRef
44
- }, TldrawComponent && /*#__PURE__*/_react.default.createElement(TldrawComponent, {
45
- repoID: repoID,
46
- filePath: filePath
47
- }));
42
+ });
48
43
  };
49
44
  function renderWhiteboard(props, editor) {
50
45
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.198-test1.1",
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",