Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm trying to add Lightbox to some anchors on my page, but TinyMCE strips rel="lightbox" as well as class="lightbox".
No HTML filters enabled either in Input format or in WYSIWYG API \ TinyMCE config page.
Page can be saved with Lightbox attributes, but they will be cleared on next edit. Quite anoying.
Possible solution described here: http://drupal.org/node/285270 , but I have no idea how to apply it to WYSIWYG API.
I think Lightbox2 compatibility should be added to the WYSIWYG API core.
Comment | File | Size | Author |
---|---|---|---|
#9 | wysiwyg-DRUPAL-6--1.tinymce-advimage.patch | 976 bytes | sun |
#3 | wysiwyg-DRUPAL-6--1.advlink.patch | 957 bytes | sun |
Comments
Comment #1
blb CreditAttribution: blb commentedI have had a similar problem where style elements of tags are stripped out. I turned off the "verify HTML" setting under the "cleanup" section of the profile. that seemed to relieve the problem.
however, i would like to be able to use that option and still be able to put in my own styles.
it would be nice to have access to the valid elements list through the interface.
Comment #2
rodrigoaguilerain \modules\wysiwyg\editors\tinymce.inc
edit
'advlink' => array(
'path' => $editor['library path'] .'/plugins/advlink',
'extensions' => array('advlink' => t('Advanced link')),
'extended_valid_elements' => array('a[name|href|target|title|onclick]'),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
'internal' => TRUE,
'load' => TRUE,
),
change it for
'advlink' => array(
'path' => $editor['library path'] .'/plugins/advlink',
'extensions' => array('advlink' => t('Advanced link')),
'extended_valid_elements' => array('a[name|href|target|title|onclick|rel|class]'),
'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
'internal' => TRUE,
'load' => TRUE,
),
I added to the extended valid elements the rel and class atributes
Comment #3
sunPlease test attached patch.
Comment #4
sunCommitted to all branches.
Comment #5
sunBetter title.
Comment #6
negative_sun CreditAttribution: negative_sun commentedPlease patch advimage settings as well - Lightbox2 also can be used on images.
Comment #7
sun@negative_sun: Please read http://drupal.org/node/156119
Comment #8
negative_sun CreditAttribution: negative_sun commentedStatus meant to me "not yet fixed".
What about patching advimage?
Should I create separate issue for it?
BTW: How I can setup email notifications like JIRA \ mantis?
Comment #9
sunAttached patch adds all configurable options of the advimage plugin.
Comment #10
negative_sun CreditAttribution: negative_sun commentedPlease add 'rel' tag to 'advimage' patch. By default Lightbox2 uses rel, not class.
Comment #11
negative_sun CreditAttribution: negative_sun commentedSorry, incorrect status again.
Comment #12
sunProper status would be "patch (code needs work)". However, I am pretty sure that Lightbox adds the "rel" attribute for the surrounding link and not to the IMG tag. Prove me wrong first.
Comment #13
stella CreditAttribution: stella commentedLightbox2 uses the
rel
attribute on links to determine if a lightbox should be triggered when the link is clicked.Now there is some automatic image handling built-in to Lightbox2. This allows Lightbox2 to support image links provided by modules such as image, brilliant gallery, gallery2, flickr, etc, where the user has no control over the HTML generated and hence can't add a rel attribute. In such cases, Lightbox2 looks at the class name on the image (note, image, not the anchor) and with a bit of javascript modifies the DOM to add the
rel
attribute to the link surrounding the image. This means when the image is clicked, it will actually be opened in a lightbox.I also extended this so users can specify a custom list of image class names, so as long as the user can enter in an anchor rel attribute or a class name for the image (still has to be a link though!), then it should work well with lightbox2.
I don't know what this means for Wysiwyg API module, but that's how Lightbox2 handles links.
Cheers,
Stella
Comment #14
sunThanks for providing some insight, Stella!
This means that adding a "rel" attribute here would be wrong. Also, AFAIK, semantically, a "rel" attribute makes only sense on an anchor, because it defines the relationship from one URL (link) to the current page.
Comment #15
spiffyd CreditAttribution: spiffyd commentedA general rule of thumb, I would add "rel" and "style" to all link arrays array('a[...]') and image arrays array('img[...]') to make sure no rel or style attributes get filtered out.
BTW, I found that this issue applies to TinyMCE module as well.
Someone should add this by default to the adv link array in the latest dev.
Comment #16
sunCommitted to all branches.
Comment #17
DolfAndringa CreditAttribution: DolfAndringa commentedHey all, I ran into this problem as well using tinymce and drupal 6.8. Your solution worked, only the file seemed strange to me. I couldn't find any file remotely similar to the one mentioned in the patch. A little digging turned up sites/all/modules/tinymce/plugin_reg.php. This contained the extended_valid_elements arrays and I changed the one for advlink. Just for the record if anyone runs into the same problem.
Comment #18
sun@smokeyd: This issue is about the Wysiwyg API module. Please read the notice on http://drupal.org/project/tinymce