mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
editor: use dataurl attr for inserting an image
This commit is contained in:
committed by
Abdullah Atta
parent
bc433c56ae
commit
4318a65a99
@@ -390,15 +390,18 @@ function toIEditor(editor: Editor): IEditor {
|
||||
},
|
||||
attachFile: (file: Attachment) => {
|
||||
if (file.dataurl) {
|
||||
editor.current?.commands.insertImage({ ...file, src: file.dataurl });
|
||||
editor.current?.commands.insertImage({
|
||||
...file,
|
||||
dataurl: file.dataurl
|
||||
});
|
||||
} else editor.current?.commands.insertAttachment(file);
|
||||
},
|
||||
loadWebClip: (hash, src) =>
|
||||
editor.current?.commands.updateWebClip({ hash }, { src }),
|
||||
loadImage: (hash, src) =>
|
||||
loadImage: (hash, dataurl) =>
|
||||
editor.current?.commands.updateImage(
|
||||
{ hash },
|
||||
{ hash, dataurl: src, preventUpdate: true }
|
||||
{ hash, dataurl, preventUpdate: true }
|
||||
),
|
||||
sendAttachmentProgress: (hash, type, progress) =>
|
||||
editor.current?.commands.setAttachmentProgress({
|
||||
|
||||
@@ -79,7 +79,7 @@ declare module "@tiptap/core" {
|
||||
/**
|
||||
* Add an image
|
||||
*/
|
||||
insertImage: (options: ImageAttributes) => ReturnType;
|
||||
insertImage: (options: Partial<ImageAttributes>) => ReturnType;
|
||||
updateImage: (
|
||||
query: { src?: string; hash?: string },
|
||||
options: Partial<ImageAttributes> & { preventUpdate?: boolean }
|
||||
|
||||
Reference in New Issue
Block a user