refinerycms icon indicating copy to clipboard operation
refinerycms copied to clipboard

Adding "ref" attribute to img tag gets stripped by refinery's wysiwyg.

Open 0x73706f6f6b opened this issue 14 years ago • 5 comments

After creating a new page and adding the following line of code:

Images

Refinery's wysiwyg strips the ref attribute and saves everything else. Is there something I can change in settings to allow the wysiwyg to save this attribute without any issues. Or would this be considered a bug ?

0x73706f6f6b avatar Dec 21 '11 03:12 0x73706f6f6b

Is the "ref" attribute an official attribute that should go on ? Or could you use data-ref instead? :-)

parndt avatar Dec 21 '11 03:12 parndt

Actually it's part of a jquery plugin I'm currently implementing (Pikachoose). Apparently they chose to use the "ref" attribute for calling in larger images. Haven't had any issues using this plugin before but today I did encounter the issue when using Refinery.

0x73706f6f6b avatar Dec 21 '11 03:12 0x73706f6f6b

Right.. it's because it's an illegal attribute on 'img' that it's being stripped away.

wymeditor (the visual editor) has a 'whitelist' of attributes and this isn't on it so it gets stripped away.

There's some more context in this post: http://groups.google.com/group/refinery-cms/browse_thread/thread/f245fc70eac8d275/0e25e2bf3c5e1ad0?lnk=gst&q=whitelist#0e25e2bf3c5e1ad0

parndt avatar Dec 21 '11 03:12 parndt

Here's the exact reference to the part of the file that defines attributes for "img":

https://github.com/resolve/refinerycms/blob/1-0-stable/core/public/javascripts/wymeditor/jquery.refinery.wymeditor.js#L2456

So you'd need to insert after "7": "rel" this: "8": "ref"

Then it'd stop stripping it away. To do this you need to override the editor's JS file.. I think this will work:

rake refinery:override javascript=wymeditor/jquery.refinery.wymeditor

parndt avatar Dec 21 '11 03:12 parndt

Figured, thanks again for the post URL.

0x73706f6f6b avatar Dec 21 '11 03:12 0x73706f6f6b