Alex-D / Trumbowyg

A lightweight and amazing WYSIWYG JavaScript editor under 10kB
https://alex-d.github.io/Trumbowyg
MIT License
4.01k stars 613 forks source link

Remove jQuery dependency? #391

Closed dandv closed 5 years ago

dandv commented 8 years ago

Just wondering, in the light of this post, how difficult it would be to remove the dependency on jQuery.

Alex-D commented 8 years ago

If I remove jQuery (and it should be possible in v3) I will rewrite the plugin and do not base Trumbowyg on buggy execCommand.

I know that is not possible/hard yet to remove the dependency on jQuery :/

SmoshySmosh commented 8 years ago

@Alex-D Have you thought about replacing jQuery with something like cash? It seems to cover most of what jQuery does but at a fraction of the size. I believe around 3kb~ gzipped.

Would this be a difficult task?

Alex-D commented 8 years ago

There is no AJAX support, so it's hard yep :/

SmoshySmosh commented 8 years ago

You're right... Although there is a pull request on the repository that we could try to give a little shove... I may be bias, but I love this WYSIWYG editor and I would love it even more if I didn't have to require jquery due to its size... Let me know of you need any help, I wouldn't mind contributing.

DoomyTheFroomy commented 8 years ago

@SmoshySmosh 👍 @Alex-D is this only the line 177? Or are there more problems? Because a request is also pretty simple in VanillaJS. I would also help, because this would made this WYSIWYG editor more awesome! And save loading time 😏

Alex-D commented 8 years ago

Because a request is also pretty simple in VanillaJS

I know. I'm not fan of jQuery anymore. But if the ajax support could be supported by cash it could be cool. Upload plugin use it too.

DoomyTheFroomy commented 8 years ago

@Alex-D sorry what I meant, was not to switch from one library to another, I would recommend to use Vanilla JS or better say pure JS. Without any use of extra library. I think this should also work?! 😏

Alex-D commented 8 years ago

I know what Vanilla JS is. But XHR Requests are not so easy to support on each browsers, especially IE/Edge :(

SmoshySmosh commented 8 years ago

I believe we have a few options for XHR, remember the goal is to keep the final size down.

https://github.com/pyrsmk/qwest - 2.2kb https://github.com/dimitrinicolas/marmottajax - 1.8kb https://github.com/typicode/fetchival - 0.6kb

Thoughts?

DoomyTheFroomy commented 8 years ago

@Alex-D 👍 @SmoshySmosh fetchival looks great and close to this, what I would have in mind.

richardtallent commented 6 years ago

I recommend Axios as an option for XHR requests. It's the standard library AJAX requests for Vue, which I also use. (Trumbowyg is one of the few non-Vue components I still use, and the only one that depends on JQuery.)

DoomyTheFroomy commented 6 years ago

@Alex-D if you need any help with anything let me know

pwFoo commented 6 years ago

Axios and axios.all() is nice, but I like the minimal size of fetchival.

cash is also a nice small jQuery replacement. Alternatives could be umbrellajs or maybe it's easier to move to zeptojs (compatible with some jquery methods, ajax,...)?

aguilera51284 commented 6 years ago

unfetch

Alex-D commented 5 years ago

I plan to remove jQuery dependency in version 3.

See #875 for more details.