update: parser 解析html移除 isEngine 限制

This commit is contained in:
yanmao 2022-01-21 13:37:28 +08:00
parent c12a1f4d19
commit b6e8b6fc64
7 changed files with 9 additions and 16 deletions

View File

@ -9,7 +9,7 @@ import { RangeInterface, RangePath } from '../types/range';
import ChangeEvent from './event';
import Parser from '../parser';
import { ANCHOR_SELECTOR, CURSOR_SELECTOR, FOCUS_SELECTOR } from '../constants';
import { combinText, transformCustomTags } from '../utils';
import { combinText } from '../utils';
import { TRIGGER_CARD_ID } from '../constants/card';
import { DATA_ID, EDITABLE_SELECTOR, UI_SELECTOR } from '../constants/root';
import { SelectionInterface } from '../types/selection';

View File

@ -25,7 +25,6 @@ export default class<T extends FileOptions = FileOptions> extends Plugin<T> {
init() {
this.editor.language.add(locales);
if (!isEngine(this.editor)) return;
this.editor.on('parse:html', (node) => this.parseHtml(node));
this.editor.on('paste:each', (child) => this.pasteHtml(child));
this.editor.on('paste:schema', (schema: SchemaInterface) =>

View File

@ -55,7 +55,6 @@ export default class Math<
init() {
this.editor.language.add(locales);
if (!isEngine(this.editor)) return;
this.editor.on('parse:html', (node) => this.parseHtml(node));
this.editor.on('paste:each', (child) => this.pasteHtml(child));
this.editor.on('paste:schema', (schema: SchemaInterface) =>

View File

@ -24,14 +24,14 @@ class MentionPlugin<
}
init() {
this.editor.on('parse:value', (node) => this.paserValue(node));
this.editor.on('parse:html', (node) => this.parseHtml(node));
this.editor.on('paste:each', (child) => this.pasteHtml(child));
this.editor.on('paste:schema', (schema: SchemaInterface) =>
this.pasteSchema(schema),
);
if (isEngine(this.editor)) {
this.editor.on('keydown:at', (event) => this.onAt(event));
this.editor.on('parse:value', (node) => this.paserValue(node));
this.editor.on('parse:html', (node) => this.parseHtml(node));
this.editor.on('paste:each', (child) => this.pasteHtml(child));
this.editor.on('paste:schema', (schema: SchemaInterface) =>
this.pasteSchema(schema),
);
}
this.editor.language.add(locales);
}

View File

@ -23,7 +23,6 @@ export default class<
init() {
this.editor.language.add(locales);
if (!isEngine(this.editor)) return;
this.editor.on('parse:html', (node) => this.parseHtml(node));
this.editor.on('paste:each', (child) => this.pasteHtml(child));
this.editor.on('paste:schema', (schema: SchemaInterface) =>

View File

@ -13,13 +13,13 @@ import {
CARD_VALUE_KEY,
CARD_SELECTOR,
transformCustomTags,
READY_CARD_SELECTOR,
} from '@aomao/engine';
import TableComponent, { Template, Helper } from './component';
import locales from './locale';
import { TableInterface, TableOptions, TableValue } from './types';
import './index.css';
import { DATA_ID } from '@aomao/engine';
import { CardInterface } from '@aomao/engine';
class Table<T extends TableOptions = TableOptions> extends Plugin<T> {
static get pluginName() {
return 'table';
@ -493,10 +493,7 @@ class Table<T extends TableOptions = TableOptions> extends Plugin<T> {
node.remove();
return;
} else {
const cards = table.find(CARD_SELECTOR).toArray();
cards.forEach((componentNode) => {
this.editor.trigger('parse:html', componentNode);
});
this.editor.trigger('parse:html', table);
}
}
const width = table.attributes('width') || table.css('width');

View File

@ -31,7 +31,6 @@ export default class VideoPlugin<
init() {
this.editor.language.add(locales);
if (!isEngine(this.editor)) return;
this.editor.on('parse:html', (node) => this.parseHtml(node));
this.editor.on('paste:each', (child) => this.pasteHtml(child));
this.editor.on('paste:schema', (schema: SchemaInterface) =>