Created
September 25, 2017 15:27
-
-
Save ADTC/f1816435b039d03bdbb4005d5fad1701 to your computer and use it in GitHub Desktop.
Adding a Save button in Atom Status Bar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install the 'reload-button' package. | |
Open it and click View Code. | |
Open the reload-button-view.js file and update the code. | |
Save file and relaunch Atom. | |
Note: There is no save icon in Octicons, so I settled for another one. | |
Diff is included for the curious. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- reload-button package | |
+++ modified to Save file | |
@@ -1,13 +1,15 @@ | |
'use babel'; | |
export default class ReloadButtonView { | |
constructor(statusBar) { | |
this.element = document.createElement('a'); | |
- this.element.classList.add('icon', 'icon-sync'); | |
+ this.element.classList.add('icon', 'icon-checklist'); | |
+ this.element.title = "Save file in active editor"; | |
+ atom.tooltips.add(this.element, ""); | |
this.element.addEventListener('click', this.onClick); | |
this.statusBarTile = statusBar.addRightTile({ item: this.element, priority: 1000 }); | |
} | |
@@ -21,10 +23,10 @@ | |
this.element = null; | |
} | |
onClick(e) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
- atom.commands.dispatch(atom.views.getView(atom.workspace), 'window:reload'); | |
+ atom.commands.dispatch(atom.views.getView(atom.workspace.getActiveTextEditor()), 'core:save'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment