亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用其對話框添加鏈接時出現 EmebrJS + CKEDITOR 錯誤

使用其對話框添加鏈接時出現 EmebrJS + CKEDITOR 錯誤

至尊寶的傳說 2022-01-07 19:00:26
報告類型在 chrome 78.0.3904.97 中使用 CKEditor 添加的鏈接會出現以下錯誤,我也檢查了最新的 firefox,我可以重現這個link.js?t=J8Q8:27 Uncaught TypeError: Cannot read property 'length' of undefined    at CKEDITOR.dialog.onOk (link.js?t=J8Q8:27)    at CKEDITOR.dialog.<anonymous> (ckeditor.js:613)    at CKEDITOR.dialog.l (ckeditor.js:10)    at CKEDITOR.dialog.fire (ckeditor.js:12)    at button.onClick (ckeditor.js:637)    at button.<anonymous> (ckeditor.js:575)    at button.l (ckeditor.js:10)    at button.fire (ckeditor.js:12)    at button.click (ckeditor.js:574)    at CKEDITOR.dom.element.<anonymous> (ckeditor.js:566)繁殖步驟啟用 CKeditor 的鏈接單擊ckeditor工具欄中的鏈接圖標它會打開一個對話框以添加顯示名稱和鏈接添加鏈接和顯示名稱點擊確定預期結果關閉對話框并將鏈接添加到 ckeditor 文本區域實際結果對話框沒有關閉,控制臺給出link.js?t=J8Q8:27 Uncaught TypeError: Cannot read property 'length' of undefined    at CKEDITOR.dialog.onOk (link.js?t=J8Q8:27)    at CKEDITOR.dialog.<anonymous> (ckeditor.js:613)    at CKEDITOR.dialog.l (ckeditor.js:10)    at CKEDITOR.dialog.fire (ckeditor.js:12)    at button.onClick (ckeditor.js:637)    at button.<anonymous> (ckeditor.js:575)    at button.l (ckeditor.js:10)    at button.fire (ckeditor.js:12)    at button.click (ckeditor.js:574)    at CKEDITOR.dom.element.<anonymous> (ckeditor.js:566)其他詳情瀏覽器:chrome 78.0.3904.97 / firefox操作系統:MacCKEditor 版本:4.13.0安裝的 CKEditor 插件:使用 CKEditor 作為 Emberjs 組件有人知道我該如何解決嗎?我也檢查了他們的 github 問題,但不幸的是我找不到任何東西
查看完整描述

1 回答

?
湖上湖

TA貢獻2003條經驗 獲得超2個贊

錯誤在這里


CKEDITOR.on( 'dialogDefinition', function(e) {


      var dialogName       = e.data.name,

          dialogDefinition = e.data.definition;


      if ( dialogName === 'link' ) {


        dialogDefinition.onShow = function () {


            var dialog        = CKEDITOR.dialog.getCurrent(),

                linkType      = dialog.getContentElement( 'info' , 'linkType' ),

                anchorOptions = dialog.getContentElement( 'info' , 'anchorOptions' ),

                emailOptions  = dialog.getContentElement( 'info' , 'emailOptions' ),

                protocol      = dialog.getContentElement( 'info' , 'protocol' );


            linkType.getElement().hide();

            anchorOptions.getElement().hide();

            emailOptions.getElement().hide();

            protocol.disable();

        };

      }

    } );

我已經用下面的代碼更新了這個


CKEDITOR.on( 'dialogDefinition', function(e) {


      var dialogName       = e.data.name,

          dialogDefinition = e.data.definition;


      if ( dialogName === 'link' ) {

        dialogDefinition.getContents('info').get('protocol')['items'].splice(2, 6);

        dialogDefinition.getContents('info').get('linkType')['items'].splice(1, 4);


        var target = e.data.definition.getContents('target');

        var options = target.get('linkTargetType').items;

        for (var i = options.length-1; i >= 0; i--) {

          var label = options[i][0];

          if (!label.match(/new window/i)) {

            options.splice(i, 1);

          }

        }

        var targetField = target.get( 'linkTargetType' );

        targetField['default'] = '_blank';

      }

    } );


查看完整回答
反對 回復 2022-01-07
  • 1 回答
  • 0 關注
  • 191 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號