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

Add autosave toggle to fallback Editor component #4830

Merged
merged 17 commits into from
May 6, 2024
Merged

Conversation

ericpgreen2
Copy link
Contributor

@ericpgreen2 ericpgreen2 commented May 6, 2024

This PR takes a few steps forward in refactoring the Editor components (#4688). This PR brings the fallback Editor more into parity with the other editors (YAMLEditor, ModelEditor), so that we can ultimately use this Editor as the one canonical editor, regardless of file/resource type.

Specifically, this PR:

  • Adds the autosave toggle to the fallback Editor
  • Hides the "autosave" toggle for rill.yaml and .env files (given edits to these files can trigger source re-ingestion)
  • Moves the debounce logic into the Editor component, so the "autosave" is debounced but explicit save actions (the "Save" button; CMD + s) are not.
  • Adds the gray wrapper/padding to the fallback Editor
  • Aligns terminology across the different editors

@ericpgreen2 ericpgreen2 self-assigned this May 6, 2024
@ericpgreen2 ericpgreen2 marked this pull request as ready for review May 6, 2024 18:29
@ericpgreen2 ericpgreen2 merged commit 2ec9c2d into main May 6, 2024
4 checks passed
@ericpgreen2 ericpgreen2 deleted the editor-cleanups branch May 6, 2024 22:53
ericpgreen2 added a commit that referenced this pull request May 16, 2024
* Remove unused `focusOnMount`

* Rename to `ModelEditor`

* `update` -> `save`

* Add autosave toggle to fallback editor

* Remember autosave selection

* Add confirmation before leaving unsaved file

* Move debounce logic into `Editor`

* Hide autosave for `rill.yaml` and `.env` files

* Add unsaved-changes indicator to file header

* Move debounce constant to `editor/config.ts`

* Fix unit test

* Initialize `autosave` to `false` for `rill.yaml` and `.env`

* Re-org props

* Handle "Revert changes"

* Remove comment

* Review
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