【问题标题】:How to remove the "title" attribute that the CKEditor 4 add automatically on inline editing?如何删除 CKEditor 4 在内联编辑时自动添加的“title”属性?
【发布时间】:2013-02-06 14:01:03
【问题描述】:

在对象上使用 CKEditor 4 内联编辑时,CKEditor 添加一个“标题”属性,其中包括 文本和对象 ID。

例如在 CKEditor 内联示例中,我们可以看到下面的代码:

<h2 id="inline-sampleTitle" title="Rich Text Editor, inline-sampleTitle"....>CKEditor<br>Goes Inline!</h2>

我喜欢删除“title”属性,因为我不喜欢用户看到它(我的 id 更复杂:))。

注意:我试图在 CKEditor 使用 jQuery“removeAttr”函数创建它之后手动删除它,但是这个 解决方案对我来说并不是很好,因为在 IE 浏览器中,用户仍然会在第一时间看到它,并且它会 仅在用户将鼠标移出对象后才删除。

【问题讨论】:

标签: ckeditor title inline-editing


【解决方案1】:

CKEDITOR.config.title = false;

更多详情请访问this

【讨论】:

【解决方案2】:

您可以在这里找到一些详细信息:How can I change the title ckeditor sets for inline instances?

很遗憾,您无法在不修改代码的情况下更改它。我报了这张票http://dev.ckeditor.com/ticket/10042

【讨论】:

  • 谢谢,我会等他们修复它。
【解决方案3】:

请参阅https://stackoverflow.com/a/15270613/2148773 - 看起来您可以手动设置编辑器元素的“标题”属性以覆盖工具提示。

【讨论】:

    【解决方案4】:

    在你的配置中

    CKEDITOR.editorConfig = function( config ) {
        // Define changes to default configuration here.
        // For the complete reference:
        // http://docs.ckeditor.com/#!/api/CKEDITOR.config
        config.title="";
    }
    

    【讨论】:

      【解决方案5】:

      CKEditor 在 4.2 版本中修复它,所以我们现在可以删除这个修复:) http://dev.ckeditor.com/ticket/10042

      【讨论】:

        【解决方案6】:

        你可以在 ckeditor 配置对象函数中加入编辑器初始化后删除标题的功能:

        on: {       
                instanceReady: function(event){
                    $(event.editor.element.$).attr('title','');
                },
        },
        

        【讨论】:

          【解决方案7】:

          您可以使用此代码删除将创建的每个 CKEDITOR 上的标题。

          CKEDITOR.on('instanceReady',function(event){$(event.editor.element.$).attr('title','');});
          

          【讨论】:

            【解决方案8】:

            我在我的 codeigniter 视图页面中尝试了这个,它对我有用。 我还为我的用户使用了我自己的自定义工具提示。

            CKEDITOR.inline( 'ckeditor' );
            CKEDITOR.config.title = false; // or you can use own custom tooltip message.
            


            谢谢
            布拉汉姆·德夫·亚达夫

            【讨论】:

              【解决方案9】:

              我尝试过使用

              CKEDITOR.config.title = false;
              

              但它仍然显示标题。

              经过一番研究,我所做的是:

              1.转到 ~/ckeditor/lang/en-gb.js 删除 'editorHelp' 值

              2.指定语言和标题,下同:

              CKEDITOR.editorConfig = function( config ) {
              config.language="en-gb";
              config.title="Put your title here"; //cannot put blank, it will display "null"
              

              【讨论】:

                猜你喜欢
                • 2013-03-23
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                相关资源
                最近更新 更多