javascript - 带有 :before selector 的 TinyMCE 自定义格式

标签 javascript css internet-explorer tinymce tinymce-4

我正在尝试在 tinyMCE 中设置自定义格式。

我试图做到这一点,以便当您选择一些文本并选择这种格式时,它会在文本周围放置一个边框并使用 :before css 选择器来添加图像。

enter image description here

它似乎在 Chrome 中有效,但在 IE8 或 IE9 中无效(无法在其他浏览器版本中测试)。在IE8和9中,应用格式(边框和文本颜色更改为红色,但图像不出现

这是我的init方法

tinymce.init({
    , theme                 : 'modern'
    , selector              : selector
    , entity_encoding       : 'named'
    , plugins               : ['table','contextmenu','paste','fullscreen','image','template','mention']
    , content_css           : contentcss
    , formats               : {
                                  Warning: { inline:'span', 'classes':'rte-warning' }
                              }
    , style_formats         : [
                                {
                                    title: 'Custom', items: [
                                        { title: 'Warning', format: 'Warning' }
                                    ]
                                }
                              ]
    , menubar               : false
});

和我的CSS

.rte-warning
{
    display             : block;
    border              : 1px solid #FD9F08;
    background-color    : #FFFFFF;
    line-height         : 30px;
    padding             : 10px;
    color               : #FC2400;
    font-weight         : bold;
}
.rte-warning:before
{
    content             : "";  /* Empty string must be specified or image doesn't appear for some reason */
    background          : url('/img/rte/Warning.gif');
    display             : block;
    width               : 75px;
    height              : 30px;
    border              : 1px solid #D42E12;
    margin-right        : 10px;
}

最佳答案

我已经找到问题的原因了。这是 IE 中关于 :before 选择器和 Quirks 模式的已知错误

关于javascript - 带有 :before selector 的 TinyMCE 自定义格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24421311/

相关文章:

javascript - 单击 <Link/> 设置 localStorage - Reactjs

javascript - 如何优化 "Parse HTML"事件?

css - 3d变换,逆变换不对称

html - 通过属性 mixin jade 的内联样式

html - 显示 :table and display:table-cell in IE7 and IE9 的对齐问题

javascript - 创建一个简单的 google books api

javascript - 动态元素附加到另一个 2 个动态元素中

css - -ms-flexbox 在 IE8 中不工作

html - 表单 [input] 宽度在 IE 中不一样

javascript - 将用户输入推送到数组