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 { get nodes(): any {
return collect(this.extensions) return collect(this.extensions)
.where('type', 'node') .where('type', 'node')
.mapWithKeys((extension: any) => [extension.name, extension.schema]) .mapWithKeys((extension: any) => [extension.name, extension.schema()])
.all() .all()
} }
get marks(): any { get marks(): any {
return collect(this.extensions) return collect(this.extensions)
.where('type', 'mark') .where('type', 'mark')
.mapWithKeys((extension: any) => [extension.name, extension.schema]) .mapWithKeys((extension: any) => [extension.name, extension.schema()])
.all() .all()
} }

View File

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

View File

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

View File

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

View File

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