【问题标题】:CKEditor apply css to dialog html element contentsCKEditor 将 css 应用于对话框 html 元素内容
【发布时间】:2017-12-14 19:37:56
【问题描述】:

我创建了一个 ckeditor 插件,该插件的目的是允许用户查找数据库内容并创建一个 html 元素表单该内容并将其插入到编辑器窗口中。

这里是元素定义

id: "card_layout",
type: "html",
html: "<h1>Content will display here after selections are made.</h1>" + str,

在从某些下拉列表中进行几次选择后填充元素,但内容没有格式。

问题 如何将样式表应用于 html 元素以便格式化内容?

我尝试将覆盖删除为

this.getElement().removeClass('cke_reset_all')

这没有按预期工作。

有什么方法可以做到这一点?

【问题讨论】:

    标签: jquery css dialog drupal-7 ckeditor


    【解决方案1】:

    我使用的方法是把内容放在一个div里面:

    html: '<div id="content"><h1>Content will display here...</h1></div>'
    

    然后在您正在使用的皮肤的 dialog.css 文件中,您可以添加适当的样式:

    div#content h1 { font-size: 16pt; }
    div#content ul { list-style: circle inside; }
    

    【讨论】:

      【解决方案2】:

      以防其他人遇到此问题。答案(至少对于 v4)是使用 'style' 属性:

      {
                type: 'button',
                id: 'btnAdd',
                label: 'Add',
                style: 'width:100%;', //Add your styles here just as you would for an inline
                onClick: addTarget
              }
      

      除此之外,您还可以使用 onLoad 事件向元素添加类,并从那里添加样式。 Sauce

      【讨论】:

        猜你喜欢
        • 2015-09-21
        • 2018-02-18
        • 2020-12-07
        • 2010-12-22
        • 2017-06-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-12-22
        相关资源
        最近更新 更多