tiptap: fix type

This commit is contained in:
fantasticit 2022-06-05 00:03:20 +08:00
parent a589db9978
commit 7e46e7ba65
3 changed files with 2 additions and 4 deletions

View File

@ -7,7 +7,7 @@ const resolveImageEl = (element) => (element.nodeName === 'IMG' ? element : elem
declare module '@tiptap/core' { declare module '@tiptap/core' {
interface Commands<ReturnType> { interface Commands<ReturnType> {
iamge: { iamge: {
setEmptyImage: () => ReturnType; setEmptyImage: (arg: { width?: number | string }) => ReturnType;
}; };
} }
} }

View File

@ -11,7 +11,7 @@ const DEFAULT_MIND_DATA = {
}; };
export interface IMindAttrs { export interface IMindAttrs {
width?: number; width?: number | string;
height?: number; height?: number;
data?: Record<string, unknown>; data?: Record<string, unknown>;
template?: string; template?: string;

View File

@ -91,7 +91,6 @@ export const COMMANDS: ICommand[] = [
{ {
icon: <IconImage />, icon: <IconImage />,
label: '图片', label: '图片',
// @ts-ignore
action: (editor) => editor.chain().focus().setEmptyImage({ width: '100%' }).run(), action: (editor) => editor.chain().focus().setEmptyImage({ width: '100%' }).run(),
}, },
{ {
@ -123,7 +122,6 @@ export const COMMANDS: ICommand[] = [
icon: <IconMind />, icon: <IconMind />,
label: '思维导图', label: '思维导图',
action: (editor) => { action: (editor) => {
// @ts-ignore
editor.chain().focus().setMind({ width: '100%' }).run(); editor.chain().focus().setMind({ width: '100%' }).run();
}, },
}, },