summaryrefslogtreecommitdiff
path: root/public/js/lib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--public/js/lib/editor/index.js54
1 files changed, 28 insertions, 26 deletions
diff --git a/public/js/lib/editor/index.js b/public/js/lib/editor/index.js
index 6eec34ad..a68092ff 100644
--- a/public/js/lib/editor/index.js
+++ b/public/js/lib/editor/index.js
@@ -131,38 +131,40 @@ export default class Editor {
})
}
- getStatusBarTemplate (callback) {
- $.get(window.serverurl + '/views/statusbar.html', template => {
- this.statusBarTemplate = template
- if (callback) callback()
+ getStatusBarTemplate () {
+ return new Promise((resolve, reject) => {
+ $.get(window.serverurl + '/views/statusbar.html').done(template => {
+ this.statusBarTemplate = template
+ resolve()
+ }).fail(reject)
})
}
addStatusBar () {
if (!this.statusBarTemplate) {
- this.getStatusBarTemplate(this.addStatusBar)
- return
- }
- this.statusBar = $(this.statusBarTemplate)
- this.statusCursor = this.statusBar.find('.status-cursor > .status-line-column')
- this.statusSelection = this.statusBar.find('.status-cursor > .status-selection')
- this.statusFile = this.statusBar.find('.status-file')
- this.statusIndicators = this.statusBar.find('.status-indicators')
- this.statusIndent = this.statusBar.find('.status-indent')
- this.statusKeymap = this.statusBar.find('.status-keymap')
- this.statusLength = this.statusBar.find('.status-length')
- this.statusTheme = this.statusBar.find('.status-theme')
- this.statusSpellcheck = this.statusBar.find('.status-spellcheck')
- this.statusPreferences = this.statusBar.find('.status-preferences')
- this.statusPanel = this.editor.addPanel(this.statusBar[0], {
- position: 'bottom'
- })
+ this.getStatusBarTemplate.then(this.addStatusBar)
+ } else {
+ this.statusBar = $(this.statusBarTemplate)
+ this.statusCursor = this.statusBar.find('.status-cursor > .status-line-column')
+ this.statusSelection = this.statusBar.find('.status-cursor > .status-selection')
+ this.statusFile = this.statusBar.find('.status-file')
+ this.statusIndicators = this.statusBar.find('.status-indicators')
+ this.statusIndent = this.statusBar.find('.status-indent')
+ this.statusKeymap = this.statusBar.find('.status-keymap')
+ this.statusLength = this.statusBar.find('.status-length')
+ this.statusTheme = this.statusBar.find('.status-theme')
+ this.statusSpellcheck = this.statusBar.find('.status-spellcheck')
+ this.statusPreferences = this.statusBar.find('.status-preferences')
+ this.statusPanel = this.editor.addPanel(this.statusBar[0], {
+ position: 'bottom'
+ })
- this.setIndent()
- this.setKeymap()
- this.setTheme()
- this.setSpellcheck()
- this.setPreferences()
+ this.setIndent()
+ this.setKeymap()
+ this.setTheme()
+ this.setSpellcheck()
+ this.setPreferences()
+ }
}
setIndent () {