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

Bodigiti created an issue. See original summary.

ErikHendrick’s picture

Title: Target Attribute via Media Upload Widget » Target Attribute via Media Browser Widget
MastaP’s picture

I am also looking for a solution regarding this. Is there any? Thanks!

ErikHendrick’s picture

I cannot recall if we resolved this on the project, or if not, how we worked around it. Sorry I can't be more helpful.

koosvdkolk’s picture

+1

joseph.olstad’s picture

Version: 7.x-2.0-alpha3 » 7.x-2.x-dev
Status: Active » Postponed (maintainer needs more info)

what 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?

medinasod’s picture

@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.

joseph.olstad’s picture

so you just want to add the target _blank?

medinasod’s picture

Yes, we don't have an option for doing that when uploading and or linking to files in the wysiwyg.

joseph.olstad’s picture

easy 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.

medinasod’s picture

Thank you for the tips. I'll look into it.

joseph.olstad’s picture

Status: Postponed (maintainer needs more info) » Active

I'll review any patches for this, thanks.