summaryrefslogtreecommitdiff
path: root/public/js/lib/editor
diff options
context:
space:
mode:
authorMax Wu2017-05-14 17:42:14 +0800
committerGitHub2017-05-14 17:42:14 +0800
commitc37b6669158750ab2222e81a5a8fc3a5c8c353f5 (patch)
tree8e96eb37c1715f860a698d5e7eeb2381b00af9d8 /public/js/lib/editor
parent0c619fee91ac5b7dbacf60244c9f6fec6ed62ba7 (diff)
parentf85d1d880114b6787fdb2bac488341776deaad3d (diff)
Merge branch 'master' into BackendRefactor
Diffstat (limited to '')
-rw-r--r--public/js/lib/editor/index.js55
-rw-r--r--public/js/lib/editor/statusbar.html (renamed from public/views/statusbar.html)0
2 files changed, 21 insertions, 34 deletions
diff --git a/public/js/lib/editor/index.js b/public/js/lib/editor/index.js
index c807a17f..2991998b 100644
--- a/public/js/lib/editor/index.js
+++ b/public/js/lib/editor/index.js
@@ -1,5 +1,6 @@
import * as utils from './utils'
import config from './config'
+import statusBarTemplate from './statusbar.html'
/* config section */
const isMac = CodeMirror.keyMap.default === CodeMirror.keyMap.macDefault
@@ -118,6 +119,7 @@ export default class Editor {
}
}
this.eventListeners = {}
+ this.config = config
}
on (event, cb) {
@@ -132,40 +134,27 @@ 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 () {
- if (!this.statusBarTemplate) {
- 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.statusBar = $(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()
}
updateStatusBar () {
@@ -508,8 +497,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 :)"
})
- this.getStatusBarTemplate()
-
return this.editor
}
diff --git a/public/views/statusbar.html b/public/js/lib/editor/statusbar.html
index 24cbf6c2..24cbf6c2 100644
--- a/public/views/statusbar.html
+++ b/public/js/lib/editor/statusbar.html