|
1 | 1 | import * as utils from './utils' |
2 | 2 | import config from './config' |
| 3 | +import statusBarTemplate from './statusbar.html' |
3 | 4 |
|
4 | 5 | /* config section */ |
5 | 6 | const isMac = CodeMirror.keyMap.default === CodeMirror.keyMap.macDefault |
@@ -132,40 +133,27 @@ export default class Editor { |
132 | 133 | }) |
133 | 134 | } |
134 | 135 |
|
135 | | - getStatusBarTemplate () { |
136 | | - return new Promise((resolve, reject) => { |
137 | | - $.get(window.serverurl + '/views/statusbar.html').done(template => { |
138 | | - this.statusBarTemplate = template |
139 | | - resolve() |
140 | | - }).fail(reject) |
141 | | - }) |
142 | | - } |
143 | | - |
144 | 136 | addStatusBar () { |
145 | | - if (!this.statusBarTemplate) { |
146 | | - this.getStatusBarTemplate.then(this.addStatusBar) |
147 | | - } else { |
148 | | - this.statusBar = $(this.statusBarTemplate) |
149 | | - this.statusCursor = this.statusBar.find('.status-cursor > .status-line-column') |
150 | | - this.statusSelection = this.statusBar.find('.status-cursor > .status-selection') |
151 | | - this.statusFile = this.statusBar.find('.status-file') |
152 | | - this.statusIndicators = this.statusBar.find('.status-indicators') |
153 | | - this.statusIndent = this.statusBar.find('.status-indent') |
154 | | - this.statusKeymap = this.statusBar.find('.status-keymap') |
155 | | - this.statusLength = this.statusBar.find('.status-length') |
156 | | - this.statusTheme = this.statusBar.find('.status-theme') |
157 | | - this.statusSpellcheck = this.statusBar.find('.status-spellcheck') |
158 | | - this.statusPreferences = this.statusBar.find('.status-preferences') |
159 | | - this.statusPanel = this.editor.addPanel(this.statusBar[0], { |
160 | | - position: 'bottom' |
161 | | - }) |
| 137 | + this.statusBar = $(statusBarTemplate) |
| 138 | + this.statusCursor = this.statusBar.find('.status-cursor > .status-line-column') |
| 139 | + this.statusSelection = this.statusBar.find('.status-cursor > .status-selection') |
| 140 | + this.statusFile = this.statusBar.find('.status-file') |
| 141 | + this.statusIndicators = this.statusBar.find('.status-indicators') |
| 142 | + this.statusIndent = this.statusBar.find('.status-indent') |
| 143 | + this.statusKeymap = this.statusBar.find('.status-keymap') |
| 144 | + this.statusLength = this.statusBar.find('.status-length') |
| 145 | + this.statusTheme = this.statusBar.find('.status-theme') |
| 146 | + this.statusSpellcheck = this.statusBar.find('.status-spellcheck') |
| 147 | + this.statusPreferences = this.statusBar.find('.status-preferences') |
| 148 | + this.statusPanel = this.editor.addPanel(this.statusBar[0], { |
| 149 | + position: 'bottom' |
| 150 | + }) |
162 | 151 |
|
163 | | - this.setIndent() |
164 | | - this.setKeymap() |
165 | | - this.setTheme() |
166 | | - this.setSpellcheck() |
167 | | - this.setPreferences() |
168 | | - } |
| 152 | + this.setIndent() |
| 153 | + this.setKeymap() |
| 154 | + this.setTheme() |
| 155 | + this.setSpellcheck() |
| 156 | + this.setPreferences() |
169 | 157 | } |
170 | 158 |
|
171 | 159 | updateStatusBar () { |
@@ -508,8 +496,6 @@ export default class Editor { |
508 | 496 | placeholder: "← Start by entering a title here\n===\nVisit /features if you don't know what to do.\nHappy hacking :)" |
509 | 497 | }) |
510 | 498 |
|
511 | | - this.getStatusBarTemplate() |
512 | | - |
513 | 499 | return this.editor |
514 | 500 | } |
515 | 501 |
|
|
0 commit comments