@textbus/platform-browser 3.1.6 → 3.1.9

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,12 +8,7 @@ declare class NativeCaret implements Caret {
8
8
  onPositionChange: Observable<CaretPosition | null>;
9
9
  set nativeRange(range: Range | null);
10
10
  get nativeRange(): Range | null;
11
- get rect(): DOMRect | {
12
- left: number;
13
- top: number;
14
- width: number;
15
- height: number;
16
- };
11
+ get rect(): import("../_utils/uikit").Rect;
17
12
  private oldPosition;
18
13
  private _nativeRange;
19
14
  private subs;
@@ -1897,7 +1897,7 @@ class NativeCaret {
1897
1897
  if (range) {
1898
1898
  const r = range.cloneRange();
1899
1899
  r.collapse(true);
1900
- const rect = r.getBoundingClientRect();
1900
+ const rect = getLayoutRectByRange(r);
1901
1901
  this.positionChangeEvent.next({
1902
1902
  left: rect.left,
1903
1903
  top: rect.top,
@@ -1915,7 +1915,7 @@ class NativeCaret {
1915
1915
  if (this.nativeRange) {
1916
1916
  const range = this.nativeRange.cloneRange();
1917
1917
  range.collapse(true);
1918
- return range.getBoundingClientRect();
1918
+ return getLayoutRectByRange(range);
1919
1919
  }
1920
1920
  return {
1921
1921
  left: 0,
@@ -1996,9 +1996,11 @@ class NativeCaret {
1996
1996
  let NativeInput = class NativeInput extends Input {
1997
1997
  set disabled(b) {
1998
1998
  this._disabled = b;
1999
- if (b && !this.controller.readonly) {
2000
- this.documentView.contentEditable = b ? 'false' : 'true';
1999
+ if (this.controller.readonly) {
2000
+ this.documentView.contentEditable = 'false';
2001
+ return;
2001
2002
  }
2003
+ this.documentView.contentEditable = b ? 'false' : 'true';
2002
2004
  }
2003
2005
  get disabled() {
2004
2006
  return this._disabled;
@@ -2762,7 +2764,7 @@ class Viewer extends Starter {
2762
2764
  });
2763
2765
  const styleEl = document.createElement('style');
2764
2766
  docStyles.push(...(options.styleSheets || []));
2765
- editModeStyles.push(`#${this.id} *::selection{background-color: rgba(18, 150, 219, .4); color:inherit}`, ...(options.editingStyleSheets || []));
2767
+ editModeStyles.push(`#${this.id} *::selection{background-color: rgba(18, 150, 219, .2); color:inherit}`, ...(options.editingStyleSheets || []));
2766
2768
  this.styleSheet = Viewer.cssMin(docStyles.join(''));
2767
2769
  styleEl.innerHTML = this.styleSheet + Viewer.cssMin(editModeStyles.join(''));
2768
2770
  this.resourceNodes.push(styleEl);
package/bundles/index.js CHANGED
@@ -1899,7 +1899,7 @@ class NativeCaret {
1899
1899
  if (range) {
1900
1900
  const r = range.cloneRange();
1901
1901
  r.collapse(true);
1902
- const rect = r.getBoundingClientRect();
1902
+ const rect = getLayoutRectByRange(r);
1903
1903
  this.positionChangeEvent.next({
1904
1904
  left: rect.left,
1905
1905
  top: rect.top,
@@ -1917,7 +1917,7 @@ class NativeCaret {
1917
1917
  if (this.nativeRange) {
1918
1918
  const range = this.nativeRange.cloneRange();
1919
1919
  range.collapse(true);
1920
- return range.getBoundingClientRect();
1920
+ return getLayoutRectByRange(range);
1921
1921
  }
1922
1922
  return {
1923
1923
  left: 0,
@@ -1998,9 +1998,11 @@ class NativeCaret {
1998
1998
  exports.NativeInput = class NativeInput extends Input {
1999
1999
  set disabled(b) {
2000
2000
  this._disabled = b;
2001
- if (b && !this.controller.readonly) {
2002
- this.documentView.contentEditable = b ? 'false' : 'true';
2001
+ if (this.controller.readonly) {
2002
+ this.documentView.contentEditable = 'false';
2003
+ return;
2003
2004
  }
2005
+ this.documentView.contentEditable = b ? 'false' : 'true';
2004
2006
  }
2005
2007
  get disabled() {
2006
2008
  return this._disabled;
@@ -2764,7 +2766,7 @@ class Viewer extends core.Starter {
2764
2766
  });
2765
2767
  const styleEl = document.createElement('style');
2766
2768
  docStyles.push(...(options.styleSheets || []));
2767
- editModeStyles.push(`#${this.id} *::selection{background-color: rgba(18, 150, 219, .4); color:inherit}`, ...(options.editingStyleSheets || []));
2769
+ editModeStyles.push(`#${this.id} *::selection{background-color: rgba(18, 150, 219, .2); color:inherit}`, ...(options.editingStyleSheets || []));
2768
2770
  this.styleSheet = Viewer.cssMin(docStyles.join(''));
2769
2771
  styleEl.innerHTML = this.styleSheet + Viewer.cssMin(editModeStyles.join(''));
2770
2772
  this.resourceNodes.push(styleEl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "3.1.6",
3
+ "version": "3.1.9",
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.6",
30
+ "@textbus/core": "^3.1.7",
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": "5e41cfd65f8f2331df69c26b80d8efe58f98a454"
51
+ "gitHead": "fac88c46fa8c1b510b212bc53ecae95e60d4adc6"
52
52
  }