Skip to content

Commit

Permalink
Tiptap: prevents pasted HTML fragments
Browse files Browse the repository at this point in the history
containing images, being uploaded to the server.
  • Loading branch information
leekelleher authored and iOvergaard committed Nov 12, 2024
1 parent e38f6e8 commit 5032a78
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ export default class UmbTiptapMediaUploadExtensionApi extends UmbTiptapExtension
});

host.addEventListener('paste', (event) => {
const htmlContent = event.clipboardData?.getData('text/html');
if (htmlContent) {
// If there is HTML content, exit early to prevent uploading the remote file(s).
return;
}

const files = event.clipboardData?.files;
if (!files) return;

Expand Down

0 comments on commit 5032a78

Please sign in to comment.