rename some vars
This commit is contained in:
@@ -15,7 +15,7 @@ export default abstract class Extension {
|
|||||||
|
|
||||||
public abstract name: string
|
public abstract name: string
|
||||||
|
|
||||||
public type = 'extension'
|
public extensionType = 'extension'
|
||||||
|
|
||||||
public created() {}
|
public created() {}
|
||||||
|
|
||||||
|
|||||||
@@ -40,14 +40,14 @@ export default class ExtensionManager {
|
|||||||
|
|
||||||
get nodes(): any {
|
get nodes(): any {
|
||||||
return collect(this.extensions)
|
return collect(this.extensions)
|
||||||
.where('type', 'node')
|
.where('extensionType', '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('extensionType', 'mark')
|
||||||
.mapWithKeys((extension: any) => [extension.name, extension.schema()])
|
.mapWithKeys((extension: any) => [extension.name, extension.schema()])
|
||||||
.all()
|
.all()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ export default abstract class Mark extends Extension {
|
|||||||
super(options)
|
super(options)
|
||||||
}
|
}
|
||||||
|
|
||||||
public type = 'mark'
|
public extensionType = 'mark'
|
||||||
|
|
||||||
abstract schema(): MarkSpec
|
abstract schema(): MarkSpec
|
||||||
|
|
||||||
get schemaType() {
|
get type() {
|
||||||
return this.editor.schema.marks[this.name]
|
return this.editor.schema.marks[this.name]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ export default abstract class Node extends Extension {
|
|||||||
super(options)
|
super(options)
|
||||||
}
|
}
|
||||||
|
|
||||||
public type = 'node'
|
public extensionType = 'node'
|
||||||
|
|
||||||
public topNode = false
|
public topNode = false
|
||||||
|
|
||||||
abstract schema(): NodeSpec
|
abstract schema(): NodeSpec
|
||||||
|
|
||||||
get schemaType() {
|
get type() {
|
||||||
return this.editor.schema.nodes[this.name]
|
return this.editor.schema.nodes[this.name]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export default class Bold extends Mark {
|
|||||||
commands(): CommandSpec {
|
commands(): CommandSpec {
|
||||||
return {
|
return {
|
||||||
bold: (next, { view }) => {
|
bold: (next, { view }) => {
|
||||||
toggleMark(this.schemaType)(view.state, view.dispatch)
|
toggleMark(this.type)(view.state, view.dispatch)
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ export default class Bold extends Mark {
|
|||||||
.find(character)
|
.find(character)
|
||||||
.endCapture()
|
.endCapture()
|
||||||
.endOfLine(),
|
.endOfLine(),
|
||||||
this.schemaType,
|
this.type,
|
||||||
),
|
),
|
||||||
// match before whitespace
|
// match before whitespace
|
||||||
markInputRule(
|
markInputRule(
|
||||||
@@ -75,7 +75,7 @@ export default class Bold extends Mark {
|
|||||||
.find(character)
|
.find(character)
|
||||||
.endCapture()
|
.endCapture()
|
||||||
.endOfLine(),
|
.endOfLine(),
|
||||||
this.schemaType,
|
this.type,
|
||||||
),
|
),
|
||||||
]))
|
]))
|
||||||
.flat(1)
|
.flat(1)
|
||||||
@@ -94,7 +94,7 @@ export default class Bold extends Mark {
|
|||||||
.endCapture()
|
.endCapture()
|
||||||
.find(character)
|
.find(character)
|
||||||
.endCapture(),
|
.endCapture(),
|
||||||
this.schemaType,
|
this.type,
|
||||||
),
|
),
|
||||||
// match before whitespace
|
// match before whitespace
|
||||||
markPasteRule(
|
markPasteRule(
|
||||||
@@ -107,7 +107,7 @@ export default class Bold extends Mark {
|
|||||||
.endCapture()
|
.endCapture()
|
||||||
.find(character)
|
.find(character)
|
||||||
.endCapture(),
|
.endCapture(),
|
||||||
this.schemaType,
|
this.type,
|
||||||
),
|
),
|
||||||
]))
|
]))
|
||||||
.flat(1)
|
.flat(1)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default class Code extends Mark {
|
|||||||
commands(): CommandSpec {
|
commands(): CommandSpec {
|
||||||
return {
|
return {
|
||||||
code: (next, { view }) => {
|
code: (next, { view }) => {
|
||||||
toggleMark(this.schemaType)(view.state, view.dispatch)
|
toggleMark(this.type)(view.state, view.dispatch)
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ export default class Code extends Mark {
|
|||||||
.find(character)
|
.find(character)
|
||||||
.endCapture()
|
.endCapture()
|
||||||
.endOfLine(),
|
.endOfLine(),
|
||||||
this.schemaType,
|
this.type,
|
||||||
),
|
),
|
||||||
// match before whitespace
|
// match before whitespace
|
||||||
markInputRule(
|
markInputRule(
|
||||||
@@ -66,7 +66,7 @@ export default class Code extends Mark {
|
|||||||
.find(character)
|
.find(character)
|
||||||
.endCapture()
|
.endCapture()
|
||||||
.endOfLine(),
|
.endOfLine(),
|
||||||
this.schemaType,
|
this.type,
|
||||||
),
|
),
|
||||||
]))
|
]))
|
||||||
.flat(1)
|
.flat(1)
|
||||||
@@ -85,7 +85,7 @@ export default class Code extends Mark {
|
|||||||
.endCapture()
|
.endCapture()
|
||||||
.find(character)
|
.find(character)
|
||||||
.endCapture(),
|
.endCapture(),
|
||||||
this.schemaType,
|
this.type,
|
||||||
),
|
),
|
||||||
// match before whitespace
|
// match before whitespace
|
||||||
markPasteRule(
|
markPasteRule(
|
||||||
@@ -98,7 +98,7 @@ export default class Code extends Mark {
|
|||||||
.endCapture()
|
.endCapture()
|
||||||
.find(character)
|
.find(character)
|
||||||
.endCapture(),
|
.endCapture(),
|
||||||
this.schemaType,
|
this.type,
|
||||||
),
|
),
|
||||||
]))
|
]))
|
||||||
.flat(1)
|
.flat(1)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default class Italic extends Mark {
|
|||||||
commands(): CommandSpec {
|
commands(): CommandSpec {
|
||||||
return {
|
return {
|
||||||
italic: (next, { view }) => {
|
italic: (next, { view }) => {
|
||||||
toggleMark(this.schemaType)(view.state, view.dispatch)
|
toggleMark(this.type)(view.state, view.dispatch)
|
||||||
next()
|
next()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ export default class Italic extends Mark {
|
|||||||
.find(character)
|
.find(character)
|
||||||
.endCapture()
|
.endCapture()
|
||||||
.endOfLine(),
|
.endOfLine(),
|
||||||
this.schemaType,
|
this.type,
|
||||||
),
|
),
|
||||||
// match before whitespace
|
// match before whitespace
|
||||||
markInputRule(
|
markInputRule(
|
||||||
@@ -67,7 +67,7 @@ export default class Italic extends Mark {
|
|||||||
.find(character)
|
.find(character)
|
||||||
.endCapture()
|
.endCapture()
|
||||||
.endOfLine(),
|
.endOfLine(),
|
||||||
this.schemaType,
|
this.type,
|
||||||
),
|
),
|
||||||
]))
|
]))
|
||||||
.flat(1)
|
.flat(1)
|
||||||
@@ -86,7 +86,7 @@ export default class Italic extends Mark {
|
|||||||
.endCapture()
|
.endCapture()
|
||||||
.find(character)
|
.find(character)
|
||||||
.endCapture(),
|
.endCapture(),
|
||||||
this.schemaType,
|
this.type,
|
||||||
),
|
),
|
||||||
// match before whitespace
|
// match before whitespace
|
||||||
markPasteRule(
|
markPasteRule(
|
||||||
@@ -99,7 +99,7 @@ export default class Italic extends Mark {
|
|||||||
.endCapture()
|
.endCapture()
|
||||||
.find(character)
|
.find(character)
|
||||||
.endCapture(),
|
.endCapture(),
|
||||||
this.schemaType,
|
this.type,
|
||||||
),
|
),
|
||||||
]))
|
]))
|
||||||
.flat(1)
|
.flat(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user