flaming-cl / editorjs-text-color-plugin

https://flaming-cl.github.io/editorPlugin/
MIT License
51 stars 27 forks source link

Is it sensible to use deprecated <font> tag? #20

Open chrisdeeming opened 1 year ago

chrisdeeming commented 1 year ago

The markup produced by this plugin for inline font color is the <font> tag. This feels semantically correct, but <font> as a tag is deprecated and all official advice states that this should not be used.

While potentially unlikely due to its historic prevalence, there could be a situation in the future where it is removed from browsers. All you're doing here is adding some inline CSS. Is there a reason a <span> element shouldn't be used instead?

flaming-cl commented 1 year ago

Hey @chrisdeeming,

Thanks for bringing up the use of the deprecated <font> tag in our project!

We initially chose the <font> tag to provide a unique identifier, making it easier to pinpoint and undo color changes. We know <span> is pretty common and might be used by other plugins on the same text, so we wanted to avoid potential conflicts.

Your reminder about the <font> tag being deprecated is really helpful, and we're now looking into alternative solutions that might work better than using a <span> tag.

In the meantime, we'd love to hear your thoughts and ideas, as you seem to have a ton of experience in this area. If you have any suggestions or would like to contribute by submitting a PR with an improved solution, we'd be super grateful for your input.

MarcoZucc commented 5 months ago

Hello everyone, I would like to point out an advantage of using the <FONT>tag. If I use html saved by the plugin to generate an xdoc file with PHPWord, the color of the text is recognized by Word. If I use the span tag, the color is ignored. Considering that editorjs is a way to store text, you should consider this backward compatibility with word. After a quick test it seems that to convert <FONT> to <SPAN> you also need to use color in the form of hexadecimal like this: <span style="color: #db1e1e">Lorem ipsum</span>. Maybe converting the text created by editorJS to Word is not a common use, however I do not exclude that the same problem is present even if you convert it to text in PDF format

collimarco commented 4 months ago

The font tag feels right in this context. You avoid having to sanitize the CSS inside the HTML (which can be a pain). It's sad that they have deprecated the tag, it seems still useful in specific situations like this.