Skip to content

Commit

Permalink
Stop jump on format buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Muhleder committed Aug 18, 2015
1 parent 10544f7 commit ca9cd7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/modules/toolbar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ class Toolbar
dom(input).on(eventName, =>
value = if eventName == 'change' then dom(input).value() else !dom(input).hasClass('ql-active')
@preventUpdate = true
@quill.focus()
range = @quill.getSelection()
range = @quill.getSelection(true)
callback(range, value) if range?
@preventUpdate = false
return true
Expand Down
4 changes: 2 additions & 2 deletions src/quill.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ class Quill extends EventEmitter2
getModule: (name) ->
return @modules[name]

getSelection: ->
getSelection: (ignoreFocus = false) ->
@editor.checkUpdate() # Make sure we access getRange with editor in consistent state
return @editor.selection.getRange()
return @editor.selection.getRange(ignoreFocus)

getText: (start = 0, end = null) ->
return _.map(this.getContents(start, end).ops, (op) ->
Expand Down

0 comments on commit ca9cd7b

Please sign in to comment.