@textbus/platform-browser 3.3.0 → 3.3.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.
@@ -463,24 +463,8 @@ let SelectionBridge = class SelectionBridge {
463
463
  }
464
464
  }));
465
465
  }
466
- const oldSelection = {
467
- focusNode: null,
468
- focusOffset: null,
469
- anchorNode: null,
470
- anchorOffset: null
471
- };
472
466
  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
- }
467
+ this.syncSelection(connector);
484
468
  }));
485
469
  }
486
470
  syncSelection(connector) {
@@ -554,7 +538,10 @@ let SelectionBridge = class SelectionBridge {
554
538
  nativeRange.setEnd(end.node, end.offset);
555
539
  }
556
540
  connector.setSelection(abstractSelection);
557
- if (selection.isCollapsed) {
541
+ if (selection.isCollapsed && (rawRange.startContainer !== start.node ||
542
+ rawRange.startOffset !== start.offset ||
543
+ rawRange.endContainer !== end.node ||
544
+ rawRange.endOffset !== end.offset)) {
558
545
  rawRange.setStart(start.node, start.offset);
559
546
  rawRange.setEnd(end.node, end.offset);
560
547
  }
package/bundles/index.js CHANGED
@@ -465,24 +465,8 @@ exports.SelectionBridge = class SelectionBridge {
465
465
  }
466
466
  }));
467
467
  }
468
- const oldSelection = {
469
- focusNode: null,
470
- focusOffset: null,
471
- anchorNode: null,
472
- anchorOffset: null
473
- };
474
468
  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
- }
469
+ this.syncSelection(connector);
486
470
  }));
487
471
  }
488
472
  syncSelection(connector) {
@@ -556,7 +540,10 @@ exports.SelectionBridge = class SelectionBridge {
556
540
  nativeRange.setEnd(end.node, end.offset);
557
541
  }
558
542
  connector.setSelection(abstractSelection);
559
- if (selection.isCollapsed) {
543
+ if (selection.isCollapsed && (rawRange.startContainer !== start.node ||
544
+ rawRange.startOffset !== start.offset ||
545
+ rawRange.endContainer !== end.node ||
546
+ rawRange.endOffset !== end.offset)) {
560
547
  rawRange.setStart(start.node, start.offset);
561
548
  rawRange.setEnd(end.node, end.offset);
562
549
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
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.3.0",
30
+ "@textbus/core": "^3.3.2",
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": "f3949c614067a12f42b3e9b78866fba877ba838c"
51
+ "gitHead": "fc7c6a727bb3c1a9c24b6a8be683f09b1b18e0a8"
52
52
  }