@textbus/platform-browser 4.0.0-alpha.51 → 4.0.0-alpha.53

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.
@@ -168,7 +168,6 @@ let Parser = Parser_1 = class Parser {
168
168
  return new DOMParser().parseFromString(html, 'text/html').body;
169
169
  }
170
170
  constructor(options, textbus) {
171
- this.options = options;
172
171
  this.textbus = textbus;
173
172
  const componentLoaders = [
174
173
  ...(options.componentLoaders || [])
@@ -213,8 +212,9 @@ let Parser = Parser_1 = class Parser {
213
212
  slot.insert('\n');
214
213
  return;
215
214
  }
215
+ const schema = [...slot.schema];
216
216
  for (const t of this.componentLoaders) {
217
- if (t.match(el)) {
217
+ if (t.match(el, schema)) {
218
218
  const result = t.read(el, this.textbus, (childSlot, slotRootElement, slotContentHostElement = slotRootElement) => {
219
219
  return this.readSlot(childSlot, slotRootElement, slotContentHostElement);
220
220
  });
package/bundles/index.js CHANGED
@@ -170,7 +170,6 @@ exports.Parser = Parser_1 = class Parser {
170
170
  return new DOMParser().parseFromString(html, 'text/html').body;
171
171
  }
172
172
  constructor(options, textbus) {
173
- this.options = options;
174
173
  this.textbus = textbus;
175
174
  const componentLoaders = [
176
175
  ...(options.componentLoaders || [])
@@ -215,8 +214,9 @@ exports.Parser = Parser_1 = class Parser {
215
214
  slot.insert('\n');
216
215
  return;
217
216
  }
217
+ const schema = [...slot.schema];
218
218
  for (const t of this.componentLoaders) {
219
- if (t.match(el)) {
219
+ if (t.match(el, schema)) {
220
220
  const result = t.read(el, this.textbus, (childSlot, slotRootElement, slotContentHostElement = slotRootElement) => {
221
221
  return this.readSlot(childSlot, slotRootElement, slotContentHostElement);
222
222
  });
@@ -1,4 +1,4 @@
1
- import { Attribute, Component, Formatter, FormatValue, Slot, Textbus } from '@textbus/core';
1
+ import { Attribute, Component, ContentType, Formatter, FormatValue, Slot, Textbus } from '@textbus/core';
2
2
  import { ViewOptions } from './browser-module';
3
3
  /**
4
4
  * 插槽解析器
@@ -18,7 +18,7 @@ export interface SlotParser {
18
18
  */
19
19
  export interface ComponentLoader {
20
20
  /** 识别组件的匹配方法 */
21
- match(element: HTMLElement): boolean;
21
+ match(element: HTMLElement, returnableContentTypes: ContentType[]): boolean;
22
22
  /** 读取组件内容的方法 */
23
23
  read(element: HTMLElement, textbus: Textbus, slotParser: SlotParser): Component | Slot | void;
24
24
  }
@@ -64,7 +64,6 @@ export interface AttributeLoader<T = FormatValue> {
64
64
  * 用于解析 HTML,并把 HTML 内容转换为 Textbus 可以支持的组件或插槽数据
65
65
  */
66
66
  export declare class Parser {
67
- private options;
68
67
  private textbus;
69
68
  static parseHTML(html: string): HTMLElement;
70
69
  componentLoaders: ComponentLoader[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "4.0.0-alpha.51",
3
+ "version": "4.0.0-alpha.53",
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",
@@ -25,9 +25,9 @@
25
25
  "typescript editor"
26
26
  ],
27
27
  "dependencies": {
28
- "@tanbo/stream": "^1.2.3",
29
- "@textbus/collaborate": "^4.0.0-alpha.51",
30
- "@textbus/core": "^4.0.0-alpha.50",
28
+ "@tanbo/stream": "^1.2.4",
29
+ "@textbus/collaborate": "^4.0.0-alpha.53",
30
+ "@textbus/core": "^4.0.0-alpha.53",
31
31
  "@viewfly/core": "^1.0.0-alpha.4",
32
32
  "reflect-metadata": "^0.1.13"
33
33
  },
@@ -49,5 +49,5 @@
49
49
  "bugs": {
50
50
  "url": "https://github.com/textbus/textbus.git/issues"
51
51
  },
52
- "gitHead": "0b54e3b23238b09096449e8fccf0127820f8e206"
52
+ "gitHead": "457054dfa61a943b0fa35a306be8cbaeee9c9110"
53
53
  }