I would like to copy/paste text from MS Excel into my mxGraph editor in order to label nodes and edges.
Problem: The copied cell content from Excel comes with a lot of CSS styling, so for example it looks like this:
<!--table
{mso-displayed-decimal-separator:"\,";
mso-displayed-thousand-separator:\00A0;}
@page
{margin:.75in .24in .75in .24in;
mso-header-margin:.31in;
...
-->
Actual cell string
I would like to strip all the styling and only insert the raw text. In MS Word this behaviour is known as "Match Destination Formatting".
I am aware I can disable HTML labels completely using
mxGraph.prototype.htmlLabels = false;
However, I still want the labels to wrap which seems to require HTML labels.
What is the best approach to intercept the paste event and cleanup the string before it gets inserted as label?