Prosemirror Editor DOMParser Issue

46 views Asked by At

I have tried to parse the below HTML string using prosemirror Editor DOMParser

const initialValue = '<p><span style="font-size:36px;"><span style="color:#00ff22;"><span style="background-color:#77b9c9;">hhkjhk hkjhkjh hjkhkj</span></span></span></p>'
DOMParser.fromSchema(schema).parse(document.createRange().createContextualFragment(initialValue))

This is the actual initial HTML

<p>
     <span style="font-size:36px;">
         <span style="background-color:#77b9c9;">
            <span style="color:#00ff22;">world !!!</span>
        </span>
    </span>
</p>

but I got

<p>
   <span style="color:#00ff22;">world !!!</span>
</p>

The issue is some of the span tags were removed even if it has style tag in it

how do achieve the exact HTML without losing some span tags? please help me with the necessary schema

0

There are 0 answers