DEV Community

Discussion on: Designing the ultimate (INCLUSIVE) writing tool. [Part 1 - a WYSIWYG in 745 *Bytes*! 😱]

Collapse
 
siddharthshyniben profile image
Siddharth

Nice... I would have built this document.execCommand was supported more, but it isn't.

Collapse
 
grahamthedev profile image
GrahamTheDev

Yeah that is a real issue, it isn't marked for removal in any browser yet so at least 2 years use of it.

But I agree, against good practices to use it in anything new!

I should perhaps making a point of that in the next article so people don't use it without knowing the risks, thanks for the great suggestion!

Collapse
 
siddharthshyniben profile image
Siddharth

But if you don't use it, you don't get undoing capabilities anymore

Thread Thread
 
grahamthedev profile image
GrahamTheDev

Undo is not too bad as we can just store the exact state each time there is an update.

Or better yet we can use doc diffing and just store the differences. I have to admit I have no idea which is better!

I think the answer I have at this point is to use it, but build it in a way I can swap it out easily. 🤷‍♂️

Thread Thread
 
siddharthshyniben profile image
Siddharth

Diffing is better if you care about space, which, to be honest, is not a big concern right now, unless you plan to persist them.