Skip to content

Instantly share code, notes, and snippets.

@mikeknoop
Created March 18, 2013 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeknoop/5184343 to your computer and use it in GitHub Desktop.
Save mikeknoop/5184343 to your computer and use it in GitHub Desktop.
setCaret: ($el) ->
return if _.any @NO_CARET_TYPES, (type) => return type == @model.get('type')
lastCaret = @getCaret()
caret = $el.atCaret('getCaretPosition') if $el?[0]?
@model.set {caret: caret, lastCaret: lastCaret}
$el.attr 'data-caret', caret if caret?
$el.attr 'data-last-caret', lastCaret if lastCaret?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment