Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/404.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript &引用;“弗罗拉”;删除html标记属性的编辑器_Javascript_Angularjs_Froala - Fatal编程技术网

Javascript &引用;“弗罗拉”;删除html标记属性的编辑器

Javascript &引用;“弗罗拉”;删除html标记属性的编辑器,javascript,angularjs,froala,Javascript,Angularjs,Froala,我使用“froala”编辑器来更改内联文本,下面是 除了删除div/p/span etc属性外,其他一切都正常工作。 这是我的功能 $('div#eg-custom-toolbar').editable({ inlineMode: false, buttons: ['undo', 'redo' , 'sep', 'bold', 'italic', 'underline'] }) }); 之前: <div contenteditable="tr

我使用“froala”编辑器来更改内联文本,下面是

除了删除div/p/span etc属性外,其他一切都正常工作。 这是我的功能

 $('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>
HE#1业务增长转换活动
之后:

 <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>
HE#1业务增长转换活动

有什么建议吗?

您可以使用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"]);
请注意,您不必再次复制和粘贴整个列表,您可以使用合并功能执行相同的操作