The 'imagecache' attribute does not appear to stick when editing the HTML in the WYSIWYG editor. For example, when I enter:

[[nid:303; imagecache:mypreset]]

and the return to visual editing mode and back again to HTML, the code becomes:

[[nid:303]]

This appears to be because the attributes (other than 'styleName') are transferred to/from the editor using the HTML 'styles' attribute. On my browser (Firefox 3.6.13 on OS X 10.6), the style gets 'cleaned' and all invalid attributes are removed - including the 'imagecache' attribute - thereby causing this failure.

Comments

cmidgley’s picture

Status: Active » Needs review
StatusFileSize
new3.52 KB

I have made a patch to fix two problems:

1) The loss of the attributes that are non-compliant with HTML styles. Instead of passing the attributes in 'style' (and using 'rel' for the styleName), I changed the code to pass all attributes in 'rel' (as well as style, so that HTML styles like width/height continue to behave).

2) The ability to have the imagecache preset work during wysiwyg editing. This is done by passing a new querystring of 'imagecache=

' on the Only local images are allowed. tag (similar to how 'styleName' is passed), and also modified nrembrowser_media_display_thumbnail to receive the preset and pass it to imagecache. This patch is made to the latest dev version.
cmidgley’s picture

StatusFileSize
new3.17 KB

Found a problem with the prior patch ... when attributes are changed (like width, height and float) using WYSIWYG, those attributes would be lost. This was because the attributes were being adjusted in the html 'style' attribute, which the patch would ignore in favor of saving styles in 'rel'.

Attached is an updated patch that fixes this by merging attributes from 'style' and 'rel'. This way, if the browser loses any attributes in style, rel will continue to retain them. If however attributes are changed in style, they will take priority over the ones stored in rel.

emptyvoid’s picture

This looks pretty awsome, has anyone tested the patch and has it been committed to the dev branch?

clee_uftwf’s picture

Version: 6.x-1.x-dev » 6.x-1.0-beta16

My users have noticed a somewhat related quirk where toggling between the source & WSIWYG views will cause the styleName attribute to be duplicated. Please see http://drupal.org/node/1175766 for details.

I am using 6x-1.0-beta16 with drupal 6.