Html Tag Attributs Removed
wrwc opened this issue · 9 comments
Hi team ,
How to avoid tag attributes removing ?
My Original Content From DataBase = >
<h2 class="ql-container ql-snow mb-xl-4 mb-3 wow fadeInLeft">XXXXX</h2>
But its showing our view template like this =>
<h2>XXXXX</h2>
The class attribute are removed.
How to fix this issue ?
Kindly provide the solution ASAP.
you are using the innerHtml property?
then angular sanitation strikes.
Just use $sce to trust the whole html string before setting it as html content
Okay fine. But how to config the quill-editor with html + html tags attribute supported.
Now i am using below config.
<quill-editor format="html"> </quill-editor>.
The quill-editor can't support the html tags attributes.
Can you please help me ?
quilljs only allows only known html attributes and formats, and stripts everything else.
Kindly preview the above images.
The quill-editor format text means the html attr.are showing.
But the quill-editor format html means the attr.are removed.
I need html format with attr.
In our database contain the value html tags + attr.
But the content was updated using editor means all tags attr are removed.
How to fix this issue ?
please help me.
i think there is no solution or just add custom quilljs formats where you allow those attributes and class names.
Keep in mind a wysiwyg editor is to provide the user an instant preview how the content will look like if it is shown without the editor. ;)
Format text means that everything the users types in the editor is interpreted as a simple text.
If you say it is html - quilljs transforms the html string to a valid html-string quilljs can guarantee that it will work.
Can you share the sample custom quilljs formats please ?
I am using angular 8
nope. just checkout the quilljs documentation.
https://quilljs.com/guides/how-to-customize-quill/
it is like in any other wysiwyg editor. if you want to extend the editor you need to write plugins or extentions or for quilljs blots and modules.
EDIT:
But i do not know why those classes are needed inside of that editor content...
just write a little peace of javascript which adds those classes, when presented to the dom.
select all h2 and fade them in or add the cssClasses.. simple javascript
so you have clean an correct quilljs content. and the extra magic is done when presenting.
and by the way, when you are using angular 8 - you are looking for ngx-quill not ng-quill ;-)