2015-10-12 47 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"]); 

注意,您不必複製&重新粘貼整個列表,您可以使用合併功能做同樣的。