@textbus/platform-browser 5.0.0-alpha.10 → 5.0.0-alpha.11

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.
@@ -849,7 +849,7 @@ let SelectionBridge = class SelectionBridge {
849
849
  this.getCorrectedPosition(nativeRange.endContainer, nativeRange.endOffset, isFocusEnd);
850
850
  if ([Node.ELEMENT_NODE, Node.TEXT_NODE].includes((_a = nativeRange.commonAncestorContainer) === null || _a === void 0 ? void 0 : _a.nodeType) &&
851
851
  startPosition && endPosition) {
852
- const abstractSelection = isFocusEnd ? {
852
+ const abstractSelection = connector.beforeChange(isFocusEnd ? {
853
853
  anchorSlot: startPosition.slot,
854
854
  anchorOffset: startPosition.offset,
855
855
  focusSlot: endPosition.slot,
@@ -859,7 +859,12 @@ let SelectionBridge = class SelectionBridge {
859
859
  focusOffset: startPosition.offset,
860
860
  anchorSlot: endPosition.slot,
861
861
  anchorOffset: endPosition.offset
862
- };
862
+ });
863
+ if (!abstractSelection) {
864
+ this.selectionChangeEvent.next(null);
865
+ connector.setSelection(null);
866
+ return;
867
+ }
863
868
  const { focus, anchor } = this.getPositionByRange(abstractSelection);
864
869
  if (focus && anchor) {
865
870
  let start = anchor;
package/bundles/index.js CHANGED
@@ -851,7 +851,7 @@ exports.SelectionBridge = class SelectionBridge {
851
851
  this.getCorrectedPosition(nativeRange.endContainer, nativeRange.endOffset, isFocusEnd);
852
852
  if ([Node.ELEMENT_NODE, Node.TEXT_NODE].includes((_a = nativeRange.commonAncestorContainer) === null || _a === void 0 ? void 0 : _a.nodeType) &&
853
853
  startPosition && endPosition) {
854
- const abstractSelection = isFocusEnd ? {
854
+ const abstractSelection = connector.beforeChange(isFocusEnd ? {
855
855
  anchorSlot: startPosition.slot,
856
856
  anchorOffset: startPosition.offset,
857
857
  focusSlot: endPosition.slot,
@@ -861,7 +861,12 @@ exports.SelectionBridge = class SelectionBridge {
861
861
  focusOffset: startPosition.offset,
862
862
  anchorSlot: endPosition.slot,
863
863
  anchorOffset: endPosition.offset
864
- };
864
+ });
865
+ if (!abstractSelection) {
866
+ this.selectionChangeEvent.next(null);
867
+ connector.setSelection(null);
868
+ return;
869
+ }
865
870
  const { focus, anchor } = this.getPositionByRange(abstractSelection);
866
871
  if (focus && anchor) {
867
872
  let start = anchor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "5.0.0-alpha.10",
3
+ "version": "5.0.0-alpha.11",
4
4
  "description": "Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.",
5
5
  "main": "./bundles/index.js",
6
6
  "module": "./bundles/index.esm.js",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@tanbo/stream": "^1.2.7",
29
- "@textbus/core": "^5.0.0-alpha.10",
29
+ "@textbus/core": "^5.0.0-alpha.11",
30
30
  "@viewfly/core": "^2.0.0-alpha.3"
31
31
  },
32
32
  "devDependencies": {
@@ -47,5 +47,5 @@
47
47
  "bugs": {
48
48
  "url": "https://github.com/textbus/textbus.git/issues"
49
49
  },
50
- "gitHead": "438501b25fd5388d8e55c1a693f25bf282a90a86"
50
+ "gitHead": "2b84bdb66f554f2d1e3fce4ff3fbd4105acb4c08"
51
51
  }