mirror of https://github.com/status-im/codimd.git
Promisify getStatusBarTemplate method
This commit is contained in:
parent
af5ef52f4b
commit
46ed658d8b
|
@ -131,18 +131,19 @@ export default class Editor {
|
|||
})
|
||||
}
|
||||
|
||||
getStatusBarTemplate (callback) {
|
||||
$.get(window.serverurl + '/views/statusbar.html', template => {
|
||||
getStatusBarTemplate () {
|
||||
return new Promise((resolve, reject) => {
|
||||
$.get(window.serverurl + '/views/statusbar.html').done(template => {
|
||||
this.statusBarTemplate = template
|
||||
if (callback) callback()
|
||||
resolve()
|
||||
}).fail(reject)
|
||||
})
|
||||
}
|
||||
|
||||
addStatusBar () {
|
||||
if (!this.statusBarTemplate) {
|
||||
this.getStatusBarTemplate(this.addStatusBar)
|
||||
return
|
||||
}
|
||||
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')
|
||||
|
@ -164,6 +165,7 @@ export default class Editor {
|
|||
this.setSpellcheck()
|
||||
this.setPreferences()
|
||||
}
|
||||
}
|
||||
|
||||
setIndent () {
|
||||
var cookieIndentType = Cookies.get('indent_type')
|
||||
|
|
Loading…
Reference in New Issue