mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
Move updateStatusBar method into editor class
This commit is contained in:
parent
df743ab902
commit
f5b95c5d36
3 changed files with 35 additions and 27 deletions
|
@ -1,4 +1,5 @@
|
|||
import * as utils from './utils'
|
||||
import config from './config'
|
||||
|
||||
/* config section */
|
||||
const isMac = CodeMirror.keyMap.default === CodeMirror.keyMap.macDefault
|
||||
|
@ -167,6 +168,28 @@ export default class Editor {
|
|||
}
|
||||
}
|
||||
|
||||
updateStatusBar () {
|
||||
if (!this.statusBar) return
|
||||
|
||||
var cursor = this.editor.getCursor()
|
||||
var cursorText = 'Line ' + (cursor.line + 1) + ', Columns ' + (cursor.ch + 1)
|
||||
this.statusCursor.text(cursorText)
|
||||
var fileText = ' — ' + editor.lineCount() + ' Lines'
|
||||
this.statusFile.text(fileText)
|
||||
var docLength = editor.getValue().length
|
||||
this.statusLength.text('Length ' + docLength)
|
||||
if (docLength > (config.docmaxlength * 0.95)) {
|
||||
this.statusLength.css('color', 'red')
|
||||
this.statusLength.attr('title', 'Your almost reach note max length limit.')
|
||||
} else if (docLength > (config.docmaxlength * 0.8)) {
|
||||
this.statusLength.css('color', 'orange')
|
||||
this.statusLength.attr('title', 'You nearly fill the note, consider to make more pieces.')
|
||||
} else {
|
||||
this.statusLength.css('color', 'white')
|
||||
this.statusLength.attr('title', 'You could write up to ' + config.docmaxlength + ' characters in this note.')
|
||||
}
|
||||
}
|
||||
|
||||
setIndent () {
|
||||
var cookieIndentType = Cookies.get('indent_type')
|
||||
var cookieTabSize = parseInt(Cookies.get('tab_size'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue