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

feature-save-file #92

Merged
merged 6 commits into from
Jan 29, 2024
Merged

feature-save-file #92

merged 6 commits into from
Jan 29, 2024

Conversation

hrgdavor
Copy link
Owner

@hrgdavor hrgdavor commented Jan 26, 2024

demo: https://3d.hrg.hr/jscad/save/

like mentioned in #88 (comment)

feature to allow ctrl+s to save file from editors

basic flow is initally implemented for solo script in the editor,

  • first save opens dialog
  • subsequent save saves into the same file

more to do

  • change internal file name to the file name that dropped (single file)
  • dropped (single file) without save dialog
  • provide file name proposal
  • reset reference to file name after new script is loaded examples or other source
  • reset file entry list when example loaded after folder loaded
  • use file handle from drag and drop to save the same file
  • change internal file name to the file name that was selected

not caused here

  • refresh editor when file is changed on disk (change is seen in render result, but not in editor source)
bandicam.2024-01-27.15-32-50-775.mp4

@hrgdavor hrgdavor mentioned this pull request Jan 26, 2024
@hrgdavor hrgdavor changed the title WIP: feature-save-file feature-save-file Jan 27, 2024
Copy link
Collaborator

@platypii platypii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is VERY COOL! This is a huge improvement to the user workflow when starting a new JSCAD project.

I did find a bug though:

  • Save a file from the browser, then edit the FILE locally. The code editor in the browser does not update.

@hrgdavor
Copy link
Owner Author

  • Save a file from the browser, then edit the FILE locally. The code editor in the browser does not update.

ok, this is also fixed.

I am merging this as it seems to work ok.

currently file handling is done with mixed usage of old https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API and new https://developer.mozilla.org/en-US/docs/Web/API/File_System_API

I will open a new branch to refactor and see if drag drop and this save showSaveFilePicker can all be done using the new File_System_API

@hrgdavor hrgdavor merged commit 02f8612 into main Jan 29, 2024
1 check passed
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.

2 participants