Fix liniting and optimize some functions

First fixed some linting issues. Also optimized some functions to be
undoable with one ctrl+z.

This should also speedup some operations

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
Sheogorath 2018-06-23 20:55:32 +02:00
parent a8b664fdb5
commit f65d96c57b
No known key found for this signature in database
GPG key ID: 1F05CC3635CDDFFD
3 changed files with 74 additions and 47 deletions

View file

@ -139,13 +139,10 @@ export default class Editor {
addToolBar () {
this.toolBar = $(toolBarTemplate)
//console.log('PLACE', $('#toolbarPlace'))
//$('#toolbarPlace').html(this.toolBar)
this.toolbarPanel = this.editor.addPanel(this.toolBar[0], {
position: 'top'
position: 'top'
})
var insertDemo = $('#insertDemo')
var makeBold = $('#makeBold')
var makeItalic = $('#makeItalic')
var makeStrike = $('#makeStrike')
@ -162,18 +159,18 @@ export default class Editor {
var makeComment = $('#makeComment')
makeBold.click(() => {
utils.wrapTextWith(this.editor, this.editor, '**')
this.editor.focus()
utils.wrapTextWith(this.editor, this.editor, '**')
this.editor.focus()
})
makeItalic.click(() => {
utils.wrapTextWith(this.editor, this.editor, '*')
this.editor.focus()
utils.wrapTextWith(this.editor, this.editor, '*')
this.editor.focus()
})
makeStrike.click(() => {
utils.wrapTextWith(this.editor, this.editor, '~~')
this.editor.focus()
utils.wrapTextWith(this.editor, this.editor, '~~')
this.editor.focus()
})
makeHeader.click(() => {
@ -182,7 +179,7 @@ export default class Editor {
makeCode.click(() => {
utils.wrapTextWith(this.editor, this.editor, '```')
this.editor.focus()
this.editor.focus()
})
makeQuote.click(() => {
@ -202,11 +199,11 @@ export default class Editor {
})
makeLink.click(() => {
utils.insertText(this.editor, '[](https://)', 1)
utils.insertLink(this.editor, false)
})
makeImage.click(() => {
utils.insertText(this.editor, '![](https://)', 4)
utils.insertLink(this.editor, true)
})
makeTable.click(() => {
@ -218,9 +215,8 @@ export default class Editor {
})
makeComment.click(() => {
utils.insertText(this.editor, '> []', 4)
utils.insertText(this.editor, '> []')
})
}
addStatusBar () {