Skip to content

Commit 5ee7853

Browse files
fdamhautrrahir
authored andcommitted
[IMP] clipboard: throw error when selection is too large
closes #8065 Task: 5993244 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
1 parent b512864 commit 5ee7853

File tree

1 file changed

+12
-2
lines changed
  • packages/o-spreadsheet-engine/src/plugins/ui_stateful

1 file changed

+12
-2
lines changed

packages/o-spreadsheet-engine/src/plugins/ui_stateful/clipboard.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,19 @@ export class ClipboardPlugin extends UIPlugin {
520520
const file = await this.getImageContent();
521521
const mime = file?.type;
522522
const content: OSClipboardContent = {
523-
[ClipboardMIMEType.PlainText]: this.getPlainTextContent(),
524-
[ClipboardMIMEType.Html]: await this.getHTMLContent(),
523+
[ClipboardMIMEType.PlainText]: "",
524+
[ClipboardMIMEType.Html]: "",
525525
};
526+
try {
527+
content[ClipboardMIMEType.PlainText] = this.getPlainTextContent();
528+
content[ClipboardMIMEType.Html] = await this.getHTMLContent();
529+
} catch (error) {
530+
this.ui.notifyUI({
531+
type: "danger",
532+
text: "Your selection was too large for the browser to copy it.\nPlease select a smaller zone.",
533+
sticky: true,
534+
});
535+
}
526536
if (mime && file) {
527537
content[mime] = file;
528538
}

0 commit comments

Comments
 (0)