簡體   English   中英

“froala”編輯器刪除 html 標簽屬性

[英]"froala" Editor Removing html tag attributes

我正在使用“froala”編輯器來更改內聯文本,這是鏈接

除了刪除 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>

有什么建議?

您可以使用htmlAllowedAttrs選項指定 angularJS 屬性。

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

我通過將電子郵件正文模板中使用的 ng 屬性列表添加到 Froala 編輯器中允許的屬性列表來修復它。

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

請注意,您不必再次復制和粘貼整個列表,您可以使用合並功能來執行相同操作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM