【问题标题】:TinyMCE custom formatting for preTinyMCE 自定义格式
【发布时间】:2011-02-18 09:24:44
【问题描述】:

我到处寻找,但不知道如何在 tinyMCE 的下拉菜单中添加另一个选项以进行格式化。我想复制和修改 pre 标签的格式,也给它一个 .prettyprint 类,以便我可以快速将代码 sn-ps 添加到我的帖子中。

这在技术上应该是可行的,但是我应该如何修改以及修改哪个文件。或者,我可以添加一个应用此格式的按钮

【问题讨论】:

    标签: tinymce


    【解决方案1】:

    您可以在您的 tinymce 初始化函数中添加类似以下内容 (style_fomats setting) 以便向样式下拉列表添加新选项。请注意,应使用 the content_css configuration setting 使要应用的类可用

        style_formats: [{
            title: 'block styles'
        }, {
            title: 'Name_to_be_displayed',
            block: 'p',
            classes: 'class_to_be_applied', 
            exact: true
        }, {
            title: 'inline styles'
        }, {
            title: 'Red text',
            inline: 'span',
            classes: 'red',
            exact: true
        }, {
            title: 'Pre formatting',
            inline: 'pre',
            classes: 'xyzpre',
            exact: true
        }],
    

    或者我可以添加一个按钮 应用此格式

    是的,您需要write your own plugin,,这并不难。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-23
      • 2013-01-14
      • 1970-01-01
      • 2018-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多