Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Do not hijack core:save-as #521

Merged
merged 2 commits into from
Jan 8, 2018
Merged

Do not hijack core:save-as #521

merged 2 commits into from
Jan 8, 2018

Conversation

winstliu
Copy link
Contributor

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

Instead of hijacking core:save-as and making it do what we want, instead use the public pane.saveItemAs method combined with item.getSaveDialogOptions to set the filepath we want. Essentially, it delegates the save dialog and error handling to Atom core and only handles saving the file itself once the filepath has been chosen.

Alternate Designs

Keep atom.showSaveDialog[Sync] in Atom core.

Benefits

Less custom logic for how to save a file as HTML.

Possible Drawbacks

I've added a notification to warn when the file can't be saved due to the Markdown still loading. Unfortunately, it will appear after the save dialog finishes. I think this is still better than what we had before, which was no feedback.

Applicable Issues

Refs atom/atom#16245

@winstliu winstliu merged commit 0feb1ab into master Jan 8, 2018
@winstliu winstliu deleted the wl-use-pane-save-item-as branch January 8, 2018 01:41
winstliu referenced this pull request in atom-community/markdown-preview-plus Feb 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant