the wysiwyg when selecting a file
Usually, when selecting a file in the WYSIWYG, the media button becomes highlighted indicating you can click and edit the file.

the wysiwyg when selecting a file using an alternative view mode
However, when a file is embedded using the "default" view mode, the button is not highlighted when selected. This means there is also no way to change the file to a different view mode without editing the media token markup.

Comments

aaron’s picture

I confirm this behavior. I am surprised that I hadn't caught that before. it does this when the display formatter is set to "generic file" or to nothing. It works if the default formatter is changed to an image.

aaron’s picture

The issue seems a bit complex. First, it is looking for an image of media-element, but is receiving the default of file-icon. If I change it to look as well for file-icon, then the icon for the media browser does show that it is selected, but the button stops working entirely.

This is what I tried in wysiwyg-media.js:

  isNode: function(node) {
    return $(node).is('img.media-element') || $(node).is('img.file-icon');
  },
aaron’s picture

Issue tags: +7.x-2.0 alpha blocker

Adding tags.

ParisLiakos’s picture

i dont think this is an alpha blocker.
A stable/beta blocker? could be..but UI polish should not be a priority for now imo

aaron’s picture

ParisLiakos’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new371 bytes
new5.44 KB
new5.56 KB

Thats the best we can do now..using the path and selecting the span element it works

alexkb’s picture

We have a situation where the media button will only show depressed when the image is inserted as the default mode. Any other display mode, causes the media button not to be depressed on selection.

@Parisliakos I've tried your patch on the latest dev, and adjusted to suit the new module, but it didn't seem to make much difference.

diff --git a/docroot/sites/all/modules/contrib/media/modules/media_wysiwyg/js/wysiwyg-media.js b/docroot/sites/all/modules/contrib/media/modules/media_wysiwyg/js/wysiwyg-media.js
index ac5bf4d..b8e104f 100644
--- a/docroot/sites/all/modules/contrib/media/modules/media_wysiwyg/js/wysiwyg-media.js
+++ b/docroot/sites/all/modules/contrib/media/modules/media_wysiwyg/js/wysiwyg-media.js
@@ -20,7 +20,7 @@ Drupal.wysiwyg.plugins.media = {
    *   A DOM element
    */
   isNode: function(node) {
-    return $(node).is('img.media-element');
+    return $(node).is('.media-element');
   },
   /**
    * Execute the button.
alexkb’s picture

Ok, skip that, all fixed with patch from #19 here: https://drupal.org/comment/8211971#comment-8211971

bneil’s picture

Component: WYSIWYG integration » Code
Status: Needs review » Closed (duplicate)

Duplicating this issue in favor of #2126755: Improve Media's WYSIWYG Macro handling based on comment 8.