Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix file dialog in text editor example #215

Merged
merged 4 commits into from
Sep 22, 2023

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Sep 22, 2023

Closes #213. This can be the equivalent for the C example to the go fix webui-dev/go-webui#13 (comment).

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.

  • uniform quote usage
  • naming closer to conventions
  • add event only to relevant element

@ttytm ttytm force-pushed the example/text-editor-dialog-fix branch from 5086872 to f049e5f Compare September 22, 2023 01:47
@ttytm ttytm marked this pull request as draft September 22, 2023 02:25
uniform quote usage
naming closer to conventions
add event only to relevant element
@ttytm ttytm force-pushed the example/text-editor-dialog-fix branch 2 times, most recently from 0d06ee1 to 765d4f2 Compare September 22, 2023 16:13
@ttytm ttytm force-pushed the example/text-editor-dialog-fix branch from 765d4f2 to 6059a19 Compare September 22, 2023 16:28
@ttytm
Copy link
Member Author

ttytm commented Sep 22, 2023

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.

@ttytm ttytm marked this pull request as ready for review September 22, 2023 16:36
@ttytm ttytm force-pushed the example/text-editor-dialog-fix branch 2 times, most recently from 6ac629b to 5bd69ed Compare September 22, 2023 16:43
@ttytm ttytm force-pushed the example/text-editor-dialog-fix branch from 5bd69ed to 5a6df39 Compare September 22, 2023 16:44
@ttytm ttytm requested a review from hassandraga September 22, 2023 16:45
@hassandraga
Copy link
Member

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.

@ttytm ttytm merged commit e06d972 into webui-dev:main Sep 22, 2023
@ttytm ttytm deleted the example/text-editor-dialog-fix branch September 28, 2023 23:09
@mountfx
Copy link

mountfx commented Mar 29, 2024

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
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text editor example is crashing on macos
4 participants