@textbus/platform-browser 3.0.0-alpha.26 → 3.0.0-alpha.27

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.
@@ -26,7 +26,9 @@ declare class ExperimentalCaret implements Caret {
26
26
  private positionChangeEvent;
27
27
  private styleChangeEvent;
28
28
  private oldRange;
29
+ private isFixed;
29
30
  constructor(scheduler: Scheduler, editorMask: HTMLElement);
31
+ refresh(isFixedCaret?: boolean): void;
30
32
  show(range: Range, restart: boolean): void;
31
33
  hide(): void;
32
34
  destroy(): void;
@@ -18,6 +18,7 @@ declare class NativeCaret implements Caret {
18
18
  private _nativeRange;
19
19
  private subs;
20
20
  constructor(scheduler: Scheduler);
21
+ refresh(): void;
21
22
  correctScrollTop(scroller: Scroller): void;
22
23
  destroy(): void;
23
24
  }
@@ -48,6 +48,7 @@ export interface CaretPosition {
48
48
  export interface Caret {
49
49
  onPositionChange: Observable<CaretPosition | null>;
50
50
  readonly rect: Rect;
51
+ refresh(isFixedCaret: boolean): void;
51
52
  correctScrollTop(scroller: Scroller): void;
52
53
  }
53
54
  export declare abstract class Input {
@@ -1302,6 +1302,7 @@ class ExperimentalCaret {
1302
1302
  this.positionChangeEvent = new Subject();
1303
1303
  this.styleChangeEvent = new Subject();
1304
1304
  this.oldRange = null;
1305
+ this.isFixed = false;
1305
1306
  this.onPositionChange = this.positionChangeEvent.pipe(distinctUntilChanged());
1306
1307
  this.onStyleChange = this.styleChangeEvent.asObservable();
1307
1308
  this.elementRef = createElement('div', {
@@ -1339,6 +1340,13 @@ class ExperimentalCaret {
1339
1340
  get display() {
1340
1341
  return this._display;
1341
1342
  }
1343
+ refresh(isFixedCaret = false) {
1344
+ this.isFixed = isFixedCaret;
1345
+ if (this.oldRange) {
1346
+ this.show(this.oldRange, false);
1347
+ }
1348
+ this.isFixed = false;
1349
+ }
1342
1350
  show(range, restart) {
1343
1351
  const oldRect = this.elementRef.getBoundingClientRect();
1344
1352
  this.oldPosition = {
@@ -1418,7 +1426,7 @@ class ExperimentalCaret {
1418
1426
  }
1419
1427
  }
1420
1428
  else if (!isPressed) {
1421
- if (this.oldPosition) {
1429
+ if (this.isFixed && this.oldPosition) {
1422
1430
  const offset = Math.floor(position.top - this.oldPosition.top);
1423
1431
  scroller.setOffset(offset);
1424
1432
  }
@@ -1752,6 +1760,9 @@ class NativeCaret {
1752
1760
  height: 0
1753
1761
  };
1754
1762
  }
1763
+ refresh() {
1764
+ //
1765
+ }
1755
1766
  correctScrollTop(scroller) {
1756
1767
  this.destroy();
1757
1768
  const scheduler = this.scheduler;
package/bundles/index.js CHANGED
@@ -1304,6 +1304,7 @@ class ExperimentalCaret {
1304
1304
  this.positionChangeEvent = new stream.Subject();
1305
1305
  this.styleChangeEvent = new stream.Subject();
1306
1306
  this.oldRange = null;
1307
+ this.isFixed = false;
1307
1308
  this.onPositionChange = this.positionChangeEvent.pipe(stream.distinctUntilChanged());
1308
1309
  this.onStyleChange = this.styleChangeEvent.asObservable();
1309
1310
  this.elementRef = createElement('div', {
@@ -1341,6 +1342,13 @@ class ExperimentalCaret {
1341
1342
  get display() {
1342
1343
  return this._display;
1343
1344
  }
1345
+ refresh(isFixedCaret = false) {
1346
+ this.isFixed = isFixedCaret;
1347
+ if (this.oldRange) {
1348
+ this.show(this.oldRange, false);
1349
+ }
1350
+ this.isFixed = false;
1351
+ }
1344
1352
  show(range, restart) {
1345
1353
  const oldRect = this.elementRef.getBoundingClientRect();
1346
1354
  this.oldPosition = {
@@ -1420,7 +1428,7 @@ class ExperimentalCaret {
1420
1428
  }
1421
1429
  }
1422
1430
  else if (!isPressed) {
1423
- if (this.oldPosition) {
1431
+ if (this.isFixed && this.oldPosition) {
1424
1432
  const offset = Math.floor(position.top - this.oldPosition.top);
1425
1433
  scroller.setOffset(offset);
1426
1434
  }
@@ -1754,6 +1762,9 @@ class NativeCaret {
1754
1762
  height: 0
1755
1763
  };
1756
1764
  }
1765
+ refresh() {
1766
+ //
1767
+ }
1757
1768
  correctScrollTop(scroller) {
1758
1769
  this.destroy();
1759
1770
  const scheduler = this.scheduler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "3.0.0-alpha.26",
3
+ "version": "3.0.0-alpha.27",
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.3",
29
29
  "@tanbo/stream": "^1.1.8",
30
- "@textbus/core": "^3.0.0-alpha.26",
30
+ "@textbus/core": "^3.0.0-alpha.27",
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": "04e1a5ca0c3f2986f8f154a83a696cbd96eff44d"
51
+ "gitHead": "e04074dc20483ad5313766ed859b38f5a6de7fa3"
52
52
  }