If I have a google doc with styling (bold, underline, etc), is there a way to parse the formatting with Javascript? I am trying to make an extremely simple WYSWIG -> HTML formatter, and easily was able to substitute whitespace with HTML, but am having a harder time with formatting.
TL/DR: If I copy and paste from a Google Doc to a textarea, can I use Javascript to see what the formatting was?
Instead of using a textbox, which will remove all formatting, you can use HTML5’s
contenteditableproperty.If you paste something into that box, it will preserve formatting. Now you can use jQuery’s
.html()to get the HTML of the container.Demo