Hello, I'm a big fan of the media module, and against better judgement I've been using it on all sites I create since i discovered it about a year ago, because it is sooo the way forward. WIthout it Drupal is a cripple and of no use to anyone in the real world of developing web sites for real clients. So I'm waiting for it to mature and try to understand as much of the code as I can to find ways to help in development. I'm surprised at how slow the development is. In my view everyrone who cares about Drupal should do all they can to make this project rock solid. Drupal lacks good, standardized media handling.

So, now to my support request:
I need to allow the "usemap" attribute to be set through CKEditor (via Wysiwyg) but I just can't find the appropriate angle for attack. Does anyone have any help to offer? How do I make the usemap attribute in a <img usemap="somemap" src="img.png" /> tag stay when the page is rendered after adding it with Wysiwyg (ckeditor and imagamaps plugin) and not be filtered out by media.filter.inc.

Comments

leanderl’s picture

Title: usemao attribute for image in wysiwyg » usemap attribute for image in wysiwyg

fixed typo in title

leanderl’s picture

Issue summary: View changes

Fixed formatting of code

aendra’s picture

Assigned: Unassigned » aendra
StatusFileSize
new427.76 KB

Hi leanderl! Note that you can edit issues and note your changes in the "Log Message" field; no need to add a separate comment! :)

I've had the same problem as you and just created a patch that allows imagemaps via the Media WYSIWYG plugin -- necessary to use the Media WYSIWYG plugin with other WYSIWYG plugins like wysiwyg_imgmap (Which is awesome if you have to deal with image maps fairly regularly).

In reality though, there should be a config option somewhere that allows attributes to be specifically white/blacklisted. Any thoughts, Media maintainers?

aendra’s picture

Status: Needs work » Needs review

Forgot to change status to "needs review".

Edit: Don't use that patch -- it seems to have way more in it than I actually did. Reposting in a second.

Status: Active » Needs work

The last submitted patch, media-allow_usemap_attribute_with_wysiwyg-1844162-2.patch, failed testing.

aendra’s picture

Don't know how I fudged so simple a patch -- it's only one line. Regardless, here it is again.

Status: Needs review » Needs work

The last submitted patch, media-allow_usemap_attribute_with_wysiwyg-1844162-5.patch, failed testing.

aendra’s picture

Version: 7.x-2.0-unstable6 » 7.x-2.x-dev

Durr, need to update the issue to -dev for the test to work.

aendra’s picture

Status: Needs work » Needs review
aaron’s picture

Status: Needs review » Reviewed & tested by the community

I have tested it, and the patch appears to allow us to save the image map coordinates properly, but I am unable to get the map to actually work. However, when editing the node, I can see the coordinates saved, so I guess that this patch works.

aendra’s picture

@aaron -- Thanks! Re: image maps not working, what about when viewing source on the actual node; does it look like it does when viewing source in WYSIWYG? You might need to use the Full HTML input format if not.

Also, any thoughts on adding an allowed attributes field somewhere in WYSIWYG config?

aaron’s picture

This is the markup that I see. I am not familiar enough with an image map to know what this is doing. But it does not work the way that I would expect; I had placed a link to Drupal.org in a rectangular region of the image, while in WYSIWYG.

<img width="180" height="180" border="0" alt="" src="http://localhost/drupal/sites/default/files/styles/square_thumbnail/public/100_5909.JPG" typeof="foaf:Image" usemap="#imgmap201322135458" class="media-element file-preview" title=" ">

aendra’s picture

@aaron -- That's all of it? There's not a "map" element? I'm guessing something's stripping it out. See: https://developer.mozilla.org/en-US/docs/HTML/Element/map

ParisLiakos’s picture

testing this now, but wysiwyg_allowed_attributes is a variable, so it is easily overridable with sth like this

variable_set('media__wysiwyg_allowed_attributes', array(/* your attributes here*/));
ParisLiakos’s picture

Status: Reviewed & tested by the community » Fixed

i guess map element should be inserted by wysiwyg_imgmap module.attribute is correctly displayed so i went ahead and commited/pushed the patch
http://drupalcode.org/project/media.git/commit/8754c6b
thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Fixed typos