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.
Using Media Browser in wysiwyg: After inserting a file (pdf) into the body, how can you by using media/browser add the attribute: target="_blank"?
Hopefully this is a simple item to answer, I was not successful with searching past issues or Googling for an example/resolution.
Comments
Comment #2
ErikHendrick CreditAttribution: ErikHendrick commentedComment #3
MastaP CreditAttribution: MastaP commentedI am also looking for a solution regarding this. Is there any? Thanks!
Comment #4
ErikHendrick CreditAttribution: ErikHendrick as a volunteer commentedI cannot recall if we resolved this on the project, or if not, how we worked around it. Sorry I can't be more helpful.
Comment #5
koosvdkolk CreditAttribution: koosvdkolk commented+1
Comment #6
joseph.olstadwhat version of media
what version of wysiwyg , or are you using media_ckeditor instead?
what version of ctools
what version of token
what version of multiform if using it
what version of drupal core
what version of file_entity
what version of ckeditor/tinymce
have you tried the recipe?
also, if you are using ckeditor, have you turned off the advanced content filtering ACF ? given that its probably not configured correctly should you be observing this.
are there custom tpls in play ? have you enabled theme debugging to determine this?
Comment #7
medinasod CreditAttribution: medinasod commented@joseph.olstad I'm having this issue too. Is it functionality that is supposed to exist? Here's my env info:
what version of media: Tried 7.x-2.0-beta1 and 7.x-2.20
what version of wysiwyg , or are you using media_ckeditor instead: Wysiwyg 7.x-2.4
what version of ctools: 7.x-1.12
what version of token: 7.x-1.6
what version of multiform if using it: Not using multiform
what version of drupal core: 7.59
what version of file_entity: 7.x-2.0-beta2
what version of ckeditor/tinymce: TinyMCE 4.5.7
Thanks for any help you can offer.
Comment #8
joseph.olstadso you just want to add the target _blank?
Comment #9
medinasod CreditAttribution: medinasod commentedYes, we don't have an option for doing that when uploading and or linking to files in the wysiwyg.
Comment #10
joseph.olstadeasy enough to write a patch to do this, just use jQuery with a css selector that looks for the pdf extension
when it finds it, insert target _blank attribute.
You could make the behavior optional using a media setting (variable_get / variable_set and pass that setting into the javascript using settings.
Comment #11
medinasod CreditAttribution: medinasod commentedThank you for the tips. I'll look into it.
Comment #12
joseph.olstadI'll review any patches for this, thanks.