We use window.confirm in the ArrayControlRenderer. Luckily window.confirm is not protected, so what you can do is to overwrite it in your webview code with arbitrary behavior, e.g. window.confirm = () => true will just disable it.
Probably nicer would be to delegate to the VS Code API and open a proper VS Code message box with the same question as handed over to window.confirm.
And yes, I agree with you that delegating the origin call to a VSCode message box would be nice. I guess than we should wrap our confirm call into a generic function. Maybe something like
Technically there is no need for a special wrapping. As you can overwrite window.confirm with arbitrary content you can do whatever you like within it.
The problem you are facing however is that the renderer code expects a synchronous call. As the call to the vscode api necessarily involves async messaging, you can’t really call the VS Code API right now. So the change needed in the renderer is to actually await the result of window.confirm, so that it’s possible to hand in async methods. Of course if we do changes there anyway we can also add the wrapping to make it a bit cleaner.
Alternatively to the VS Code API you could implement an own modal in your web view which does not rely on window.confirm and offers a synchronous API.
Hi @sdirix
ok, understood. Currently this is no important issue to me - disabling the confirm is fine for me.
If I find some time I will try this out by adding the logic into my web view. I will post my results here.