From a8b664fdb5b425625928d0ce6ae9cdbd78fb3833 Mon Sep 17 00:00:00 2001 From: Edgar Zanella Alvarenga Date: Tue, 19 Jun 2018 16:03:32 +0200 Subject: Add a toolbar to Codemirror editor Signed-off-by: Edgar Zanella Alvarenga --- public/js/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index c6a4f770..5e0aded6 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -30,6 +30,8 @@ import { import { debug, DROPBOX_APP_KEY, + GOOGLE_API_KEY, + GOOGLE_CLIENT_ID, noteid, noteurl, urlpath, @@ -566,6 +568,9 @@ var previousFocusOnEditor = null function checkEditorStyle () { var desireHeight = editorInstance.statusBar ? (ui.area.edit.height() - editorInstance.statusBar.outerHeight()) : ui.area.edit.height() + if (editorInstance.toolBar) { + desireHeight = desireHeight - editorInstance.toolBar.outerHeight() + } // set editor height and min height based on scrollbar style and mode var scrollbarStyle = editor.getOption('scrollbarStyle') if (scrollbarStyle === 'overlay' || appState.currentMode === modeType.both) { @@ -804,6 +809,10 @@ function changeMode (type) { editorInstance.addStatusBar() editorInstance.updateStatusBar() } + // add and update tool bar + if (!editorInstance.toolBar) { + editorInstance.addToolBar() + } // work around foldGutter might not init properly editor.setOption('foldGutter', false) editor.setOption('foldGutter', true) -- cgit v1.2.3 From f65d96c57b02c98616ffe3d8d7cc93f3e3942897 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Sat, 23 Jun 2018 20:55:32 +0200 Subject: 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 --- public/js/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'public/js/index.js') diff --git a/public/js/index.js b/public/js/index.js index 5e0aded6..6e13fe9c 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -30,8 +30,6 @@ import { import { debug, DROPBOX_APP_KEY, - GOOGLE_API_KEY, - GOOGLE_CLIENT_ID, noteid, noteurl, urlpath, @@ -569,9 +567,9 @@ var previousFocusOnEditor = null function checkEditorStyle () { var desireHeight = editorInstance.statusBar ? (ui.area.edit.height() - editorInstance.statusBar.outerHeight()) : ui.area.edit.height() if (editorInstance.toolBar) { - desireHeight = desireHeight - editorInstance.toolBar.outerHeight() + desireHeight = desireHeight - editorInstance.toolBar.outerHeight() } - // set editor height and min height based on scrollbar style and mode + // set editor height and min height based on scrollbar style and mode var scrollbarStyle = editor.getOption('scrollbarStyle') if (scrollbarStyle === 'overlay' || appState.currentMode === modeType.both) { ui.area.codemirrorScroll.css('height', desireHeight + 'px') -- cgit v1.2.3