@seafile/sdoc-editor 1.0.198-test1.1 → 1.0.198-test1.3

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,22 @@
1
1
  .sdoc-whiteboard-container {
2
+ position: relative;
2
3
  width: 670px;
3
- height: auto;
4
+ height: 300px;
4
5
  border: 1px solid #ccc;
5
- }
6
+ }
7
+
8
+ .sodoc-whiteboard-title {
9
+ font-size: 14px;
10
+ color: #333;
11
+ text-align: center;
12
+ margin: 5px;
13
+ width: 670px;
14
+ position: absolute;
15
+ top: 0;
16
+ left: 0%;
17
+ }
18
+
19
+ .sdoc-whiteboard-container .tldraw-editor-container {
20
+ position: absolute !important;
21
+ }
22
+
@@ -22,28 +22,33 @@ 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
- }
26
+ const containerId = `whiteboard-${title}`;
27
+ // Set default whiteboard readonly as true
28
+ const readOnly = true;
29
+ const handleDoubleClick = () => {
30
+ console.log(3434);
32
31
  };
33
32
  (0, _react.useEffect)(() => {
34
33
  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
- }, []);
34
+ eventBus.dispatch(_constants.EXTERNAL_EVENT.TLDRAW_EDITOR, {
35
+ containerId,
36
+ props: {
37
+ filePath,
38
+ repoID,
39
+ readOnly
40
+ }
41
+ });
42
+ }, [filePath, repoID]);
41
43
  return /*#__PURE__*/_react.default.createElement("div", {
42
44
  className: "sdoc-whiteboard-container",
43
- ref: whiteboardRef
44
- }, TldrawComponent && /*#__PURE__*/_react.default.createElement(TldrawComponent, {
45
- repoID: repoID,
46
- filePath: filePath
45
+ ref: whiteboardRef,
46
+ onDoubleClick: handleDoubleClick
47
+ }, /*#__PURE__*/_react.default.createElement("div", {
48
+ className: "sodoc-whiteboard-title"
49
+ }, title), /*#__PURE__*/_react.default.createElement("div", {
50
+ id: containerId,
51
+ className: "sdoc-whiteboard-wrapper"
47
52
  }));
48
53
  };
49
54
  function renderWhiteboard(props, editor) {
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.3",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",