highlight-within-textarea icon indicating copy to clipboard operation
highlight-within-textarea copied to clipboard

No non-jQuery version

Open LoganDark opened this issue 6 years ago • 8 comments

For some sites, jQuery is too big a dependency.

LoganDark avatar Jul 23 '18 01:07 LoganDark

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!

MattX avatar Feb 08 '19 03:02 MattX

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.

lonekorean avatar Feb 08 '19 13:02 lonekorean

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 avatar Feb 09 '19 15:02 MattX

@MattX your version seems to be missing destroy so there is no way to remove it, right?

RobbieTheWagner avatar Nov 19 '19 15:11 RobbieTheWagner

@MattX you will publish your version to npm?!

brunoocasali avatar Jul 14 '20 19:07 brunoocasali

@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 avatar Jul 20 '20 14:07 MattX

@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?

RobbieTheWagner avatar Jul 21 '20 12:07 RobbieTheWagner

@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.

TheRealGoodLivin avatar Mar 14 '21 23:03 TheRealGoodLivin