diff --git a/src/app/hooks/useFilePasteHandler.ts b/src/app/hooks/useFilePasteHandler.ts index 867262f49..bb3e07428 100644 --- a/src/app/hooks/useFilePasteHandler.ts +++ b/src/app/hooks/useFilePasteHandler.ts @@ -5,7 +5,14 @@ export const useFilePasteHandler = (onPaste: (file: File[]) => void): ClipboardE useCallback( (evt) => { const files = getDataTransferFiles(evt.clipboardData); - if (files) onPaste(files); + if (files) { + // [Gitea #132] An image copied from a web page arrives with a + // text/html `…` fragment and a text/plain URL beside + // the bitmap. Only the file is wanted — stop the editor's own + // HTML/text insertion so nothing else lands in the composer. + evt.preventDefault(); + onPaste(files); + } }, [onPaste], );