Ckeditor和Lightbox不起作用

美好的一天! 我通过这个http://ckeditor.com/addon/lightbox指令做了一切,但我总是产生这个错误(当按下按钮灯箱时):未捕获的TypeError:无法读取未定义的属性’split’

码:

     Replace Textarea by Code — CKEditor Sample       

CKEditor Samples » Replace Textarea Elements Using JavaScript Code

This editor is using an <iframe> element-based editing area, provided by the Wysiwygarea plugin.

 CKEDITOR.replace( 'textarea_id' ) 

CKEDITOR.replace( 'editor1' );

$(document).ready(function(){ ckeLightbox(); }); function ckeLightbox(){ var c=0; $('a.ckelightbox').each(function(){ c++; var g=$(this).attr('class').split('ckelightboxgallery')[1]; if(!g)g=c; $(this).attr('data-lightbox',g); $(this).attr('data-title',$(this).attr('title')); }); }

加载所有脚本 – http://take.ms/2Jnx8

你能提供一个有效的例子吗?

这是我的测试项目 – http://take.ms/OJpKE

我犯了同样的错误。 该插件不起作用。 由于没有在dialogs / lightbox.js的第20行定义变量gal,所以发生了这个特殊错误(尽管同样适用于第21和22行)。 但是,即使您检查undefined:

 if(typeof gal !== 'undefined') {gal = gal.split("ckelightboxgallery"); gal = gal[1]; a.advanced && this.setValue(gal || ""); } 

……它仍然不起作用。 我很确定这个问题与这个代码有关:

  

…因为当我使用灯箱并将标题标识为test1而图库标识为test时,它会生成如下代码:

 

https://stackoverflow.com/questions/30116763/ckeditor-and-lightbox-not-work/myimage.jpg

我认为上面代码的想法是抓住ckelightboxgallerytest并拆分“test”,这样它就可以把它变成data-lightbox =“test”。