From 08d8b40934d9aa0c203806f0abe62b93c1b527b4 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Thu, 14 Sep 2023 13:21:15 +0100 Subject: [PATCH] [visual] Ignore files on the clipboard if the pasted HTML contains a table (#14817) GitOrigin-RevId: 608a7a7cbe884243268322582873496bcde63305 --- .../source-editor/extensions/visual/paste-html.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/services/web/frontend/js/features/source-editor/extensions/visual/paste-html.ts b/services/web/frontend/js/features/source-editor/extensions/visual/paste-html.ts index ac75d867e4..3de879304f 100644 --- a/services/web/frontend/js/features/source-editor/extensions/visual/paste-html.ts +++ b/services/web/frontend/js/features/source-editor/extensions/visual/paste-html.ts @@ -16,11 +16,6 @@ export const pasteHtml = [ return false } - // allow pasting an image to create a figure - if (clipboardData.files.length > 0) { - return false - } - // only handle pasted HTML if (!clipboardData.types.includes('text/html')) { return false @@ -41,6 +36,12 @@ export const pasteHtml = [ return false } + // allow pasting an image to create a figure, if the HTML doesn't contain a table + // (because desktop Excel puts both an image and the HTML table on the clipboard) + if (clipboardData.files.length > 0 && !html.includes('