2015-03-13 46 views
0

我正在使用CKEditor,我已經把一個鏈接放到了文本中。當我們點擊(一次)在CKEditor中的鏈接時,是否有可能直接進入鏈接?在CKEditor中打開鏈接只需點擊一下

+0

如果你直接去鏈接,當你點擊它,你怎麼編輯它,如果有你想做的任何調整,如改變文本,目標網址,格式..? – AlfonsoML 2015-03-13 15:01:55

+0

當我雙擊鏈接的文本時,它會打開鏈接編輯器,我可以在其中進行調整。但是,如果我做單擊,它應該去鏈接。我不知道是否有可能。這就是檢查在這裏。日Thnx – Deecee2000 2015-03-13 15:12:31

回答

1

您是否嘗試過這樣的事情(需要的jQuery):

CKEDITOR.on('instanceReady', function(ev) { 
    $('iframe').contents().click(function(e) { 
     if(typeof e.target.href != 'undefined') { 
      window.open(e.target.href, 'new' + e.screenX); 
     } 
    }); 
}); 

修補程序從https://dev.ckeditor.com/ticket/7145#comment:1

0
CKEDITOR.on('instanceReady', function (ev) { 
      $('iframe').contents().click(function (e) { 
       if (typeof e.target.href !== 'undefined') { 
        window.open(e.target.href, 'new' + e.screenX); 
       } else if (typeof e.currentTarget.activeElement.href !== 'undefined') { 
        window.open(e.currentTarget.activeElement.href, 'new' + e.screenX); 
       } 
      }); 
     });