Hi,
The problem I had is that the TinyMCE and the CKEditor both do not support setting the rel property of a lightbox link to support image sets.
Default lightbox recognizes lightbox links by the rel attribute of the anchor element set to lightbox. Something like
<a rel="lightbox" href="blah.jpg">...</a>
Would make lightbox be activated when the link is clicked.
For grouping of images, so that next and previous buttons are enabled in the lightbox, and the number of images in the set is shown as well, lightbox accepts the rel value as follows:
<a rel="lightbox[saturday_picknick]" href="blah.jpg">...</a>
So that all images with lightbox[saturday_picknick] are grouped together.
However, TinyMCE and CKEditor both do not support setting the rel attribute to such detail. CKEditor does not support setting the attribute at all, TinyMCE has a dropdown which does allow you to set lightbox as value, but not lightbox[...].
The solution I came up with is to adapt lightbox.js to also use the type attribute of the anchor (I have no idea if this is a safe attribute to use improperly, please let me know!). This makes it so that TinyMCE supports it, since CKEditor does not even allow you to set the rel attribute, you would have to use other attributes to identify lightbox links, this should be easy to do.
In this way the following syntax is supported for implementing lightbox image sets:
<a rel="lightbox" type="saturday_picknick" href="blah.jpg">...</a>
Here is the code of the adapted lightbox.js file replacing the code in line 216 to 227 in Lightbox 2.04:
// adapted to be TinyMCE
if ((imageLink.type == '')){
// if image is NOT part of a set, add single image to imageArray
this.imageArray.push([imageLink.href, imageLink.title]);
} else {
// if image is part of a set..
this.imageArray =
$$(imageLink.tagName + '[href][rel="' + imageLink.rel + '"][type="' + imageLink.type + '"]').
collect(function(anchor){ return [anchor.href, anchor.title]; }).
uniq();
while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
}
Please let me know if there is another way to support lightbox image sets with TinyMCE.
Otherwise, enjoy the fix and have fun