Skip to content

Instantly share code, notes, and snippets.

@mikeknoop
Last active December 15, 2015 02:09
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/5184929 to your computer and use it in GitHub Desktop.
Save mikeknoop/5184929 to your computer and use it in GitHub Desktop.
setCaret: function($el) {
var caret, lastCaret,
_this = this;
if (_.any(this.NO_CARET_TYPES, function(type) {
return type === _this.model.get('type');
})) {
return;
}
lastCaret = this.getCaret();
if (($el != null ? $el[0] : void 0) != null) {
caret = $el.atCaret('getCaretPosition');
}
this.model.set({
caret: caret,
lastCaret: lastCaret
});
if (caret != null) {
$el.attr('data-caret', caret);
}
if (lastCaret != null) {
return $el.attr('data-last-caret', lastCaret);
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment