gpt4 book ai didi

twitter-bootstrap - 在 ckeditor 中使用 twitter bootstrap css 类

转载 作者:行者123 更新时间:2023-12-03 23:40:53 25 4
gpt4 key购买 nike

我想在ckeditor 4中使用 Bootstrap 类。但是我发现如果我在源模式下输入类,ckeditor会删除该类。我想让用户从 ckedtior css 下拉列表中选择类,然后直接显示样式。
谁能告诉我如何解决这个问题?

最佳答案

该解决方案实际上是 Andrey Nelubin 和 user3250006 的其中两个答案的组合。

首先,为了强制 CKEditor 保留您的自定义 HTML 和类属性,您需要 allowedContent = true配置。之后,为了在编辑器中实际看到格式,您需要添加一个额外的路径到 contentsCss (可能是您的主 CSS 文件,或仅包含 Bootstrap 的子集)。

所以,以下对我有用:

        CKEDITOR.replace('editor1', {
contentsCss: [CKEDITOR.basePath + 'contents.css', '/path/to/custom.css'],
allowedContent: true,
});

关于twitter-bootstrap - 在 ckeditor 中使用 twitter bootstrap css 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17563353/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com