refactoring

This commit is contained in:
Philipp Kühn
2020-03-28 23:54:49 +01:00
parent 1431bc73b3
commit 4d7658f183
5 changed files with 21 additions and 30 deletions

View File

@@ -27,14 +27,14 @@ export default class ExtensionManager {
get nodes(): any {
return collect(this.extensions)
.where('type', 'node')
.mapWithKeys((extension: any) => [extension.name, extension.schema])
.mapWithKeys((extension: any) => [extension.name, extension.schema()])
.all()
}
get marks(): any {
return collect(this.extensions)
.where('type', 'mark')
.mapWithKeys((extension: any) => [extension.name, extension.schema])
.mapWithKeys((extension: any) => [extension.name, extension.schema()])
.all()
}

View File

@@ -10,23 +10,8 @@ export default abstract class Node extends Extension {
public topNode = false
// get type() {
// return 'node'
// }
// get view(): any {
// return null
// }
// get schema(): any {
// return null
// }
public abstract schema: any
// public abstract plugins?: any
// command() {
// return () => {}
// }
schema(): any {
return null
}
}

View File

@@ -6,8 +6,10 @@ export default class Document extends Node {
topNode = true
schema = {
content: 'block+',
schema() {
return {
content: 'block+',
}
}
}

View File

@@ -4,12 +4,14 @@ export default class Paragraph extends Node {
name = 'paragraph'
schema = {
content: 'inline*',
group: 'block',
draggable: false,
parseDOM: [{ tag: 'p' }],
toDOM: () => ['p', 0],
schema() {
return {
content: 'inline*',
group: 'block',
draggable: false,
parseDOM: [{ tag: 'p' }],
toDOM: () => ['p', 0],
}
}
}

View File

@@ -4,8 +4,10 @@ export default class Text extends Node {
name = 'text'
schema = {
group: 'inline',
schema() {
return {
group: 'inline',
}
}
}