After installing the 7.x-2.3 update, the media browser supplied by Media WYSIWYG does not open. Media version is 7.x-2.0-rc1. The button code in the new version includes "href="javascript:void('Media browser')"". The button in the working version includes "href="javascript:void('Add media')"".

Comments

holtzman created an issue. See original summary.

TwoD’s picture

Status: Active » Postponed (maintainer needs more info)

I'm having no issues with the rc1 version of Media.

Which editor and version are you using?

Media module is responsible for the name of its plugin buttons, Wysiwyg module does not change it between versions.
Did you change the version of Media module as well?
The plugin's button name has always defaulted to 'Add media' as far as I can tell, but it is set using a variables so it may have been overridden.

Did you make sure to flush caches and run update.php after upgrading the files?

holtzman’s picture

Media was updated to rc1 before the WYSIWYG update. I ran update.php and cleared the caches after each update. The editor was CKEditor 3.6.0.6902. Updating to 4.6.1.580bcaf eliminates the problem: the button code is "Media browser", but it works as expected. So the problem is solved (for me) unless the CKEditor update causes other issues. Thanks for your quick reply.

cajewell’s picture

I had the same problem when I updated the wysiwyg module from 7.x-2.2 to 7.x.2-3. The media button worked fine with 2.2, but gave me the same javascript:void error in 2.3. I reinstalled 7.x-2.2 and the media button works again. I'm using Media 7.x-1.6 and CKEditor 3.5.0.6260. I did not update the Media module or CKEditor when I updated wysiwyg.

cajewell’s picture

Additional information - I have two other sites that are running Media 7.x-1.6 and CKEditor 4.2.0.f74e558. I upgraded the wysiwyg module from 7.x-2.2 to 7.x-2.3 and the media button works as expected.

TwoD’s picture

I'm not sure what to do about this as I can't reproduce it. If you're getting JS errors it could be because some old files are still cached by the browser.

@cajewell, if the site gets issues again when upgrading to 7.x-2.3, I could have a look at it.
Note that simply downgrading isn't supported as the editor profile structure changed between 7.x-2.2 and 7.x-2.3. It gets compensated for when running update.php after installing 7.x-2.3 but there's no way to handle that difference in reverse so a full reinstall of the older release is necessary. Or at least remove all profiles and add them again, but then you won't be able to run the upgrade path when trying the newer version again.

chriso’s picture

I had this happen to me just now, while updating a bit of contrib including wysiwyg 7.x 2.2 -> 2.3

The site in question has been running CKEditor 3.5.3 for some years, with media-7.x-1.x branch.

Steps I took to reproduce:

  • spin up a stack - Ubuntu 16.04, PHP 5.6, Apache 2.4, MySQL 5.6 in my case
  • download Drupal 7.54 and install with 'minimal profile'
  • $ drush dl wysiwyg media-1.6
  • $ drush en -y wysiwyg media field_ui
  • $ cd <drupal root>/sites/all/libraries
  • $ wget http://download.cksource.com/CKEditor/CKEditor/CKEditor%203.5.3/ckeditor_3.5.3.tar.gz
  • $ tar xzf ckeditor_3.5.3.tar.gz
  • create a text format called "wysiwyg" at admin/config/content/formats/add - selecting "Convert media tags to markup"
  • create a profile assigned to "wysiwyg" using CKEditor at admin/config/content/wysiwyg
  • add "Media browser" button at admin/config/content/wysiwyg/profile/wysiwyg/edit
  • create a content type "testing" at admin/structure/types/add
  • create a piece of content at node/add/testing

Expected result: media browser modal window opens.

Actual result: Console error thrown when clicking the button.

ckeditor-3.0.js?oljp8l:227 Uncaught TypeError: selection.getSelectedText is not a function
    at a.command.exec (ckeditor-3.0.js?oljp8l:227)
    at a.command.exec (ckeditor.js?oljp8l:20)
    at a.editor.execCommand (ckeditor.js?oljp8l:24)
    at k.button.e.extend.click (ckeditor.js?oljp8l:43)
    at Object.execute (ckeditor.js?oljp8l:44)
    at ckeditor.js?oljp8l:10
    at Object.callFunction (ckeditor.js?oljp8l:10)
    at HTMLAnchorElement.onclick (article:1)

Steps to fix - just drop in the most recent listed-as-supported version of CKEditor:

  • $ cd <drupal root>/sites/all/libraries
  • $ rm -r ckeditor*
  • $ wget http://download.cksource.com/CKEditor/CKEditor/CKEditor%204.6.1/ckeditor_4.6.1_standard.tar.gz
  • $ tar xzf ckeditor*
  • $ drush cc all

... and now the button works after a page reload at node/add/testing

I did some trial and error via the CKEditor release page and isolated it to CK v3.6.1 ... i.e. v3.6.1 works, but v3.6 and earlier seems not to work.

I haven't really dug through the changes on either the plugin or this module to spot just what happened where, but unless there's a quick obvious fix I'd suggest raising the minimum supported version for 7.x-2.3 to 3.6.1 rather than 3.0.0.

chriso’s picture

Category: Support request » Bug report

Respectfully shifting from support request to bug, since the issue is reproducible within the currently-stated supported versions of the CKEditor library.

TwoD’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

Ah, I see this is the same problem as in #2844609: Cross-editor plugin text selection regression., a regression in the latest version. A fix has been committed to the -dev version already and I'm going to make a follow-up release including it soon. Please help test the -dev snapshot and confirm it does indeed fix the dialog (else re-open this issue).