From 0d10face505f624c01d775e7c3caa2ac820afc6e Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Thu, 13 Jul 2023 05:06:22 +0800 Subject: [PATCH] Fix copyToClipboard function (#3762) * Revert "Bump prettier from 2.8.8 to 3.0.0 (#3758)" This reverts commit f77ae6da165df3ec11cf226631f0e589484f5923. * ! Fix function optioinal option argument declaration --- src/renderer/helpers/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderer/helpers/utils.js b/src/renderer/helpers/utils.js index 82ac772a64995..239e3b98b7de3 100644 --- a/src/renderer/helpers/utils.js +++ b/src/renderer/helpers/utils.js @@ -197,10 +197,10 @@ export function showToast(message, time = null, action = null) { * a toast with the error is shown. If the copy is successful and * there is a success message, a toast with that message is shown. * @param {string} content the content to be copied to the clipboard - * @param {string} messageOnSuccess the message to be displayed as a toast when the copy succeeds (optional) - * @param {string} messageOnError the message to be displayed as a toast when the copy fails (optional) + * @param {null|string} messageOnSuccess the message to be displayed as a toast when the copy succeeds (optional) + * @param {null|string} messageOnError the message to be displayed as a toast when the copy fails (optional) */ -export async function copyToClipboard(content, { messageOnSuccess = null, messageOnError = null }) { +export async function copyToClipboard(content, { messageOnSuccess = null, messageOnError = null } = {}) { if (navigator.clipboard !== undefined && window.isSecureContext) { try { await navigator.clipboard.writeText(content)