@textbus/xnote 0.0.8 → 0.0.10

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.
@@ -5557,16 +5557,17 @@ function TopBar(props) {
5557
5557
  });
5558
5558
  return () => sub.unsubscribe();
5559
5559
  });
5560
- const instance = getCurrentInstance();
5560
+ // const instance = getCurrentInstance()
5561
5561
  const s = props.component.changeMarker.onChange.subscribe(() => {
5562
- instance.markAsDirtied();
5562
+ const currentLayout = props.component.state.columnsConfig.slice();
5563
+ if (currentLayout.join(',') !== props.layoutWidth().join(',')) {
5564
+ props.layoutWidth.set(currentLayout);
5565
+ }
5566
+ // instance.markAsDirtied()
5563
5567
  });
5564
5568
  onUnmounted(() => {
5565
5569
  s.unsubscribe();
5566
5570
  });
5567
- function refreshLayoutWidth() {
5568
- props.layoutWidth.set(props.component.state.columnsConfig.slice());
5569
- }
5570
5571
  return withScopedCSS(scopedId$4, () => {
5571
5572
  const { state, tableSelection } = props.component;
5572
5573
  const position = tableSelection();
@@ -5585,7 +5586,6 @@ function TopBar(props) {
5585
5586
  transform: 'translateX(-50%)'
5586
5587
  }, visible: !!selectedColumnRange(), children: jsx(ToolbarItem, { children: jsx(Button, { onClick: () => {
5587
5588
  props.component.deleteColumns();
5588
- refreshLayoutWidth();
5589
5589
  }, children: jsx("span", { class: "xnote-icon-bin" }) }) }) }), jsx("table", { style: {
5590
5590
  transform: `translateX(${-leftDistance()}px)`
5591
5591
  }, children: jsx("tbody", { children: jsx("tr", { children: props.layoutWidth().map((i, index) => {
@@ -5597,14 +5597,12 @@ function TopBar(props) {
5597
5597
  left: '-10px'
5598
5598
  }, onClick: () => {
5599
5599
  props.component.insertColumn(0);
5600
- refreshLayoutWidth();
5601
5600
  }, children: jsx("button", { class: "insert-btn", type: "button", children: "+" }) })), jsx("span", { class: "insert-btn-wrap", onMouseenter: () => {
5602
5601
  tableService.onInsertColumnBefore.next(index + 1);
5603
5602
  }, onMouseleave: () => {
5604
5603
  tableService.onInsertColumnBefore.next(null);
5605
5604
  }, onClick: () => {
5606
5605
  props.component.insertColumn(index + 1);
5607
- refreshLayoutWidth();
5608
5606
  }, children: jsx("button", { class: "insert-btn", type: "button", children: "+" }) })] }) }));
5609
5607
  }) }) }) })] }), jsx("div", { class: ['action-bar', { active: props.isFocus() }], children: jsx("table", { style: {
5610
5608
  transform: `translateX(${-leftDistance()}px)`
@@ -5681,8 +5679,8 @@ function LeftBar(props) {
5681
5679
  const actionBarRows = actionBarRef.current.rows;
5682
5680
  setTimeout(() => {
5683
5681
  Array.from(props.tableRef.current.rows).forEach((tr, i) => {
5684
- const height = tr.offsetHeight ||
5685
- Math.min(...Array.from(tr.children).map(i => i.offsetHeight)) || 0;
5682
+ const height = tr.getBoundingClientRect().height ||
5683
+ Math.min(...Array.from(tr.children).map(i => i.getBoundingClientRect().height)) || 0;
5686
5684
  insertBarRows.item(i).style.height = height + 'px';
5687
5685
  actionBarRows.item(i).style.height = height + 'px';
5688
5686
  });
@@ -6433,7 +6431,7 @@ class Editor extends Textbus {
6433
6431
  provide: CollaborateSelectionAwarenessDelegate,
6434
6432
  useClass: TableSelectionAwarenessDelegate
6435
6433
  }, {
6436
- provide: MessageBus,
6434
+ provide: XNoteMessageBug,
6437
6435
  useFactory: (selection, collaborateCursor) => {
6438
6436
  return new XNoteMessageBug(selection, collaborateCursor, editorConfig.collaborateConfig.userinfo);
6439
6437
  },
@@ -6441,6 +6439,9 @@ class Editor extends Textbus {
6441
6439
  Selection,
6442
6440
  CollaborateCursor
6443
6441
  ]
6442
+ }, {
6443
+ provide: MessageBus,
6444
+ useExisting: XNoteMessageBug
6444
6445
  }]
6445
6446
  });
6446
6447
  }
package/bundles/index.js CHANGED
@@ -5559,16 +5559,17 @@ function TopBar(props) {
5559
5559
  });
5560
5560
  return () => sub.unsubscribe();
5561
5561
  });
5562
- const instance = core.getCurrentInstance();
5562
+ // const instance = getCurrentInstance()
5563
5563
  const s = props.component.changeMarker.onChange.subscribe(() => {
5564
- instance.markAsDirtied();
5564
+ const currentLayout = props.component.state.columnsConfig.slice();
5565
+ if (currentLayout.join(',') !== props.layoutWidth().join(',')) {
5566
+ props.layoutWidth.set(currentLayout);
5567
+ }
5568
+ // instance.markAsDirtied()
5565
5569
  });
5566
5570
  core.onUnmounted(() => {
5567
5571
  s.unsubscribe();
5568
5572
  });
5569
- function refreshLayoutWidth() {
5570
- props.layoutWidth.set(props.component.state.columnsConfig.slice());
5571
- }
5572
5573
  return scopedCss.withScopedCSS(scopedId$4, () => {
5573
5574
  const { state, tableSelection } = props.component;
5574
5575
  const position = tableSelection();
@@ -5587,7 +5588,6 @@ function TopBar(props) {
5587
5588
  transform: 'translateX(-50%)'
5588
5589
  }, visible: !!selectedColumnRange(), children: jsxRuntime.jsx(ToolbarItem, { children: jsxRuntime.jsx(Button, { onClick: () => {
5589
5590
  props.component.deleteColumns();
5590
- refreshLayoutWidth();
5591
5591
  }, children: jsxRuntime.jsx("span", { class: "xnote-icon-bin" }) }) }) }), jsxRuntime.jsx("table", { style: {
5592
5592
  transform: `translateX(${-leftDistance()}px)`
5593
5593
  }, children: jsxRuntime.jsx("tbody", { children: jsxRuntime.jsx("tr", { children: props.layoutWidth().map((i, index) => {
@@ -5599,14 +5599,12 @@ function TopBar(props) {
5599
5599
  left: '-10px'
5600
5600
  }, onClick: () => {
5601
5601
  props.component.insertColumn(0);
5602
- refreshLayoutWidth();
5603
5602
  }, children: jsxRuntime.jsx("button", { class: "insert-btn", type: "button", children: "+" }) })), jsxRuntime.jsx("span", { class: "insert-btn-wrap", onMouseenter: () => {
5604
5603
  tableService.onInsertColumnBefore.next(index + 1);
5605
5604
  }, onMouseleave: () => {
5606
5605
  tableService.onInsertColumnBefore.next(null);
5607
5606
  }, onClick: () => {
5608
5607
  props.component.insertColumn(index + 1);
5609
- refreshLayoutWidth();
5610
5608
  }, children: jsxRuntime.jsx("button", { class: "insert-btn", type: "button", children: "+" }) })] }) }));
5611
5609
  }) }) }) })] }), jsxRuntime.jsx("div", { class: ['action-bar', { active: props.isFocus() }], children: jsxRuntime.jsx("table", { style: {
5612
5610
  transform: `translateX(${-leftDistance()}px)`
@@ -5683,8 +5681,8 @@ function LeftBar(props) {
5683
5681
  const actionBarRows = actionBarRef.current.rows;
5684
5682
  setTimeout(() => {
5685
5683
  Array.from(props.tableRef.current.rows).forEach((tr, i) => {
5686
- const height = tr.offsetHeight ||
5687
- Math.min(...Array.from(tr.children).map(i => i.offsetHeight)) || 0;
5684
+ const height = tr.getBoundingClientRect().height ||
5685
+ Math.min(...Array.from(tr.children).map(i => i.getBoundingClientRect().height)) || 0;
5688
5686
  insertBarRows.item(i).style.height = height + 'px';
5689
5687
  actionBarRows.item(i).style.height = height + 'px';
5690
5688
  });
@@ -6435,7 +6433,7 @@ class Editor extends core$1.Textbus {
6435
6433
  provide: platformBrowser.CollaborateSelectionAwarenessDelegate,
6436
6434
  useClass: TableSelectionAwarenessDelegate
6437
6435
  }, {
6438
- provide: collaborate.MessageBus,
6436
+ provide: XNoteMessageBug,
6439
6437
  useFactory: (selection, collaborateCursor) => {
6440
6438
  return new XNoteMessageBug(selection, collaborateCursor, editorConfig.collaborateConfig.userinfo);
6441
6439
  },
@@ -6443,6 +6441,9 @@ class Editor extends core$1.Textbus {
6443
6441
  core$1.Selection,
6444
6442
  platformBrowser.CollaborateCursor
6445
6443
  ]
6444
+ }, {
6445
+ provide: collaborate.MessageBus,
6446
+ useExisting: XNoteMessageBug
6446
6447
  }]
6447
6448
  });
6448
6449
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/xnote",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "A high-performance rich text editor that supports multiplayer online collaboration.",
5
5
  "main": "./bundles/index.js",
6
6
  "module": "./bundles/index.esm.js",