paste: when the clipboard carries files, never let the HTML/URL fragment into the composer (#132)
Verified headless that pasting an image copied from a web page (bitmap + text/html <img src alt> + text/plain URL) already produced only the upload card and an empty composer; make that explicit with a preventDefault so a future editor change can't regress it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
@@ -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 `<img src=… alt=…>` 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],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user