fix(dialog): browser confirm fails with command not found (#3665)

This commit is contained in:
Tony authored and GitHub committed 2026-10-08 16:11:16 +08:00
1 parent 7eb8246d47
commit 848957565b
3 files changed
+13 -4

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
---
dialog: patch
dialog-js: patch
---
Fix browser `confirm` fails with `Uncaught dialog.confirm not allowed. Command not found`
+6 -3
View File
@@ -19,7 +19,10 @@ window.alert = function (message: string) {
// @ts-expect-error tauri does not have sync IPC :(
window.confirm = async function (message: string) {
return await invoke('plugin:dialog|confirm', {
message: message.toString()
})
return (
(await invoke<string>('plugin:dialog|message', {
message: message.toString(),
buttons: 'OkCancel'
})) === 'Ok'
)
}
+1 -1
View File
@@ -1 +1 @@
!function(){"use strict";async function n(n,i={},o){return window.__TAURI_INTERNALS__.invoke(n,i,o)}"function"==typeof SuppressedError&&SuppressedError,window.alert=function(i){n("plugin:dialog|message",{message:i.toString()})},window.confirm=async function(i){return await n("plugin:dialog|confirm",{message:i.toString()})}}();
!function(){"use strict";async function n(n,e={},i){return window.__TAURI_INTERNALS__.invoke(n,e,i)}"function"==typeof SuppressedError&&SuppressedError,window.alert=function(e){n("plugin:dialog|message",{message:e.toString()})},window.confirm=async function(e){return"Ok"===await n("plugin:dialog|message",{message:e.toString(),buttons:"OkCancel"})}}();