将CSS中的自定义表格样式应用于CKEditor视图 [英] Apply custom table styles from CSS to CKEditor view

查看:75
本文介绍了将CSS中的自定义表格样式应用于CKEditor视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将CKEditor 4.1.1集成到我的站点中.到目前为止,除了在我的站点中使用的某些特定表格样式未在编辑器中应用之外,我基本上都能正常工作.我已经尝试设置config.contentsCss以指向我的站点范围的样式表,这对我的其他大多数内容都有帮助,但是似乎没有应用表格样式.这是我正在使用的CSS:

I'm trying to integrate CKEditor 4.1.1 in my site. So far, I've mostly got it working, except some of the specific table styles that I have in my site CSS doesn't get applied in the editor. I've already tried setting up config.contentsCss to point to my site-wide stylesheet, and that helps for most of my other contents, but it doesn't seem to apply the table styles. Here's the CSS I'm working with:

table#availability {
    width: 90%;
    border-collapse: collapse;
}

table#availability td, table#availability th {
    border: 1px solid #ccc;
    padding: 4px 7px 5px 8px;
}

table#availability th {
    text-align: center;
    font-weight: bold;
}

table#availability td + td {
    text-align: right;
}

对于CKEditor来说,这些东西是否太高级了?

Is this stuff too advanced for CKEditor somehow?

推荐答案

默认情况下,CKEditor 4.1会删除类,样式以及规则中未指定的任何属性,当然还会删除您无法生成的任何元素与它的按钮.您可以检查编辑器生成的内容,以验证ACF尚未销毁您的当前内容.

By default CKEditor 4.1 strips out classes, styles, and any attribute that isn't specified in its rules, and of course any element that you can't generate with its buttons. You can check the content generated by the editor to verify that the ACF hasn't destroyed your current content.

如果这是问题,您可能要禁用它:

If that's the problem, you might want to disable it:

CKEDITOR.config.allowedContent = true;

这篇关于将CSS中的自定义表格样式应用于CKEditor视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆