简体   繁体   English

防止内容CSS更改Summernote html所见即所得编辑器页面

[英]Prevent Summernote html wysiwyg editor page being changed by content CSS

We are using the Summernote wysiwyg editor to review/preview html content of which some contain external stylesheet references. 我们正在使用Summernote所见即所得编辑器来审阅/预览html内容,其中一些包含外部样式表引用。 Some of this css changes not only Summernote itself but the parent page within which Summernote resides. 其中的某些CSS不仅更改了Summernote本身,而且更改了Summernote所在的父页面。

To demonstrate, just go to the summernote.org page and drop this css reference into the online editor (selecting "< / >" for code view first). 为了演示,只需转到summernote.org页面并将此CSS参考放入在线编辑器中(首先为代码视图选择“ </>”)。 You should see the toolbar (and contents on some pages) becoming centered and other undesired changes because of the css that's within the editor :- 您应该看到工具栏(和某些页面上的内容)变得居中,并且由于编辑器中的CSS而进行了其他不希望的更改:-

<link href="https://owa.kccd.edu/owa/14.3.248.2/themes/resources/logon.css" rel="stylesheet" type="text/css" />

We have tried to put summernote within an iframe tag but this doesnt help so is there a way of isolating summernote thus preventing this css "leakage" to the surrounding page? 我们试图将summernote放在iframe标记中,但这无济于事,因此是否有一种隔离summernote的方法,从而防止了该CSS“泄漏”到周围的页面?

For reference, we are using asp.net Razor pages. 作为参考,我们使用asp.net Razor页面。

Thanks. 谢谢。 James 詹姆士

After much research it seems because Summernote does not reside within it's own iFrame, any CSS included within will naturally propogate to the surrounding page. 经过大量研究,似乎因为Summernote不在其自己的iFrame中,包含在其中的任何CSS都自然会向周围的页面传播。 Others have commented on this although I don't have that information source to hand. 尽管我没有该信息来源,但其他人对此发表了评论。

We had no choice but to change to ckeditor, which is working really well for our needs. 我们别无选择,只能改用ckeditor,它可以很好地满足我们的需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM