@textbus/platform-browser 3.0.0-alpha.36 → 3.0.0-alpha.38

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.
@@ -1205,6 +1205,9 @@ DomRenderer = DomRenderer_1 = __decorate([
1205
1205
 
1206
1206
  var Parser_1;
1207
1207
  let Parser = Parser_1 = class Parser {
1208
+ static parseHTML(html) {
1209
+ return new DOMParser().parseFromString(html, 'text/html').body;
1210
+ }
1208
1211
  constructor(options, injector) {
1209
1212
  var _a;
1210
1213
  this.options = options;
@@ -1226,9 +1229,6 @@ let Parser = Parser_1 = class Parser {
1226
1229
  this.formatLoaders = formatLoaders;
1227
1230
  this.attributeLoaders = attributeLoaders;
1228
1231
  }
1229
- static parseHTML(html) {
1230
- return new DOMParser().parseFromString(html, 'text/html').body;
1231
- }
1232
1232
  parseDoc(html, rootComponentLoader) {
1233
1233
  const element = Parser_1.parseHTML(html);
1234
1234
  return rootComponentLoader.read(element, this.injector, (childSlot, slotRootElement, slotContentHostElement = slotRootElement) => {
@@ -1335,6 +1335,16 @@ const iframeHTML = `
1335
1335
  </html>
1336
1336
  `;
1337
1337
  class ExperimentalCaret {
1338
+ get rect() {
1339
+ return this.caret.getBoundingClientRect();
1340
+ }
1341
+ set display(v) {
1342
+ this._display = v;
1343
+ this.caret.style.visibility = v ? 'visible' : 'hidden';
1344
+ }
1345
+ get display() {
1346
+ return this._display;
1347
+ }
1338
1348
  constructor(scheduler, editorMask) {
1339
1349
  this.scheduler = scheduler;
1340
1350
  this.editorMask = editorMask;
@@ -1374,16 +1384,6 @@ class ExperimentalCaret {
1374
1384
  }));
1375
1385
  this.editorMask.appendChild(this.elementRef);
1376
1386
  }
1377
- get rect() {
1378
- return this.caret.getBoundingClientRect();
1379
- }
1380
- set display(v) {
1381
- this._display = v;
1382
- this.caret.style.visibility = v ? 'visible' : 'hidden';
1383
- }
1384
- get display() {
1385
- return this._display;
1386
- }
1387
1387
  refresh(isFixedCaret = false) {
1388
1388
  this.isFixed = isFixedCaret;
1389
1389
  if (this.oldRange) {
@@ -1777,14 +1777,6 @@ MagicInput = __decorate([
1777
1777
  ], MagicInput);
1778
1778
 
1779
1779
  class NativeCaret {
1780
- constructor(scheduler) {
1781
- this.scheduler = scheduler;
1782
- this.oldPosition = null;
1783
- this._nativeRange = null;
1784
- this.subs = [];
1785
- this.positionChangeEvent = new Subject();
1786
- this.onPositionChange = this.positionChangeEvent.pipe(distinctUntilChanged());
1787
- }
1788
1780
  set nativeRange(range) {
1789
1781
  this._nativeRange = range;
1790
1782
  if (range) {
@@ -1817,6 +1809,14 @@ class NativeCaret {
1817
1809
  height: 0
1818
1810
  };
1819
1811
  }
1812
+ constructor(scheduler) {
1813
+ this.scheduler = scheduler;
1814
+ this.oldPosition = null;
1815
+ this._nativeRange = null;
1816
+ this.subs = [];
1817
+ this.positionChangeEvent = new Subject();
1818
+ this.onPositionChange = this.positionChangeEvent.pipe(distinctUntilChanged());
1819
+ }
1820
1820
  refresh() {
1821
1821
  //
1822
1822
  }
@@ -2306,6 +2306,15 @@ const editorError = makeError('CoreEditor');
2306
2306
  * Textbus PC 端编辑器
2307
2307
  */
2308
2308
  class Viewer extends Starter {
2309
+ get readonly() {
2310
+ return this.controller.readonly;
2311
+ }
2312
+ set readonly(b) {
2313
+ this.controller.readonly = b;
2314
+ }
2315
+ isFocus() {
2316
+ return this._isFocus;
2317
+ }
2309
2318
  constructor(rootComponent, rootComponentLoader, options = {}) {
2310
2319
  const id = 'textbus-' + Number((Math.random() + '').substring(2)).toString(16);
2311
2320
  const { doc, mask, wrapper } = Viewer.createLayout(id, options.minHeight);
@@ -2368,15 +2377,6 @@ class Viewer extends Starter {
2368
2377
  this.onSave = this.saveEvent.asObservable();
2369
2378
  this.controller = this.get(Controller);
2370
2379
  }
2371
- get readonly() {
2372
- return this.controller.readonly;
2373
- }
2374
- set readonly(b) {
2375
- this.controller.readonly = b;
2376
- }
2377
- isFocus() {
2378
- return this._isFocus;
2379
- }
2380
2380
  /**
2381
2381
  * 初始化编辑器
2382
2382
  * @param host 编辑器容器
@@ -2484,7 +2484,7 @@ class Viewer extends Starter {
2484
2484
  /**
2485
2485
  * 获取 HTML 格式的内容
2486
2486
  */
2487
- getContent() {
2487
+ getHTML() {
2488
2488
  this.guardReady();
2489
2489
  const outputRenderer = this.get(OutputRenderer);
2490
2490
  const outputTranslator = this.get(OutputTranslator);
package/bundles/index.js CHANGED
@@ -1207,6 +1207,9 @@ exports.DomRenderer = DomRenderer_1 = __decorate([
1207
1207
 
1208
1208
  var Parser_1;
1209
1209
  exports.Parser = Parser_1 = class Parser {
1210
+ static parseHTML(html) {
1211
+ return new DOMParser().parseFromString(html, 'text/html').body;
1212
+ }
1210
1213
  constructor(options, injector) {
1211
1214
  var _a;
1212
1215
  this.options = options;
@@ -1228,9 +1231,6 @@ exports.Parser = Parser_1 = class Parser {
1228
1231
  this.formatLoaders = formatLoaders;
1229
1232
  this.attributeLoaders = attributeLoaders;
1230
1233
  }
1231
- static parseHTML(html) {
1232
- return new DOMParser().parseFromString(html, 'text/html').body;
1233
- }
1234
1234
  parseDoc(html, rootComponentLoader) {
1235
1235
  const element = Parser_1.parseHTML(html);
1236
1236
  return rootComponentLoader.read(element, this.injector, (childSlot, slotRootElement, slotContentHostElement = slotRootElement) => {
@@ -1337,6 +1337,16 @@ const iframeHTML = `
1337
1337
  </html>
1338
1338
  `;
1339
1339
  class ExperimentalCaret {
1340
+ get rect() {
1341
+ return this.caret.getBoundingClientRect();
1342
+ }
1343
+ set display(v) {
1344
+ this._display = v;
1345
+ this.caret.style.visibility = v ? 'visible' : 'hidden';
1346
+ }
1347
+ get display() {
1348
+ return this._display;
1349
+ }
1340
1350
  constructor(scheduler, editorMask) {
1341
1351
  this.scheduler = scheduler;
1342
1352
  this.editorMask = editorMask;
@@ -1376,16 +1386,6 @@ class ExperimentalCaret {
1376
1386
  }));
1377
1387
  this.editorMask.appendChild(this.elementRef);
1378
1388
  }
1379
- get rect() {
1380
- return this.caret.getBoundingClientRect();
1381
- }
1382
- set display(v) {
1383
- this._display = v;
1384
- this.caret.style.visibility = v ? 'visible' : 'hidden';
1385
- }
1386
- get display() {
1387
- return this._display;
1388
- }
1389
1389
  refresh(isFixedCaret = false) {
1390
1390
  this.isFixed = isFixedCaret;
1391
1391
  if (this.oldRange) {
@@ -1779,14 +1779,6 @@ exports.MagicInput = __decorate([
1779
1779
  ], exports.MagicInput);
1780
1780
 
1781
1781
  class NativeCaret {
1782
- constructor(scheduler) {
1783
- this.scheduler = scheduler;
1784
- this.oldPosition = null;
1785
- this._nativeRange = null;
1786
- this.subs = [];
1787
- this.positionChangeEvent = new stream.Subject();
1788
- this.onPositionChange = this.positionChangeEvent.pipe(stream.distinctUntilChanged());
1789
- }
1790
1782
  set nativeRange(range) {
1791
1783
  this._nativeRange = range;
1792
1784
  if (range) {
@@ -1819,6 +1811,14 @@ class NativeCaret {
1819
1811
  height: 0
1820
1812
  };
1821
1813
  }
1814
+ constructor(scheduler) {
1815
+ this.scheduler = scheduler;
1816
+ this.oldPosition = null;
1817
+ this._nativeRange = null;
1818
+ this.subs = [];
1819
+ this.positionChangeEvent = new stream.Subject();
1820
+ this.onPositionChange = this.positionChangeEvent.pipe(stream.distinctUntilChanged());
1821
+ }
1822
1822
  refresh() {
1823
1823
  //
1824
1824
  }
@@ -2308,6 +2308,15 @@ const editorError = core.makeError('CoreEditor');
2308
2308
  * Textbus PC 端编辑器
2309
2309
  */
2310
2310
  class Viewer extends core.Starter {
2311
+ get readonly() {
2312
+ return this.controller.readonly;
2313
+ }
2314
+ set readonly(b) {
2315
+ this.controller.readonly = b;
2316
+ }
2317
+ isFocus() {
2318
+ return this._isFocus;
2319
+ }
2311
2320
  constructor(rootComponent, rootComponentLoader, options = {}) {
2312
2321
  const id = 'textbus-' + Number((Math.random() + '').substring(2)).toString(16);
2313
2322
  const { doc, mask, wrapper } = Viewer.createLayout(id, options.minHeight);
@@ -2370,15 +2379,6 @@ class Viewer extends core.Starter {
2370
2379
  this.onSave = this.saveEvent.asObservable();
2371
2380
  this.controller = this.get(core.Controller);
2372
2381
  }
2373
- get readonly() {
2374
- return this.controller.readonly;
2375
- }
2376
- set readonly(b) {
2377
- this.controller.readonly = b;
2378
- }
2379
- isFocus() {
2380
- return this._isFocus;
2381
- }
2382
2382
  /**
2383
2383
  * 初始化编辑器
2384
2384
  * @param host 编辑器容器
@@ -2486,7 +2486,7 @@ class Viewer extends core.Starter {
2486
2486
  /**
2487
2487
  * 获取 HTML 格式的内容
2488
2488
  */
2489
- getContent() {
2489
+ getHTML() {
2490
2490
  this.guardReady();
2491
2491
  const outputRenderer = this.get(core.OutputRenderer);
2492
2492
  const outputTranslator = this.get(exports.OutputTranslator);
@@ -69,7 +69,7 @@ export declare class Viewer extends Starter {
69
69
  /**
70
70
  * 获取 HTML 格式的内容
71
71
  */
72
- getContent(): string;
72
+ getHTML(): string;
73
73
  /**
74
74
  * 获取 JSON 格式的内容
75
75
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "3.0.0-alpha.36",
3
+ "version": "3.0.0-alpha.38",
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.8",
30
- "@textbus/core": "^3.0.0-alpha.36",
30
+ "@textbus/core": "^3.0.0-alpha.38",
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": "6aae75e9643e3131358825b354b4581fc0cc0642"
51
+ "gitHead": "5a467be66bf6ed9feca7e3c591bfbc73600e69f9"
52
52
  }