My CKEditor configuration looks like this:
var wysiwyg = ck.replace(el[0], {
allowedContent: true,
protectedSource: [/\r|\n/g]
});
I'm inserting HTML source into CKEditor as:
<div style='font-weight: bold;'>
<div>
<div> test </div>
</div>
</div>
When I use wysiwyg.getData()
, this is the output I get:
<div style="font-weight: bold;">
<div>
<div>test</div>
</div>
</div>
Is there a way to maintain the indentation in CKEditor according to the source?
I've attempted using different regular expressions within protectedSource
to preserve everything between HTML >...<
like /(?:\>)([^<]*?)(?:\<)/g
https://regex101.com/r/eV4dO0/1 but haven't had any success.