@textbus/platform-browser 3.3.1 → 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,28 +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
- }
484
- else {
485
- const nativeRange = this.nativeSelection.getRangeAt(0);
486
- this.selectionChangeEvent.next(nativeRange || null);
487
- }
467
+ this.syncSelection(connector);
488
468
  }));
489
469
  }
490
470
  syncSelection(connector) {
@@ -558,7 +538,10 @@ let SelectionBridge = class SelectionBridge {
558
538
  nativeRange.setEnd(end.node, end.offset);
559
539
  }
560
540
  connector.setSelection(abstractSelection);
561
- 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)) {
562
545
  rawRange.setStart(start.node, start.offset);
563
546
  rawRange.setEnd(end.node, end.offset);
564
547
  }
package/bundles/index.js CHANGED
@@ -465,28 +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
- }
486
- else {
487
- const nativeRange = this.nativeSelection.getRangeAt(0);
488
- this.selectionChangeEvent.next(nativeRange || null);
489
- }
469
+ this.syncSelection(connector);
490
470
  }));
491
471
  }
492
472
  syncSelection(connector) {
@@ -560,7 +540,10 @@ exports.SelectionBridge = class SelectionBridge {
560
540
  nativeRange.setEnd(end.node, end.offset);
561
541
  }
562
542
  connector.setSelection(abstractSelection);
563
- 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)) {
564
547
  rawRange.setStart(start.node, start.offset);
565
548
  rawRange.setEnd(end.node, end.offset);
566
549
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "3.3.1",
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.1",
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": "afa1c378f5f46be38bd4b1fe8f881e7c6e0c7478"
51
+ "gitHead": "fc7c6a727bb3c1a9c24b6a8be683f09b1b18e0a8"
52
52
  }