update: parser 解析html移除 isEngine 限制
This commit is contained in:
parent
c12a1f4d19
commit
b6e8b6fc64
|
@ -9,7 +9,7 @@ import { RangeInterface, RangePath } from '../types/range';
|
||||||
import ChangeEvent from './event';
|
import ChangeEvent from './event';
|
||||||
import Parser from '../parser';
|
import Parser from '../parser';
|
||||||
import { ANCHOR_SELECTOR, CURSOR_SELECTOR, FOCUS_SELECTOR } from '../constants';
|
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 { TRIGGER_CARD_ID } from '../constants/card';
|
||||||
import { DATA_ID, EDITABLE_SELECTOR, UI_SELECTOR } from '../constants/root';
|
import { DATA_ID, EDITABLE_SELECTOR, UI_SELECTOR } from '../constants/root';
|
||||||
import { SelectionInterface } from '../types/selection';
|
import { SelectionInterface } from '../types/selection';
|
||||||
|
|
|
@ -25,7 +25,6 @@ export default class<T extends FileOptions = FileOptions> extends Plugin<T> {
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.editor.language.add(locales);
|
this.editor.language.add(locales);
|
||||||
if (!isEngine(this.editor)) return;
|
|
||||||
this.editor.on('parse:html', (node) => this.parseHtml(node));
|
this.editor.on('parse:html', (node) => this.parseHtml(node));
|
||||||
this.editor.on('paste:each', (child) => this.pasteHtml(child));
|
this.editor.on('paste:each', (child) => this.pasteHtml(child));
|
||||||
this.editor.on('paste:schema', (schema: SchemaInterface) =>
|
this.editor.on('paste:schema', (schema: SchemaInterface) =>
|
||||||
|
|
|
@ -55,7 +55,6 @@ export default class Math<
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.editor.language.add(locales);
|
this.editor.language.add(locales);
|
||||||
if (!isEngine(this.editor)) return;
|
|
||||||
this.editor.on('parse:html', (node) => this.parseHtml(node));
|
this.editor.on('parse:html', (node) => this.parseHtml(node));
|
||||||
this.editor.on('paste:each', (child) => this.pasteHtml(child));
|
this.editor.on('paste:each', (child) => this.pasteHtml(child));
|
||||||
this.editor.on('paste:schema', (schema: SchemaInterface) =>
|
this.editor.on('paste:schema', (schema: SchemaInterface) =>
|
||||||
|
|
|
@ -24,14 +24,14 @@ class MentionPlugin<
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
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)) {
|
if (isEngine(this.editor)) {
|
||||||
this.editor.on('keydown:at', (event) => this.onAt(event));
|
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);
|
this.editor.language.add(locales);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ export default class<
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.editor.language.add(locales);
|
this.editor.language.add(locales);
|
||||||
if (!isEngine(this.editor)) return;
|
|
||||||
this.editor.on('parse:html', (node) => this.parseHtml(node));
|
this.editor.on('parse:html', (node) => this.parseHtml(node));
|
||||||
this.editor.on('paste:each', (child) => this.pasteHtml(child));
|
this.editor.on('paste:each', (child) => this.pasteHtml(child));
|
||||||
this.editor.on('paste:schema', (schema: SchemaInterface) =>
|
this.editor.on('paste:schema', (schema: SchemaInterface) =>
|
||||||
|
|
|
@ -13,13 +13,13 @@ import {
|
||||||
CARD_VALUE_KEY,
|
CARD_VALUE_KEY,
|
||||||
CARD_SELECTOR,
|
CARD_SELECTOR,
|
||||||
transformCustomTags,
|
transformCustomTags,
|
||||||
|
READY_CARD_SELECTOR,
|
||||||
} from '@aomao/engine';
|
} from '@aomao/engine';
|
||||||
import TableComponent, { Template, Helper } from './component';
|
import TableComponent, { Template, Helper } from './component';
|
||||||
import locales from './locale';
|
import locales from './locale';
|
||||||
import { TableInterface, TableOptions, TableValue } from './types';
|
import { TableInterface, TableOptions, TableValue } from './types';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
import { DATA_ID } from '@aomao/engine';
|
import { DATA_ID } from '@aomao/engine';
|
||||||
import { CardInterface } from '@aomao/engine';
|
|
||||||
class Table<T extends TableOptions = TableOptions> extends Plugin<T> {
|
class Table<T extends TableOptions = TableOptions> extends Plugin<T> {
|
||||||
static get pluginName() {
|
static get pluginName() {
|
||||||
return 'table';
|
return 'table';
|
||||||
|
@ -493,10 +493,7 @@ class Table<T extends TableOptions = TableOptions> extends Plugin<T> {
|
||||||
node.remove();
|
node.remove();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
const cards = table.find(CARD_SELECTOR).toArray();
|
this.editor.trigger('parse:html', table);
|
||||||
cards.forEach((componentNode) => {
|
|
||||||
this.editor.trigger('parse:html', componentNode);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const width = table.attributes('width') || table.css('width');
|
const width = table.attributes('width') || table.css('width');
|
||||||
|
|
|
@ -31,7 +31,6 @@ export default class VideoPlugin<
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.editor.language.add(locales);
|
this.editor.language.add(locales);
|
||||||
if (!isEngine(this.editor)) return;
|
|
||||||
this.editor.on('parse:html', (node) => this.parseHtml(node));
|
this.editor.on('parse:html', (node) => this.parseHtml(node));
|
||||||
this.editor.on('paste:each', (child) => this.pasteHtml(child));
|
this.editor.on('paste:each', (child) => this.pasteHtml(child));
|
||||||
this.editor.on('paste:schema', (schema: SchemaInterface) =>
|
this.editor.on('paste:schema', (schema: SchemaInterface) =>
|
||||||
|
|
Loading…
Reference in New Issue