DEV: Export Tag class to modify methods in plugin
This commit is contained in:
parent
a115aae45f
commit
8556288397
|
@ -9,7 +9,7 @@ const msoListClasses = [
|
||||||
"MsoListParagraphCxSpLast"
|
"MsoListParagraphCxSpLast"
|
||||||
];
|
];
|
||||||
|
|
||||||
class Tag {
|
export class Tag {
|
||||||
constructor(name, prefix = "", suffix = "", inline = false) {
|
constructor(name, prefix = "", suffix = "", inline = false) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
|
@ -419,7 +419,8 @@ class Tag {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const tags = [
|
function tags() {
|
||||||
|
return [
|
||||||
...Tag.blocks().map(b => Tag.block(b)),
|
...Tag.blocks().map(b => Tag.block(b)),
|
||||||
...Tag.headings().map((h, i) => Tag.heading(h, i + 1)),
|
...Tag.headings().map((h, i) => Tag.heading(h, i + 1)),
|
||||||
...Tag.slices().map(s => Tag.slice(s, "\n")),
|
...Tag.slices().map(s => Tag.slice(s, "\n")),
|
||||||
|
@ -443,7 +444,8 @@ const tags = [
|
||||||
Tag.tr(),
|
Tag.tr(),
|
||||||
Tag.ol(),
|
Tag.ol(),
|
||||||
Tag.list("ul")
|
Tag.list("ul")
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
||||||
class Element {
|
class Element {
|
||||||
constructor(element, parent, previous, next) {
|
constructor(element, parent, previous, next) {
|
||||||
|
@ -472,7 +474,7 @@ class Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
tag() {
|
tag() {
|
||||||
const tag = new (tags.filter(t => new t().name === this.name)[0] || Tag)();
|
const tag = new (tags().filter(t => new t().name === this.name)[0] || Tag)();
|
||||||
tag.element = this;
|
tag.element = this;
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue