mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
editor: add support for ignoring edits
This commit is contained in:
committed by
Abdullah Atta
parent
270e6778d1
commit
081201aa42
@@ -44,6 +44,7 @@ declare module "@tiptap/core" {
|
||||
attachment: Partial<Attachment>,
|
||||
options: {
|
||||
preventUpdate?: boolean;
|
||||
ignoreEdit?: boolean;
|
||||
query: (attachment: Attachment) => boolean;
|
||||
}
|
||||
) => ReturnType;
|
||||
@@ -169,6 +170,7 @@ export const AttachmentNode = Node.create<AttachmentOptions>({
|
||||
});
|
||||
}
|
||||
tr.setMeta("preventUpdate", options.preventUpdate || false);
|
||||
tr.setMeta("ignoreEdit", options.ignoreEdit || false);
|
||||
tr.setMeta("addToHistory", false);
|
||||
if (dispatch) dispatch(tr);
|
||||
return true;
|
||||
|
||||
@@ -296,13 +296,14 @@ export function ImageComponent(
|
||||
...fixedDimensions,
|
||||
aspectRatio: naturalAspectRatio
|
||||
},
|
||||
{ query: makeImageQuery(src, hash) }
|
||||
{ query: makeImageQuery(src, hash), ignoreEdit: true }
|
||||
)
|
||||
);
|
||||
} else if (height !== fixedDimensions.height) {
|
||||
await editor.threadsafe((editor) =>
|
||||
editor.commands.updateAttachment(fixedDimensions, {
|
||||
query: makeImageQuery(src, hash)
|
||||
query: makeImageQuery(src, hash),
|
||||
ignoreEdit: true
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user