How to completely allow html in a editor field(s).

How to completely allow html in a editor field(s).

TRMACTRMAC Posts: 1Questions: 1Answers: 0

Hi I created editor in which one field called description set to have quill editor.

Now, on editor I can make text bold and do all other html formatting, but only text saved and displayed as normal text after save.

I also declared XSS to False.

Please refer my code below;

HTML

<div id="customForm">
other fields
<div data-editor-template="Description"></div>
other fields
</div>

JS

var editor = new $.fn.dataTable.Editor({
            ajax: urlAjax,
            table: '#wfsubs',
            template: '#customForm',
            fields: [
                        /*Other fields*/
                         {
                            "label": "Enter Description:",
                            "name": "Description",
                            "type": "quill",
                            "className": "block",
                            "opts": {
                                  "placeholder": "Type and style description here...",
                                  "theme": "snow"
                             },
                             multiEditable: false
                         }
                        /*Other fields*/
                    ]
          });

var table = $('#wfsubs').DataTable({
            ajax: urlAjax,
            legacyAjax: false,
            columns: [
                /*Other fields*/
                {
                    data: "Description"
                },
                /*Other fields*/
            ]
    });

C#

.Field(new Field("Description")
    .Xss(false)
)

DB(SqlServer)

Description [nvarchar(MAX)]

Also,

For Quill Editor,
I can not set only specific formatting controls like

var toolbarOptions = [['bold', 'italic'], ['link', 'image']];

..
"opts": {
       modules: {
           toolbar: toolbarOptions 
       },
       "placeholder": "Type and style description here...",
      "theme": "snow"
 },

If I do that, Additional blank controls are displayed in edit form.

Please help me to solve this.

-Thank you

Answers

  • allanallan Posts: 61,452Questions: 1Answers: 10,055 Site admin

    Hi,

    Can you give me a link to your page showing the issue please? I’m wondering if it might be missing a stylesheet or something? Or perhaps some other CSS conflict. For the HTML showing, perhaps a renderer is being used? A test case would let me help identify these issues.

    Allan

This discussion has been closed.