fix: move options back to UmbImage element to ensure everything is available when the editor loads
This commit is contained in:
@@ -20,6 +20,8 @@ export const UmbImage = Image.extend({
|
||||
sizes: {
|
||||
default: null,
|
||||
},
|
||||
'data-tmpimg': { default: null },
|
||||
'data-udi': { default: null },
|
||||
};
|
||||
},
|
||||
});
|
||||
@@ -44,6 +46,7 @@ declare module '@tiptap/core' {
|
||||
loading?: string;
|
||||
srcset?: string;
|
||||
sizes?: string;
|
||||
'data-tmpimg'?: string;
|
||||
}) => ReturnType;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -50,12 +50,6 @@ export default class UmbTiptapMediaUploadExtension extends UmbTiptapExtensionApi
|
||||
return [
|
||||
UmbImage.extend({
|
||||
name: 'umbMediaUpload',
|
||||
addAttributes() {
|
||||
return {
|
||||
...this.parent?.(),
|
||||
'data-tmpimg': { default: null },
|
||||
};
|
||||
},
|
||||
onCreate() {
|
||||
this.parent?.();
|
||||
const host = this.editor.view.dom;
|
||||
@@ -167,29 +161,3 @@ export default class UmbTiptapMediaUploadExtension extends UmbTiptapExtensionApi
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands<ReturnType> {
|
||||
umbMediaUpload: {
|
||||
/**
|
||||
* Add an image
|
||||
* @param options The image attributes
|
||||
* @example
|
||||
* editor
|
||||
* .commands
|
||||
* .setImage({ src: 'https://tiptap.dev/logo.png', alt: 'tiptap', title: 'tiptap logo' })
|
||||
*/
|
||||
setImage: (options: {
|
||||
src: string;
|
||||
alt?: string;
|
||||
title?: string;
|
||||
width?: string;
|
||||
height?: string;
|
||||
loading?: string;
|
||||
srcset?: string;
|
||||
sizes?: string;
|
||||
'data-tmpimg'?: string;
|
||||
}) => ReturnType;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user