mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
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:
parent
a8b664fdb5
commit
f65d96c57b
3 changed files with 74 additions and 47 deletions
|
@ -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, '', 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 () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue