diff options
author | Sheogorath | 2018-06-23 20:55:32 +0200 |
---|---|---|
committer | Sheogorath | 2018-06-23 21:18:15 +0200 |
commit | f65d96c57b02c98616ffe3d8d7cc93f3e3942897 (patch) | |
tree | b5c309d11a7d17004f547afc895146b3cbb7dd36 /public/js/lib/editor/index.js | |
parent | a8b664fdb5b425625928d0ce6ae9cdbd78fb3833 (diff) |
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>
Diffstat (limited to 'public/js/lib/editor/index.js')
-rw-r--r-- | public/js/lib/editor/index.js | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/public/js/lib/editor/index.js b/public/js/lib/editor/index.js index cb9192bc..0537e927 100644 --- a/public/js/lib/editor/index.js +++ b/public/js/lib/editor/index.js @@ -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 () { |