当我将html.insert函数与Froala一起使用时,它将剥离内联样式。
编辑器的外观看起来像
$('.fr-view').froalaEditor({
// Set custom buttons with separator between them.
toolbarButtons: ['paragraphFormat', 'bold', 'italic', 'strikeThrough', 'formatOL', 'formatUL', 'clearFormatting', 'link', 'unlink', 'myButton', 'image', 'blockquote', 'html'],
paragraphFormatSelection: true,
refreshAfterCallback: true,
imageEditButtons: ['replaceImage', 'imageDisplay', 'imageAlign', 'imageRemove'],
linkEditButtons: ['linkOpen', 'linkRemove'],
linkNoReferrer: false,
htmlAllowedTags: ['.*'],
htmlRemoveTags: ['']
});
HTML插入功能如下:
$('.fr-view').froalaEditor('html.insert', '<a href="' + imgLink + '" target="_self" ><img src="' + finalImgSrc + '" style="' + imgStyle + '" alt="' + altTitle + '" title="' + altTitle + '" /></a>', true);
任何人都知道为什么内联样式会被剥夺吗?