@textbus/platform-browser 3.0.0-alpha.46 → 3.0.0-alpha.47

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.
@@ -1218,6 +1218,9 @@ DomRenderer = DomRenderer_1 = __decorate([
1218
1218
 
1219
1219
  var Parser_1;
1220
1220
  let Parser = Parser_1 = class Parser {
1221
+ static parseHTML(html) {
1222
+ return new DOMParser().parseFromString(html, 'text/html').body;
1223
+ }
1221
1224
  constructor(options, injector) {
1222
1225
  var _a;
1223
1226
  this.options = options;
@@ -1239,9 +1242,6 @@ let Parser = Parser_1 = class Parser {
1239
1242
  this.formatLoaders = formatLoaders;
1240
1243
  this.attributeLoaders = attributeLoaders;
1241
1244
  }
1242
- static parseHTML(html) {
1243
- return new DOMParser().parseFromString(html, 'text/html').body;
1244
- }
1245
1245
  parseDoc(html, rootComponentLoader) {
1246
1246
  const element = Parser_1.parseHTML(html);
1247
1247
  return rootComponentLoader.read(element, this.injector, (childSlot, slotRootElement, slotContentHostElement = slotRootElement) => {
@@ -1348,6 +1348,16 @@ const iframeHTML = `
1348
1348
  </html>
1349
1349
  `;
1350
1350
  class ExperimentalCaret {
1351
+ get rect() {
1352
+ return this.caret.getBoundingClientRect();
1353
+ }
1354
+ set display(v) {
1355
+ this._display = v;
1356
+ this.caret.style.visibility = v ? 'visible' : 'hidden';
1357
+ }
1358
+ get display() {
1359
+ return this._display;
1360
+ }
1351
1361
  constructor(scheduler, editorMask) {
1352
1362
  this.scheduler = scheduler;
1353
1363
  this.editorMask = editorMask;
@@ -1387,16 +1397,6 @@ class ExperimentalCaret {
1387
1397
  }));
1388
1398
  this.editorMask.appendChild(this.elementRef);
1389
1399
  }
1390
- get rect() {
1391
- return this.caret.getBoundingClientRect();
1392
- }
1393
- set display(v) {
1394
- this._display = v;
1395
- this.caret.style.visibility = v ? 'visible' : 'hidden';
1396
- }
1397
- get display() {
1398
- return this._display;
1399
- }
1400
1400
  refresh(isFixedCaret = false) {
1401
1401
  this.isFixed = isFixedCaret;
1402
1402
  if (this.oldRange) {
@@ -1551,6 +1551,15 @@ class ExperimentalCaret {
1551
1551
  * Textbus PC 端输入实现
1552
1552
  */
1553
1553
  let MagicInput = class MagicInput extends Input {
1554
+ set disabled(b) {
1555
+ this._disabled = b;
1556
+ if (b && this.textarea) {
1557
+ this.textarea.disabled = b;
1558
+ }
1559
+ }
1560
+ get disabled() {
1561
+ return this._disabled;
1562
+ }
1554
1563
  constructor(parser, keyboard, commander, selection, controller, scheduler, injector) {
1555
1564
  super();
1556
1565
  this.parser = parser;
@@ -1589,15 +1598,6 @@ let MagicInput = class MagicInput extends Input {
1589
1598
  });
1590
1599
  this.caret.elementRef.append(this.container);
1591
1600
  }
1592
- set disabled(b) {
1593
- this._disabled = b;
1594
- if (b && this.textarea) {
1595
- this.textarea.disabled = b;
1596
- }
1597
- }
1598
- get disabled() {
1599
- return this._disabled;
1600
- }
1601
1601
  focus(range, restart) {
1602
1602
  var _a;
1603
1603
  if (!this.disabled) {
@@ -1803,14 +1803,6 @@ MagicInput = __decorate([
1803
1803
  ], MagicInput);
1804
1804
 
1805
1805
  class NativeCaret {
1806
- constructor(scheduler) {
1807
- this.scheduler = scheduler;
1808
- this.oldPosition = null;
1809
- this._nativeRange = null;
1810
- this.subs = [];
1811
- this.positionChangeEvent = new Subject();
1812
- this.onPositionChange = this.positionChangeEvent.pipe(distinctUntilChanged());
1813
- }
1814
1806
  set nativeRange(range) {
1815
1807
  this._nativeRange = range;
1816
1808
  if (range) {
@@ -1843,6 +1835,14 @@ class NativeCaret {
1843
1835
  height: 0
1844
1836
  };
1845
1837
  }
1838
+ constructor(scheduler) {
1839
+ this.scheduler = scheduler;
1840
+ this.oldPosition = null;
1841
+ this._nativeRange = null;
1842
+ this.subs = [];
1843
+ this.positionChangeEvent = new Subject();
1844
+ this.onPositionChange = this.positionChangeEvent.pipe(distinctUntilChanged());
1845
+ }
1846
1846
  refresh() {
1847
1847
  //
1848
1848
  }
@@ -1905,6 +1905,15 @@ class NativeCaret {
1905
1905
  }
1906
1906
  }
1907
1907
  let NativeInput = class NativeInput extends Input {
1908
+ set disabled(b) {
1909
+ this._disabled = b;
1910
+ if (b && !this.controller.readonly) {
1911
+ this.documentView.contentEditable = b ? 'true' : 'false';
1912
+ }
1913
+ }
1914
+ get disabled() {
1915
+ return this._disabled;
1916
+ }
1908
1917
  constructor(injector, parser, scheduler, selection, keyboard, commander, controller) {
1909
1918
  super();
1910
1919
  this.injector = injector;
@@ -1935,15 +1944,6 @@ let NativeInput = class NativeInput extends Input {
1935
1944
  this.handleInput(this.documentView);
1936
1945
  this.handleDefaultActions(this.documentView);
1937
1946
  }
1938
- set disabled(b) {
1939
- this._disabled = b;
1940
- if (b && !this.controller.readonly) {
1941
- this.documentView.contentEditable = b ? 'true' : 'false';
1942
- }
1943
- }
1944
- get disabled() {
1945
- return this._disabled;
1946
- }
1947
1947
  focus(nativeRange) {
1948
1948
  if (this.controller.readonly) {
1949
1949
  return;
@@ -2201,6 +2201,15 @@ const editorError = makeError('CoreEditor');
2201
2201
  * Textbus PC 端编辑器
2202
2202
  */
2203
2203
  class Viewer extends Starter {
2204
+ get readonly() {
2205
+ return this.controller.readonly;
2206
+ }
2207
+ set readonly(b) {
2208
+ this.controller.readonly = b;
2209
+ }
2210
+ isFocus() {
2211
+ return this._isFocus;
2212
+ }
2204
2213
  constructor(rootComponent, rootComponentLoader, options = {}) {
2205
2214
  const id = 'textbus-' + Number((Math.random() + '').substring(2)).toString(16);
2206
2215
  const { doc, mask, wrapper } = Viewer.createLayout(id, options.minHeight);
@@ -2263,15 +2272,6 @@ class Viewer extends Starter {
2263
2272
  this.onSave = this.saveEvent.asObservable();
2264
2273
  this.controller = this.get(Controller);
2265
2274
  }
2266
- get readonly() {
2267
- return this.controller.readonly;
2268
- }
2269
- set readonly(b) {
2270
- this.controller.readonly = b;
2271
- }
2272
- isFocus() {
2273
- return this._isFocus;
2274
- }
2275
2275
  /**
2276
2276
  * 初始化编辑器
2277
2277
  * @param host 编辑器容器
package/bundles/index.js CHANGED
@@ -1220,6 +1220,9 @@ exports.DomRenderer = DomRenderer_1 = __decorate([
1220
1220
 
1221
1221
  var Parser_1;
1222
1222
  exports.Parser = Parser_1 = class Parser {
1223
+ static parseHTML(html) {
1224
+ return new DOMParser().parseFromString(html, 'text/html').body;
1225
+ }
1223
1226
  constructor(options, injector) {
1224
1227
  var _a;
1225
1228
  this.options = options;
@@ -1241,9 +1244,6 @@ exports.Parser = Parser_1 = class Parser {
1241
1244
  this.formatLoaders = formatLoaders;
1242
1245
  this.attributeLoaders = attributeLoaders;
1243
1246
  }
1244
- static parseHTML(html) {
1245
- return new DOMParser().parseFromString(html, 'text/html').body;
1246
- }
1247
1247
  parseDoc(html, rootComponentLoader) {
1248
1248
  const element = Parser_1.parseHTML(html);
1249
1249
  return rootComponentLoader.read(element, this.injector, (childSlot, slotRootElement, slotContentHostElement = slotRootElement) => {
@@ -1350,6 +1350,16 @@ const iframeHTML = `
1350
1350
  </html>
1351
1351
  `;
1352
1352
  class ExperimentalCaret {
1353
+ get rect() {
1354
+ return this.caret.getBoundingClientRect();
1355
+ }
1356
+ set display(v) {
1357
+ this._display = v;
1358
+ this.caret.style.visibility = v ? 'visible' : 'hidden';
1359
+ }
1360
+ get display() {
1361
+ return this._display;
1362
+ }
1353
1363
  constructor(scheduler, editorMask) {
1354
1364
  this.scheduler = scheduler;
1355
1365
  this.editorMask = editorMask;
@@ -1389,16 +1399,6 @@ class ExperimentalCaret {
1389
1399
  }));
1390
1400
  this.editorMask.appendChild(this.elementRef);
1391
1401
  }
1392
- get rect() {
1393
- return this.caret.getBoundingClientRect();
1394
- }
1395
- set display(v) {
1396
- this._display = v;
1397
- this.caret.style.visibility = v ? 'visible' : 'hidden';
1398
- }
1399
- get display() {
1400
- return this._display;
1401
- }
1402
1402
  refresh(isFixedCaret = false) {
1403
1403
  this.isFixed = isFixedCaret;
1404
1404
  if (this.oldRange) {
@@ -1553,6 +1553,15 @@ class ExperimentalCaret {
1553
1553
  * Textbus PC 端输入实现
1554
1554
  */
1555
1555
  exports.MagicInput = class MagicInput extends Input {
1556
+ set disabled(b) {
1557
+ this._disabled = b;
1558
+ if (b && this.textarea) {
1559
+ this.textarea.disabled = b;
1560
+ }
1561
+ }
1562
+ get disabled() {
1563
+ return this._disabled;
1564
+ }
1556
1565
  constructor(parser, keyboard, commander, selection, controller, scheduler, injector) {
1557
1566
  super();
1558
1567
  this.parser = parser;
@@ -1591,15 +1600,6 @@ exports.MagicInput = class MagicInput extends Input {
1591
1600
  });
1592
1601
  this.caret.elementRef.append(this.container);
1593
1602
  }
1594
- set disabled(b) {
1595
- this._disabled = b;
1596
- if (b && this.textarea) {
1597
- this.textarea.disabled = b;
1598
- }
1599
- }
1600
- get disabled() {
1601
- return this._disabled;
1602
- }
1603
1603
  focus(range, restart) {
1604
1604
  var _a;
1605
1605
  if (!this.disabled) {
@@ -1805,14 +1805,6 @@ exports.MagicInput = __decorate([
1805
1805
  ], exports.MagicInput);
1806
1806
 
1807
1807
  class NativeCaret {
1808
- constructor(scheduler) {
1809
- this.scheduler = scheduler;
1810
- this.oldPosition = null;
1811
- this._nativeRange = null;
1812
- this.subs = [];
1813
- this.positionChangeEvent = new stream.Subject();
1814
- this.onPositionChange = this.positionChangeEvent.pipe(stream.distinctUntilChanged());
1815
- }
1816
1808
  set nativeRange(range) {
1817
1809
  this._nativeRange = range;
1818
1810
  if (range) {
@@ -1845,6 +1837,14 @@ class NativeCaret {
1845
1837
  height: 0
1846
1838
  };
1847
1839
  }
1840
+ constructor(scheduler) {
1841
+ this.scheduler = scheduler;
1842
+ this.oldPosition = null;
1843
+ this._nativeRange = null;
1844
+ this.subs = [];
1845
+ this.positionChangeEvent = new stream.Subject();
1846
+ this.onPositionChange = this.positionChangeEvent.pipe(stream.distinctUntilChanged());
1847
+ }
1848
1848
  refresh() {
1849
1849
  //
1850
1850
  }
@@ -1907,6 +1907,15 @@ class NativeCaret {
1907
1907
  }
1908
1908
  }
1909
1909
  exports.NativeInput = class NativeInput extends Input {
1910
+ set disabled(b) {
1911
+ this._disabled = b;
1912
+ if (b && !this.controller.readonly) {
1913
+ this.documentView.contentEditable = b ? 'true' : 'false';
1914
+ }
1915
+ }
1916
+ get disabled() {
1917
+ return this._disabled;
1918
+ }
1910
1919
  constructor(injector, parser, scheduler, selection, keyboard, commander, controller) {
1911
1920
  super();
1912
1921
  this.injector = injector;
@@ -1937,15 +1946,6 @@ exports.NativeInput = class NativeInput extends Input {
1937
1946
  this.handleInput(this.documentView);
1938
1947
  this.handleDefaultActions(this.documentView);
1939
1948
  }
1940
- set disabled(b) {
1941
- this._disabled = b;
1942
- if (b && !this.controller.readonly) {
1943
- this.documentView.contentEditable = b ? 'true' : 'false';
1944
- }
1945
- }
1946
- get disabled() {
1947
- return this._disabled;
1948
- }
1949
1949
  focus(nativeRange) {
1950
1950
  if (this.controller.readonly) {
1951
1951
  return;
@@ -2203,6 +2203,15 @@ const editorError = core.makeError('CoreEditor');
2203
2203
  * Textbus PC 端编辑器
2204
2204
  */
2205
2205
  class Viewer extends core.Starter {
2206
+ get readonly() {
2207
+ return this.controller.readonly;
2208
+ }
2209
+ set readonly(b) {
2210
+ this.controller.readonly = b;
2211
+ }
2212
+ isFocus() {
2213
+ return this._isFocus;
2214
+ }
2206
2215
  constructor(rootComponent, rootComponentLoader, options = {}) {
2207
2216
  const id = 'textbus-' + Number((Math.random() + '').substring(2)).toString(16);
2208
2217
  const { doc, mask, wrapper } = Viewer.createLayout(id, options.minHeight);
@@ -2265,15 +2274,6 @@ class Viewer extends core.Starter {
2265
2274
  this.onSave = this.saveEvent.asObservable();
2266
2275
  this.controller = this.get(core.Controller);
2267
2276
  }
2268
- get readonly() {
2269
- return this.controller.readonly;
2270
- }
2271
- set readonly(b) {
2272
- this.controller.readonly = b;
2273
- }
2274
- isFocus() {
2275
- return this._isFocus;
2276
- }
2277
2277
  /**
2278
2278
  * 初始化编辑器
2279
2279
  * @param host 编辑器容器
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "3.0.0-alpha.46",
3
+ "version": "3.0.0-alpha.47",
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",
@@ -26,8 +26,8 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@tanbo/di": "^1.1.4",
29
- "@tanbo/stream": "^1.1.8",
30
- "@textbus/core": "^3.0.0-alpha.46",
29
+ "@tanbo/stream": "^1.1.9",
30
+ "@textbus/core": "^3.0.0-alpha.47",
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": "2acbca8b0a59b2bd0d69dee519812041db777e25"
51
+ "gitHead": "2cbb3985dcfeea87cfd87004bd42d27c4e0392ce"
52
52
  }