2015-10-12 44 views
1

我使用“froala”编辑器改变嵌入式文本,这里是link“froala”编辑器删除HTML标签属性

除了它每一件事情是工作的罚款去除DIV/P/SPAN等属性。 这里是我的功能

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

前:

<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> 

后:

<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> 

有什么建议?

回答

1

您可以使用htmlAllowedAttrs选项指定angularJS属性。

$('.selector').froalaEditor({ 
    htmlAllowedAttrs: [ 
        'title', 'href', 'alt', 'src', 'style', 
        'ng-style', 'ng-style', 'ng-bind-html', 'ng-mouseleave', 'ng-mouseover' 
        ] 
}); 
0

我加入纳克在我的电子邮件人体模板用于在Froala编辑器允许的属性列表属性列表固定它。

$.FroalaEditor.DEFAULTS.htmlAllowedAttrs = $.merge($.FroalaEditor.DEFAULTS.htmlAllowedAttrs, ["ng-if", "ng-repeat", "ng-show"]); 

注意,您不必复制&重新粘贴整个列表,您可以使用合并功能做同样的。