CanopyTax / bandicoot

React rich text editor
https://bandicoot.js.org
MIT License
54 stars 2 forks source link

useDocumentExecCommand is obsolete due to document.execCommand() is obsolete #100

Closed IoTMOD closed 3 years ago

IoTMOD commented 3 years ago

Hi there! The useDocumentExecCommand hook wraps the obsolete document.execCommand().

E.g.: The Change font button shown in the example (https://bandicoot.js.org/hooks/use-document-exec-command.html) will create a <font> tag, which is an obsolete tag. Is there a (build in) way to manipulate the font family in another (HTML5) way or is there a plan to add a hook to do so?

joeldenning commented 3 years ago

It's true that MDN says document.execCommand is obsolete. However, there are no plans to remove it from browsers. Bandicoot relies very heavily on execCommand - removing it would require a rewrite of bandicoot.

I don't have any plans to rewrite bandicoot to not use execCommand - it would be a significant endeavor where almost 100% of the existing code would need to be thrown away. The size of the library would increase drastically, since bandicoot would have to do HTML manipulation itself instead of deferring that work to the browser.

I no longer work at Canopy, but still have helped maintain bandicoot since leaving. I still use bandicoot in my projects and it serves my needs - if you have different needs then I'd suggest not using it.