Extendible-BBCode-Parser icon indicating copy to clipboard operation
Extendible-BBCode-Parser copied to clipboard

Return html as is

Open molster opened this issue 6 years ago • 1 comments

Hello, hoping im missing something simple here as this library is exactly what I was looking for.

So I have a "contentedable=true" div. This is a somewhat of a wysiwyg editor. When I want to preview, I cant just send text..as they have added various html tags. SO i pass it the html.. however it looks like this returns the html < > as encoded. Is there by chance an undocumented flag to have it not do this?

To give an exmaple: if I pass

temp = XBBCODE.process({ text: "<p>[b]hello im bold[/b]</p>", });

I get returned "&lt;p&gt;<span class="xbbcode-b">hello im bold</span>&lt;/p&gt;"

I would expect to get returned "<p><span class="xbbcode-b">hello im bold</span></p>"

on further reading, i see that it may be by design to prevent XSS, but as this is not an issue in this use case, a flag would be fantastic {work around is of course to regex back all the <'s and such from their decoded forms, which is what im doing to hold me over}

molster avatar Jan 29 '19 23:01 molster

It's been a long time since I've used this project, I'm pretty sure that was done for XSS reasons like you said. It looks like the "process" function would just need to take a flag and if it was true, ignore lines 740 and 741. If I get a chance, I'll try and take a look at this tonight.

patorjk avatar Jan 30 '19 22:01 patorjk