Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"froala" Editor Removing html tag attributes

I am using "froala" Editor for changing inline text,here is the link

Every thing is working fine except it removing the div/p/span etc attributes. here is my function

 $('div#eg-custom-toolbar').editable({
      inlineMode: false,
        buttons: ['undo', 'redo' , 'sep', 'bold', 'italic', 'underline']
    })
  });

before:

  <div contenteditable="true" ng-style="{'color' : styleArr[6]['scopval']}" ng-bind-html="banner_text3" ng-model="banner_text3" ng-mouseleave="hoverOut('banner_text3')" ng-mouseover="hoverIn('banner_text3')" class="banner_text3 ng-pristine ng-untouched ng-valid ng-binding" style="color: rgb(255, 255, 255);">HE #1 CONVERSION EVENT FOR BUSINESS GROWTH</div>

After:

 <div contenteditable="true" class="banner_text3 ng-pristine ng-untouched ng-valid ng-binding" style="color: rgb(255, 255, 255);">HE #1 CONVERSION EVENT FOR BUSINESS GROWTH</div>

Any suggestions?

like image 599
Rahul Avatar asked Dec 30 '25 20:12

Rahul


1 Answers

You can specify angularJS attributes with the htmlAllowedAttrs option.

$('.selector').froalaEditor({
  htmlAllowedAttrs: [
                     'title', 'href', 'alt', 'src', 'style', 
                     'ng-style', 'ng-style', 'ng-bind-html', 'ng-mouseleave', 'ng-mouseover'
                    ]
});
like image 61
Evgeni Dikerman Avatar answered Jan 02 '26 09:01

Evgeni Dikerman