Created
January 16, 2009 23:13
-
-
Save gcr/48203 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.parse_new_chunk = function(event) { | |
// This gets called whenever an event for a new chunk comes in. | |
var newchunk = .text(event.text); | |
// Get the position we want to insert at | |
var pos = event.position - 1; | |
console.log(pos); | |
// HACK: Are we at the beginning? | |
if (pos == -1) { | |
// If so, add it at the very beginning. | |
newchunk.prependTo(this.jqedit); | |
} else { | |
// If not, insert it after the specified chunk. | |
newchunk.insertAfter(this.jqedit.find(.chunk).eq(pos)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment