Load statusbar template by string-loader
This commit is contained in:
parent
5343a61ae9
commit
db06a51299
5 changed files with 29 additions and 35 deletions
|
@ -162,8 +162,9 @@
|
||||||
"less-loader": "^2.2.3",
|
"less-loader": "^2.2.3",
|
||||||
"optimize-css-assets-webpack-plugin": "^1.3.0",
|
"optimize-css-assets-webpack-plugin": "^1.3.0",
|
||||||
"script-loader": "^0.7.0",
|
"script-loader": "^0.7.0",
|
||||||
"style-loader": "^0.13.1",
|
|
||||||
"standard": "^9.0.1",
|
"standard": "^9.0.1",
|
||||||
|
"string-loader": "^0.0.1",
|
||||||
|
"style-loader": "^0.13.1",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"webpack": "^1.14.0",
|
"webpack": "^1.14.0",
|
||||||
"webpack-parallel-uglify-plugin": "^0.2.0"
|
"webpack-parallel-uglify-plugin": "^0.2.0"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import * as utils from './utils'
|
import * as utils from './utils'
|
||||||
import config from './config'
|
import config from './config'
|
||||||
|
import statusBarTemplate from './statusbar.html'
|
||||||
|
|
||||||
/* config section */
|
/* config section */
|
||||||
const isMac = CodeMirror.keyMap.default === CodeMirror.keyMap.macDefault
|
const isMac = CodeMirror.keyMap.default === CodeMirror.keyMap.macDefault
|
||||||
|
@ -132,20 +133,8 @@ export default class Editor {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
getStatusBarTemplate () {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
$.get(window.serverurl + '/views/statusbar.html').done(template => {
|
|
||||||
this.statusBarTemplate = template
|
|
||||||
resolve()
|
|
||||||
}).fail(reject)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
addStatusBar () {
|
addStatusBar () {
|
||||||
if (!this.statusBarTemplate) {
|
this.statusBar = $(statusBarTemplate)
|
||||||
this.getStatusBarTemplate.then(this.addStatusBar)
|
|
||||||
} else {
|
|
||||||
this.statusBar = $(this.statusBarTemplate)
|
|
||||||
this.statusCursor = this.statusBar.find('.status-cursor > .status-line-column')
|
this.statusCursor = this.statusBar.find('.status-cursor > .status-line-column')
|
||||||
this.statusSelection = this.statusBar.find('.status-cursor > .status-selection')
|
this.statusSelection = this.statusBar.find('.status-cursor > .status-selection')
|
||||||
this.statusFile = this.statusBar.find('.status-file')
|
this.statusFile = this.statusBar.find('.status-file')
|
||||||
|
@ -166,7 +155,6 @@ export default class Editor {
|
||||||
this.setSpellcheck()
|
this.setSpellcheck()
|
||||||
this.setPreferences()
|
this.setPreferences()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
updateStatusBar () {
|
updateStatusBar () {
|
||||||
if (!this.statusBar) return
|
if (!this.statusBar) return
|
||||||
|
@ -508,8 +496,6 @@ export default class Editor {
|
||||||
placeholder: "← Start by entering a title here\n===\nVisit /features if you don't know what to do.\nHappy hacking :)"
|
placeholder: "← Start by entering a title here\n===\nVisit /features if you don't know what to do.\nHappy hacking :)"
|
||||||
})
|
})
|
||||||
|
|
||||||
this.getStatusBarTemplate()
|
|
||||||
|
|
||||||
return this.editor
|
return this.editor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -412,6 +412,9 @@ module.exports = {
|
||||||
}, {
|
}, {
|
||||||
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
loader: 'file'
|
loader: 'file'
|
||||||
|
}, {
|
||||||
|
test: /\.html$/,
|
||||||
|
loader: 'string'
|
||||||
}, {
|
}, {
|
||||||
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
|
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
|
||||||
loader: 'url?prefix=font/&limit=5000'
|
loader: 'url?prefix=font/&limit=5000'
|
||||||
|
|
|
@ -6529,6 +6529,10 @@ strict-uri-encode@^1.0.0:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
|
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
|
||||||
|
|
||||||
|
string-loader@^0.0.1:
|
||||||
|
version "0.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/string-loader/-/string-loader-0.0.1.tgz#496f3cccc990213e0dd5411499f9ac6a6a6f2ff8"
|
||||||
|
|
||||||
string-natural-compare@^2.0.2:
|
string-natural-compare@^2.0.2:
|
||||||
version "2.0.2"
|
version "2.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-2.0.2.tgz#c5ce4e278ab5d1265ae6fc55435aeb7b76fcb001"
|
resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-2.0.2.tgz#c5ce4e278ab5d1265ae6fc55435aeb7b76fcb001"
|
||||||
|
|
Loading…
Reference in a new issue