diff --git a/public/res/editor.js b/public/res/editor.js index 04a6fe1b..5433335e 100644 --- a/public/res/editor.js +++ b/public/res/editor.js @@ -273,8 +273,16 @@ define([ } var nextTickAdjustScroll = false; + var lastSelectionStart, lastSelectionEnd; + var saveLastSelection = _.debounce(function() { + lastSelectionStart = self.selectionStart; + lastSelectionEnd = self.selectionEnd; + }, 50); var debouncedSave = utils.debounce(function() { save(); + if(lastSelectionStart == self.selectionStart && lastSelectionEnd == self.selectionEnd) { + nextTickAdjustScroll = false; + } self.updateCursorCoordinates(nextTickAdjustScroll); nextTickAdjustScroll = false; }); @@ -287,6 +295,7 @@ define([ else { save(); } + saveLastSelection(); }; })(); this.getSelectedText = function() { diff --git a/public/res/extensions/buttonHtmlCode.js b/public/res/extensions/buttonHtmlCode.js index aa76217e..0e18b464 100644 --- a/public/res/extensions/buttonHtmlCode.js +++ b/public/res/extensions/buttonHtmlCode.js @@ -4,13 +4,13 @@ define([ "utils", "classes/Extension", "text!html/buttonHtmlCode.html", - "text!html/buttonHtmlCodeSettingsBlock.html", + "text!html/buttonHtmlCodeSettingsBlock.html" ], function($, _, utils, Extension, buttonHtmlCodeHTML, buttonHtmlCodeSettingsBlockHTML) { var buttonHtmlCode = new Extension("buttonHtmlCode", 'Button "HTML code"', true, true); buttonHtmlCode.settingsBlock = buttonHtmlCodeSettingsBlockHTML; buttonHtmlCode.defaultConfig = { - template: "<%= documentHTML %>", + template: "<%= documentHTML %>" }; buttonHtmlCode.onLoadSettings = function() { @@ -62,7 +62,7 @@ define([ documentHTMLWithFrontMatter: (selectedFileDesc.frontMatter ? selectedFileDesc.frontMatter._frontMatter : '') + htmlWithoutComments, documentHTMLWithComments: htmlWithComments, frontMatter: selectedFileDesc.frontMatter, - publishAttributes: undefined, + publishAttributes: undefined }); textareaElt.value = htmlCode; } diff --git a/public/res/extensions/findReplace.js b/public/res/extensions/findReplace.js index 2c2d2a46..9f97aff4 100644 --- a/public/res/extensions/findReplace.js +++ b/public/res/extensions/findReplace.js @@ -151,7 +151,7 @@ define([ eventMgr.onEditorPopover(); shown = true; $findReplaceElt.show(); - $searchForInputElt.focus(); + $searchForInputElt.focus()[0].setSelectionRange(0, $searchForInputElt.val().length); editor.selectionMgr.adjustTop = 50; editor.selectionMgr.adjustBottom = 220; highlight(true);