WYSIWYG-inserted images are currently unable to retain ckeditor altered attributes, such as alignment. This patch merges formattedMedia.options and mediaFile.attributes together. This was a change I made when working on #2067063, but it doesn't appear to have been incorporated into #2067063 or any of its child issues.

Comments

drupal_was_my_past’s picture

Status: Active » Needs review
StatusFileSize
new531 bytes

Here's the patch.

genjohnson’s picture

The patch in #1 works for me.

gmclelland’s picture

Would this patch fix the problem in #2028255: ckeditor styles break media module markup? The problem where applying Ckeditor styles(css classes) to media items breaks the media token?

justmagicmaria’s picture

Patch #1 worked for me except when the image uses the Colorbox display. Then the attributes from the image ckeditor pop=up are not saved.

bneil’s picture

Using a new install of the media_dev profile, I can add CKEditor style markup without the need for this patch. WYSIWYG module + CKEditor library 3.6.6.1.7696. However, the styles do not apply if "Link image to" is set to file or content at admin/structure/file-types/manage/image/file-display/view-mode.

Is this a CKEditor 4.x issue only?

rwohleb’s picture

Status: Needs review » Reviewed & tested by the community

Patch #1 works for me as well. Doing something like changing alignment in CKeditor and then adjusting the image's format via the media popup no longer loses the style attributes. The problem @justmagicmaria mentioned sounds like something outside of wysiwyg_allowed_attributes is needed.

Marking this is RTBC since it's such a simple change and more than one of us has tested it.

rwohleb’s picture

This patch, along with the one from #2126697: Wysiwyg -- Alt and Title fields require some special handling. goes a long way to address this type of sync issue.

The #2018075: Media inline filter: Delegate "float" to outer element patch is also very useful in combination with the above.

mkhamash’s picture

I have re-rolled the patch in #1 to work with the latest change to media media.popups.js file introduced in (Improved JS doxygen [2095d6b9]).

mkhamash’s picture

StatusFileSize
new588 bytes
rajab natshah’s picture

+1 Reviewed and Tested

joseph.olstad’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Reviewed & tested by the community » Needs review

Not sure if we need this anymore, as we now have the optional dropdown for image alignment none|right|left|centre
however, this might still work with the new functionality. so it might be worth reviewing still.

would require re-testing with newest versions of media 7.x-2.1 or 7.x-3.0-alpha5

need to test this also with ckeditor media_ckeditor / or wysiwyg with TinyMCE or other.

gmclelland’s picture

StatusFileSize
new149.59 KB

This wouldn't just be for alignment. I would like to be able to add a css style from the styles dropdown to add a padded border around an inserted image or a linked imaged.

See the picture below for an example:
Image with border

  • mkhamash authored ccdee8b on 7.x-3.x
    Issue #2148641 by drupal_was_my_past, mkhamash, gmclelland: WYSIWYG-...

  • mkhamash authored 89a7870 on 7.x-2.x
    Issue #2148641 by drupal_was_my_past, mkhamash, gmclelland: WYSIWYG-...
joseph.olstad’s picture

Status: Needs review » Fixed

fixed in 7.x-2.x dev and 7.x-3.x dev

Status: Fixed » Closed (fixed)

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