From c1b245c8b1dbe6d0056d8098f045f277473b1db9 Mon Sep 17 00:00:00 2001 From: azivner Date: Sun, 10 Jun 2018 11:51:13 -0400 Subject: [PATCH] fix unnecessary change events, closes #118 --- src/public/javascripts/services/note_detail_text.js | 8 +++++++- src/public/stylesheets/style.css | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/public/javascripts/services/note_detail_text.js b/src/public/javascripts/services/note_detail_text.js index d25a13e07..345cb3951 100644 --- a/src/public/javascripts/services/note_detail_text.js +++ b/src/public/javascripts/services/note_detail_text.js @@ -11,7 +11,13 @@ async function show() { textEditor = await BalloonEditor.create($noteDetailText[0], {}); - textEditor.model.document.on('change', noteDetailService.noteChanged); + textEditor.model.document.on('change', () => { + // change is triggered on just marker/selection changes which is not interesting for us + if (textEditor.model.document.differ.getChanges().length > 0) { + noteDetailService.noteChanged(); + } + } + ); } textEditor.setData(noteDetailService.getCurrentNote().content); diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css index 1026fc3e7..cfc0fd8c9 100644 --- a/src/public/stylesheets/style.css +++ b/src/public/stylesheets/style.css @@ -20,7 +20,7 @@ background-color: #f1f1f1; display: flex; align-items: center; - padding: 6px 6px 4px; + padding: 4px; } #note-detail-wrapper {