@textbus/platform-browser 3.1.21 → 3.2.1

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.
@@ -463,8 +463,24 @@ let SelectionBridge = class SelectionBridge {
463
463
  }
464
464
  }));
465
465
  }
466
- this.subs.push(fromEvent(document, 'selectionchange').subscribe(() => {
467
- this.syncSelection(connector);
466
+ const oldSelection = {
467
+ focusNode: null,
468
+ focusOffset: null,
469
+ anchorNode: null,
470
+ anchorOffset: null
471
+ };
472
+ this.subs.push(fromEvent(document, 'selectionchange').pipe().subscribe(() => {
473
+ const { anchorNode, anchorOffset, focusOffset, focusNode } = this.nativeSelection;
474
+ if (anchorNode !== oldSelection.anchorNode ||
475
+ anchorOffset !== oldSelection.anchorOffset ||
476
+ focusNode !== oldSelection.focusNode ||
477
+ focusOffset !== oldSelection.focusOffset) {
478
+ this.syncSelection(connector);
479
+ oldSelection.anchorNode = anchorNode;
480
+ oldSelection.anchorOffset = anchorOffset;
481
+ oldSelection.focusNode = focusNode;
482
+ oldSelection.focusOffset = focusOffset;
483
+ }
468
484
  }));
469
485
  }
470
486
  syncSelection(connector) {
package/bundles/index.js CHANGED
@@ -465,8 +465,24 @@ exports.SelectionBridge = class SelectionBridge {
465
465
  }
466
466
  }));
467
467
  }
468
- this.subs.push(stream.fromEvent(document, 'selectionchange').subscribe(() => {
469
- this.syncSelection(connector);
468
+ const oldSelection = {
469
+ focusNode: null,
470
+ focusOffset: null,
471
+ anchorNode: null,
472
+ anchorOffset: null
473
+ };
474
+ this.subs.push(stream.fromEvent(document, 'selectionchange').pipe().subscribe(() => {
475
+ const { anchorNode, anchorOffset, focusOffset, focusNode } = this.nativeSelection;
476
+ if (anchorNode !== oldSelection.anchorNode ||
477
+ anchorOffset !== oldSelection.anchorOffset ||
478
+ focusNode !== oldSelection.focusNode ||
479
+ focusOffset !== oldSelection.focusOffset) {
480
+ this.syncSelection(connector);
481
+ oldSelection.anchorNode = anchorNode;
482
+ oldSelection.anchorOffset = anchorOffset;
483
+ oldSelection.focusNode = focusNode;
484
+ oldSelection.focusOffset = focusOffset;
485
+ }
470
486
  }));
471
487
  }
472
488
  syncSelection(connector) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "3.1.21",
3
+ "version": "3.2.1",
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",
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@tanbo/di": "^1.1.4",
29
29
  "@tanbo/stream": "^1.1.9",
30
- "@textbus/core": "^3.1.21",
30
+ "@textbus/core": "^3.2.1",
31
31
  "reflect-metadata": "^0.1.13"
32
32
  },
33
33
  "devDependencies": {
@@ -48,5 +48,5 @@
48
48
  "bugs": {
49
49
  "url": "https://github.com/textbus/textbus.git/issues"
50
50
  },
51
- "gitHead": "a02a7bb20de281ff48e36461478dff4e64a2db17"
51
+ "gitHead": "3d0cf24997143cd9e2adfd96bcb2083ef394f7f4"
52
52
  }