【问题标题】:how to display text in ckeditor status bar?如何在ckeditor状态栏中显示文本?
【发布时间】:2012-07-08 12:07:21
【问题描述】:

我只想知道如何在 ckeditor 状态栏中显示文本。

在 ckeditor 的底部显示元素路径,我只想在该元素路径中显示文本,如状态栏。

例如,当用户在编辑器中找到并替换文本时,我想向用户显示文本中替换的实例数。

任何帮助都是有用的,在此先感谢。

【问题讨论】:

    标签: ckeditor statusbar


    【解决方案1】:

    您可以禁用 elementspath 插件:

    config.removePlugins = 'elementspath';
    

    然后通过将_source/plugins/elementspath 复制到plugins/elementspath 来制作自定义插件。

    然后将目录重命名为您的自定义名称,并将 plugin.js 文件的第 33 行更改为使用新名称(CkEditor 样式指南要求插件名称全部小写):

    CKEDITOR.plugins.add( 'newname',
    

    然后在您的配置中添加新插件:

    config.extraPlugins = 'newname';
    

    editor.on( 'selectionChange', function( ev ) 部分是为该行创建内容的大部分工作。主要部分是这样的:

    html.unshift(
      '<a' +
        ' id="', idBase, index, '"' +
        ' href="javascript:void(\'', name, '\')"' +
        ' tabindex="-1"' +
        ' title="', label, '"' +
        ( ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) ?
        ' onfocus="event.preventBubble();"' : '' ) +
        ' hidefocus="true" ' +
        ' onkeydown="return CKEDITOR.tools.callFunction(', onKeyDownHandler, ',', index, ', event );"' +
        extra ,
        ' onclick="CKEDITOR.tools.callFunction('+ onClickHanlder, ',', index, '); return false;"',
        ' role="button" aria-labelledby="' + idBase + index + '_label">',
          name,
          '<span id="', idBase, index, '_label" class="cke_label">eee' + label + '</span>',
      'rrrr</a>' );
    

    您可以修改它以显示您喜欢的任何内容。

    您需要查看其余代码以了解正在发生的所有事情,并为您的特定目标进行所需的任何其他更改。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多