webui-dev / webui

Use any web browser or WebView as GUI, with your preferred language in the backend and modern web technologies in the frontend, all in a lightweight portable library.
https://webui.me
MIT License
2.9k stars 164 forks source link

Fix file dialog in text editor example #215

Closed ttytm closed 11 months ago

ttytm commented 11 months ago

Closes #213. This can be the equivalent for the C example to the go fix https://github.com/webui-dev/go-webui/pull/13#issuecomment-1730579571.

The fix in commit No. 1.

Commit No.2 includes a cleanup to the ui.js of the editor (mainly things a linter or formatter would complain about). E.g.

ttytm commented 11 months ago

Since ChromiumBased is already implemented it's easier to finish the C example for cross-browser compatibility first.

The cross browser solution preferres chromium based browsers and if none is available and another browsers like Firefox is used. A small workaround was implemented to ensure the editor still works in such a case.

With the workaround, the input file dialog works just as it does with for chromium browsers. Just saving a file behaves a little different for Firefox. Pressing the save button will trigger the download function for the file that is edited. It works in regard to the Firefox user setting Ask where to save files. If it is enabled a dialog for saving the file would be triggered.

hassandraga commented 11 months ago

It's fine for two reasons, first, the majority of users are using one of the chromium based one. Second reason, Firefox may work fine when we implement TLS/SSL.

mountfx commented 5 months ago

Sorry for commenting on an already closed PR, but I just ran into the same issue. I intended on using the nativefiledialog c library to spawn an open-file-dialog which I wanted to trigger from the frontend. I got the same error message as in #213 . Is there a way to avoid the error without the need to access the file system directly through JS (because that is quite limiting in capabilities)?

AlbertShown commented 5 months ago

@mountfx Can you please open a new issue, share the logs, crash message, and the language/wrapper you are using, and the OS, this will help us to quickly identify the issue.