From bd4fe7e5e37358486dd4dff50d6bdba58174f19d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Fri, 10 Apr 2020 22:07:27 +0200 Subject: [PATCH] rename some vars --- packages/core/src/Extension.ts | 2 +- packages/core/src/ExtensionManager.ts | 4 ++-- packages/core/src/Mark.ts | 4 ++-- packages/core/src/Node.ts | 4 ++-- packages/extension-bold/index.ts | 10 +++++----- packages/extension-code/index.ts | 10 +++++----- packages/extension-italic/index.ts | 10 +++++----- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/core/src/Extension.ts b/packages/core/src/Extension.ts index decae871..da45fa44 100644 --- a/packages/core/src/Extension.ts +++ b/packages/core/src/Extension.ts @@ -15,7 +15,7 @@ export default abstract class Extension { public abstract name: string - public type = 'extension' + public extensionType = 'extension' public created() {} diff --git a/packages/core/src/ExtensionManager.ts b/packages/core/src/ExtensionManager.ts index d4119d63..9b81746f 100644 --- a/packages/core/src/ExtensionManager.ts +++ b/packages/core/src/ExtensionManager.ts @@ -40,14 +40,14 @@ export default class ExtensionManager { get nodes(): any { return collect(this.extensions) - .where('type', 'node') + .where('extensionType', 'node') .mapWithKeys((extension: any) => [extension.name, extension.schema()]) .all() } get marks(): any { return collect(this.extensions) - .where('type', 'mark') + .where('extensionType', 'mark') .mapWithKeys((extension: any) => [extension.name, extension.schema()]) .all() } diff --git a/packages/core/src/Mark.ts b/packages/core/src/Mark.ts index 45d413ed..06cc4ca7 100644 --- a/packages/core/src/Mark.ts +++ b/packages/core/src/Mark.ts @@ -7,11 +7,11 @@ export default abstract class Mark extends Extension { super(options) } - public type = 'mark' + public extensionType = 'mark' abstract schema(): MarkSpec - get schemaType() { + get type() { return this.editor.schema.marks[this.name] } diff --git a/packages/core/src/Node.ts b/packages/core/src/Node.ts index 5d64c11a..79436aa9 100644 --- a/packages/core/src/Node.ts +++ b/packages/core/src/Node.ts @@ -7,13 +7,13 @@ export default abstract class Node extends Extension { super(options) } - public type = 'node' + public extensionType = 'node' public topNode = false abstract schema(): NodeSpec - get schemaType() { + get type() { return this.editor.schema.nodes[this.name] } diff --git a/packages/extension-bold/index.ts b/packages/extension-bold/index.ts index cc9ca09a..f9e8326c 100644 --- a/packages/extension-bold/index.ts +++ b/packages/extension-bold/index.ts @@ -35,7 +35,7 @@ export default class Bold extends Mark { commands(): CommandSpec { return { bold: (next, { view }) => { - toggleMark(this.schemaType)(view.state, view.dispatch) + toggleMark(this.type)(view.state, view.dispatch) next() }, } @@ -61,7 +61,7 @@ export default class Bold extends Mark { .find(character) .endCapture() .endOfLine(), - this.schemaType, + this.type, ), // match before whitespace markInputRule( @@ -75,7 +75,7 @@ export default class Bold extends Mark { .find(character) .endCapture() .endOfLine(), - this.schemaType, + this.type, ), ])) .flat(1) @@ -94,7 +94,7 @@ export default class Bold extends Mark { .endCapture() .find(character) .endCapture(), - this.schemaType, + this.type, ), // match before whitespace markPasteRule( @@ -107,7 +107,7 @@ export default class Bold extends Mark { .endCapture() .find(character) .endCapture(), - this.schemaType, + this.type, ), ])) .flat(1) diff --git a/packages/extension-code/index.ts b/packages/extension-code/index.ts index 58150b88..cec3a75b 100644 --- a/packages/extension-code/index.ts +++ b/packages/extension-code/index.ts @@ -26,7 +26,7 @@ export default class Code extends Mark { commands(): CommandSpec { return { code: (next, { view }) => { - toggleMark(this.schemaType)(view.state, view.dispatch) + toggleMark(this.type)(view.state, view.dispatch) next() }, } @@ -52,7 +52,7 @@ export default class Code extends Mark { .find(character) .endCapture() .endOfLine(), - this.schemaType, + this.type, ), // match before whitespace markInputRule( @@ -66,7 +66,7 @@ export default class Code extends Mark { .find(character) .endCapture() .endOfLine(), - this.schemaType, + this.type, ), ])) .flat(1) @@ -85,7 +85,7 @@ export default class Code extends Mark { .endCapture() .find(character) .endCapture(), - this.schemaType, + this.type, ), // match before whitespace markPasteRule( @@ -98,7 +98,7 @@ export default class Code extends Mark { .endCapture() .find(character) .endCapture(), - this.schemaType, + this.type, ), ])) .flat(1) diff --git a/packages/extension-italic/index.ts b/packages/extension-italic/index.ts index 8b1f4b3c..cc14d725 100644 --- a/packages/extension-italic/index.ts +++ b/packages/extension-italic/index.ts @@ -27,7 +27,7 @@ export default class Italic extends Mark { commands(): CommandSpec { return { italic: (next, { view }) => { - toggleMark(this.schemaType)(view.state, view.dispatch) + toggleMark(this.type)(view.state, view.dispatch) next() }, } @@ -53,7 +53,7 @@ export default class Italic extends Mark { .find(character) .endCapture() .endOfLine(), - this.schemaType, + this.type, ), // match before whitespace markInputRule( @@ -67,7 +67,7 @@ export default class Italic extends Mark { .find(character) .endCapture() .endOfLine(), - this.schemaType, + this.type, ), ])) .flat(1) @@ -86,7 +86,7 @@ export default class Italic extends Mark { .endCapture() .find(character) .endCapture(), - this.schemaType, + this.type, ), // match before whitespace markPasteRule( @@ -99,7 +99,7 @@ export default class Italic extends Mark { .endCapture() .find(character) .endCapture(), - this.schemaType, + this.type, ), ])) .flat(1)