update: plugin options type

This commit is contained in:
yanmao 2021-12-29 02:39:21 +08:00
parent 1c501e3267
commit c02f1685c3
15 changed files with 35 additions and 15 deletions

View File

@ -47,7 +47,9 @@ const defaultConfig = (editor: EditorInterface): Config => {
];
};
class ToolbarPlugin<T extends ToolbarOptions> extends Plugin<T> {
class ToolbarPlugin<
T extends ToolbarOptions = ToolbarOptions,
> extends Plugin<T> {
static get pluginName() {
return 'toolbar';
}

View File

@ -40,7 +40,9 @@ const MODE_ALIAS = {
'c++': 'cpp',
};
export default class<T extends CodeBlockOptions> extends Plugin<T> {
export default class<
T extends CodeBlockOptions = CodeBlockOptions,
> extends Plugin<T> {
static get pluginName() {
return 'codeblock';
}

View File

@ -22,7 +22,7 @@ export interface EmbedOptions extends PluginOptions {
renderBefore?: EmbedRenderBeforeEvent;
}
class Embed<T extends EmbedOptions> extends Plugin<T> {
class Embed<T extends EmbedOptions = EmbedOptions> extends Plugin<T> {
static get pluginName() {
return 'embed';
}

View File

@ -76,7 +76,9 @@ export interface FileUploaderOptions extends PluginOptions {
};
}
export default class<T extends FileUploaderOptions> extends Plugin<T> {
export default class<
T extends FileUploaderOptions = FileUploaderOptions,
> extends Plugin<T> {
private cardComponents: { [key: string]: FileComponent<FileValue> } = {};
static get pluginName() {

View File

@ -14,7 +14,7 @@ export interface HrOptions extends PluginOptions {
hotkey?: string | Array<string>;
markdown?: boolean;
}
export default class<T extends HrOptions> extends Plugin<T> {
export default class<T extends HrOptions = HrOptions> extends Plugin<T> {
static get pluginName() {
return 'hr';
}

View File

@ -122,7 +122,9 @@ export interface ImageUploaderOptions extends PluginOptions {
isRemote?: (src: string) => boolean;
}
export default class<T extends ImageUploaderOptions> extends Plugin<T> {
export default class<
T extends ImageUploaderOptions = ImageUploaderOptions,
> extends Plugin<T> {
private cardComponents: { [key: string]: ImageComponent<ImageValue> } = {};
private loadCounts: { [key: string]: number } = {};

View File

@ -11,7 +11,9 @@ export interface LineHeightOptions extends PluginOptions {
filter?: (lineHeight: string) => string | boolean;
}
export default class<T extends LineHeightOptions> extends Plugin<T> {
export default class<
T extends LineHeightOptions = LineHeightOptions,
> extends Plugin<T> {
static get pluginName() {
return 'line-height';
}

View File

@ -73,7 +73,9 @@ export interface MentionOptions extends PluginOptions {
};
}
class MentionPlugin<T extends MentionOptions> extends Plugin<T> {
class MentionPlugin<
T extends MentionOptions = MentionOptions,
> extends Plugin<T> {
#request?: AjaxInterface;
static get pluginName() {
return 'mention';

View File

@ -21,7 +21,9 @@ export interface PaintformatOptions extends PluginOptions {
const PAINTFORMAT_CLASS = 'data-paintformat-mode';
export default class<T extends PaintformatOptions> extends Plugin<T> {
export default class<
T extends PaintformatOptions = PaintformatOptions,
> extends Plugin<T> {
private activeMarks?: NodeInterface[];
private activeBlocks?: NodeInterface[];
private type?: string;

View File

@ -3,7 +3,7 @@ import { isEngine, Plugin, PluginOptions } from '@aomao/engine';
export interface RedoOptions extends PluginOptions {
hotkey?: string | Array<string>;
}
export default class<T extends RedoOptions> extends Plugin<T> {
export default class<T extends RedoOptions = RedoOptions> extends Plugin<T> {
static get pluginName() {
return 'redo';
}

View File

@ -3,7 +3,9 @@ import { isEngine, Plugin, PluginOptions } from '@aomao/engine';
export interface RemoveformatOptions extends PluginOptions {
hotkey?: string | Array<string>;
}
export default class<T extends RemoveformatOptions> extends Plugin<T> {
export default class<
T extends RemoveformatOptions = RemoveformatOptions,
> extends Plugin<T> {
static get pluginName() {
return 'removeformat';
}

View File

@ -7,7 +7,9 @@ import {
export interface SelectAllOptions extends PluginOptions {}
export default class<T extends SelectAllOptions> extends Plugin<T> {
export default class<
T extends SelectAllOptions = SelectAllOptions,
> extends Plugin<T> {
static get pluginName() {
return 'selectall';
}

View File

@ -27,7 +27,7 @@ export interface TableOptions extends PluginOptions {
markdown?: boolean;
}
class Table<T extends TableOptions> extends Plugin<T> {
class Table<T extends TableOptions = TableOptions> extends Plugin<T> {
static get pluginName() {
return 'table';
}

View File

@ -3,7 +3,7 @@ import { isEngine, Plugin, PluginOptions } from '@aomao/engine';
export interface UndoOptions extends PluginOptions {
hotkey?: string | Array<string>;
}
export default class<T extends UndoOptions> extends Plugin<T> {
export default class<T extends UndoOptions = UndoOptions> extends Plugin<T> {
static get pluginName() {
return 'undo';
}

View File

@ -99,7 +99,9 @@ export interface VideoUploaderOptions extends PluginOptions {
};
}
export default class<T extends VideoUploaderOptions> extends Plugin<T> {
export default class<
T extends VideoUploaderOptions = VideoUploaderOptions,
> extends Plugin<T> {
private cardComponents: { [key: string]: VideoComponent<VideoValue> } = {};
static get pluginName() {