Skip to content

Commit

Permalink
Preserve scroll position in textareas when using Markdown toolbar but…
Browse files Browse the repository at this point in the history
…tons #58
  • Loading branch information
tedw committed Oct 5, 2016
1 parent 163017e commit fc7d4f1
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ var MarkdownComposerView = Backbone.View.extend({

event.preventDefault();

// Save current scroll position of textarea so we can reset it after we update the text
var scrollPos = this.$textarea.scrollTop();

var selectedText = this.$textarea.selection("get");
var buttonOps = ComposerButtons[mode];

Expand All @@ -133,6 +136,8 @@ var MarkdownComposerView = Backbone.View.extend({

this.updatePreview();

// Reset scroll position
this.$textarea.scrollTop(scrollPos);
},

// Show an error message in the preview with dimmed text
Expand Down

0 comments on commit fc7d4f1

Please sign in to comment.