简体   繁体   English

默认ckeditor配置上缺少字体标签

[英]Missing font tags on default ckeditor config

I'm having a super annoying problem with CKEditor. 我在CKEditor中遇到了一个超级烦人的问题。

When I first load it, it appears like this: 当我第一次加载它时,它看起来像这样:

初始配置

then, when I click inside to type, it goes like this: 然后,当我单击“内部”进行键入时,结果如下所示:

字体样式和大小

ok, everything just fine, but look what happens with the content when I type something: 好的,一切都很好,但是当我输入内容时,看看内容会发生什么:

标签在哪里?

I don't have any Arial 12 labeling, so when I get this HTML and process it, I'll never know it should be Arial 12. 我没有任何Arial 12标签,因此当我获取此HTML并对其进行处理时,我永远不会知道它应该是Arial 12。

Now, if I manually change it, then it works, but when I click outside the CKEditor window and then back inside again, it returns to the initial state, with no tags, look: 现在,如果我手动更改它,那么它将起作用,但是当我在CKEditor窗口外部单击然后再次返回内部时,它返回到初始状态,没有标签,请看:

疯狂的CKEditor

I've tried every solution on google, like adding 我已经尝试过Google上的所有解决方案,例如添加

font-family: sans-serif, Arial, Verdana, "Trebuchet MS" !important; font-size: 12px !important; in content.css , content.css

or adding 或添加

config.font_defaultLabel = 'Arial';
config.fontSize_defaultLabel = '12px';

in config.js, etc. 在config.js等中

Could someone help me, please? 有人可以帮我吗?

I think you misunderstood what config.font_defaultLabel , config.fontSize_defaultLabel do. 我认为您误解了config.font_defaultLabelconfig.fontSize_defaultLabel作用。 They do only one thing - set the default labels in the dropdowns. 他们只做一件事-在下拉菜单中设置默认标签。 Nothing more. 而已。

So how do you apply Arial 12px to the whole content? 那么如何将Arial 12px应用于整个内容? Using contents.css just like you did. 就像您一样使用contents.css

I don't have any Arial 12 labeling, so when I get this HTML and process it, I'll never know it should be Arial 12. 我没有任何Arial 12标签,因此当我获取此HTML并对其进行处理时,我永远不会知道它应该是Arial 12。

You just set it in the contents.css so I think you know that very well ;). 您只需在contents.css设置,所以我认为您对此非常了解;)。

But I want <span> tags wrapping the whole content! 但是我想要<span>标签来包装整个内容! (my quote :P) (我的报价:P)

CKEditor will not help with that, because this is against good practices. CKEditor对此无济于事,因为这违反了良好做法。 You should use power of CSS instead of dirtying your HTML with presentation markup. 您应该使用CSS的强大功能,而不是使用演示文稿标记弄脏HTML。

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

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