highlight-within-textarea
highlight-within-textarea copied to clipboard
No non-jQuery version
For some sites, jQuery is too big a dependency.
I've made a no-jQuery, pure-JS fork: https://github.com/MattX/highlight-within-textarea. Please let me know if you have any issues!
Very cool MattX! I haven't had much time to maintain this project but I'll take a closer look this weekend.
When I first started this project, jQuery was an obvious choice, but the web has moved on. I'm not thrilled about the jQuery dependency.
Thanks! I made this fork assuming you weren't interested in merging it (if nothing else, because it changes the API), so I changed the package info / demo page to reduce confusion. Let me know if you want me to revert that and open a PR.
@MattX your version seems to be missing destroy
so there is no way to remove it, right?
@MattX you will publish your version to npm?!
@rwwagner90—that's correct, I didn't port the destroy part because I didn't really need it... If you want to submit a PR to add that I'll be happy to merge it in.
@brunoocasali—good idea, I'll publish it this week!
@MattX I definitely think adding destroy
and releasing basically a 1:1 version that doesn't need jQuery would be great. @lonekorean any chance you would want to merge the fork in here and make the official version not need jQuery?
@MattX I definitely think adding
destroy
and releasing basically a 1:1 version that doesn't need jQuery would be great. @lonekorean any chance you would want to merge the fork in here and make the official version not need jQuery?
Should just be as easy as adding this to the highlight js. You just need to revert everything back to the original state that you had it and remove the events that were attached to your textarea.
destroy: function() { this.backdrop.remove(); this.el.className = this.el.className.replace(/ID + '-text ' + ID + '-input'/, ""); this.container.insertAdjacentElement('afterend', this.el) this.container.remove(); this.el.replaceWith(this.el.cloneNode(true)); },
@MattX correct me if I'm wrong.