@textbus/platform-browser 3.8.3 → 3.8.4

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.
@@ -8,8 +8,6 @@ import { Input, ViewOptions } from './types';
8
8
  */
9
9
  export declare class SelectionBridge implements NativeSelectionBridge {
10
10
  private config;
11
- private injector;
12
- private controller;
13
11
  private selection;
14
12
  private rootComponentRef;
15
13
  private input;
@@ -24,7 +22,6 @@ export declare class SelectionBridge implements NativeSelectionBridge {
24
22
  private ignoreSelectionChange;
25
23
  private changeFromUser;
26
24
  private docContainer;
27
- private maskContainer;
28
25
  private cacheCaretPositionTimer;
29
26
  private oldCaretPosition;
30
27
  constructor(config: ViewOptions, injector: Injector, controller: Controller, selection: Selection, rootComponentRef: RootComponentRef, input: Input, renderer: Renderer);
@@ -1,7 +1,7 @@
1
1
  import 'reflect-metadata';
2
2
  import { InjectionToken, Injectable, Inject, Injector, Optional } from '@tanbo/di';
3
3
  import { VTextNode, VElement, Controller, Selection, RootComponentRef, Renderer, Scheduler, Slot, ContentType, Event, invokeListener, Keyboard, Commander, makeError, Starter, NativeRenderer, NativeSelectionBridge, OutputRenderer, History, Registry } from '@textbus/core';
4
- import { Subject, filter, fromEvent, Subscription, distinctUntilChanged, merge, map, Observable } from '@tanbo/stream';
4
+ import { Subject, filter, fromEvent, delay, Subscription, distinctUntilChanged, merge, map, Observable } from '@tanbo/stream';
5
5
 
6
6
  function createElement(tagName, options = {}) {
7
7
  const el = document.createElement(tagName);
@@ -177,8 +177,6 @@ class Input {
177
177
  let SelectionBridge = class SelectionBridge {
178
178
  constructor(config, injector, controller, selection, rootComponentRef, input, renderer) {
179
179
  this.config = config;
180
- this.injector = injector;
181
- this.controller = controller;
182
180
  this.selection = selection;
183
181
  this.rootComponentRef = rootComponentRef;
184
182
  this.input = input;
@@ -191,7 +189,6 @@ let SelectionBridge = class SelectionBridge {
191
189
  this.ignoreSelectionChange = false;
192
190
  this.changeFromUser = false;
193
191
  this.docContainer = injector.get(VIEW_DOCUMENT);
194
- this.maskContainer = injector.get(VIEW_MASK);
195
192
  this.onSelectionChange = this.selectionChangeEvent.asObservable().pipe(filter(() => {
196
193
  return !controller.readonly;
197
194
  }));
@@ -498,7 +495,15 @@ let SelectionBridge = class SelectionBridge {
498
495
  }
499
496
  }));
500
497
  }
501
- this.subs.push(fromEvent(document, 'selectionchange').pipe().subscribe(() => {
498
+ let isUpdating = false;
499
+ this.subs.push(this.renderer.onViewUpdateBefore.subscribe(() => {
500
+ isUpdating = true;
501
+ }), this.renderer.onViewUpdated.pipe(delay()).subscribe(() => {
502
+ isUpdating = false;
503
+ }), fromEvent(document, 'selectionchange').subscribe(() => {
504
+ if (isUpdating) {
505
+ return;
506
+ }
502
507
  this.syncSelection(connector);
503
508
  }));
504
509
  }
package/bundles/index.js CHANGED
@@ -179,8 +179,6 @@ class Input {
179
179
  exports.SelectionBridge = class SelectionBridge {
180
180
  constructor(config, injector, controller, selection, rootComponentRef, input, renderer) {
181
181
  this.config = config;
182
- this.injector = injector;
183
- this.controller = controller;
184
182
  this.selection = selection;
185
183
  this.rootComponentRef = rootComponentRef;
186
184
  this.input = input;
@@ -193,7 +191,6 @@ exports.SelectionBridge = class SelectionBridge {
193
191
  this.ignoreSelectionChange = false;
194
192
  this.changeFromUser = false;
195
193
  this.docContainer = injector.get(VIEW_DOCUMENT);
196
- this.maskContainer = injector.get(VIEW_MASK);
197
194
  this.onSelectionChange = this.selectionChangeEvent.asObservable().pipe(stream.filter(() => {
198
195
  return !controller.readonly;
199
196
  }));
@@ -500,7 +497,15 @@ exports.SelectionBridge = class SelectionBridge {
500
497
  }
501
498
  }));
502
499
  }
503
- this.subs.push(stream.fromEvent(document, 'selectionchange').pipe().subscribe(() => {
500
+ let isUpdating = false;
501
+ this.subs.push(this.renderer.onViewUpdateBefore.subscribe(() => {
502
+ isUpdating = true;
503
+ }), this.renderer.onViewUpdated.pipe(stream.delay()).subscribe(() => {
504
+ isUpdating = false;
505
+ }), stream.fromEvent(document, 'selectionchange').subscribe(() => {
506
+ if (isUpdating) {
507
+ return;
508
+ }
504
509
  this.syncSelection(connector);
505
510
  }));
506
511
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "3.8.3",
3
+ "version": "3.8.4",
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.8",
29
29
  "@tanbo/stream": "^1.2.5",
30
- "@textbus/core": "^3.8.1",
30
+ "@textbus/core": "^3.8.4",
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": "bac004b8d0a7acd5c090385c5c2e2aeb41577773"
51
+ "gitHead": "7359230a08229933be9cb78590b6777256fa5582"
52
52
  }