Ckeditor options disabled on Rules creation

When trying to create a rule, the buttons of the ckeditor are disabled.
To reproduce this you have to:

1.- Install drupal 7
2.- Install rules and rules_admin modules
3.- Install wysiwyg module with ckeditor
4.- Install media and media_wysiwyg modules
5.- Install workflow and workflow_admin_ui and workflow_rules
6.- Go to admin/config/content/formats and put the format "Full HTML" on top
7.- Go to admin/config/content/formats/full_html add check the option "Convert Media tags to markup"
8.- Go to admin/config/content/wysiwyg and add the ckeditor profile to "Full HTML" and add several buttons to the profile, including "Media browser"

Then:
When I go to Configuration > Workflow > Rules
And I click on Add new rule
And I fill in the following values:
_ name: "test"
_ React on event: "Node - Before saving a node"
And I click on Save
And I click on "Actions - Add action"
And I Select the action to add: "Data - Set a data value"
And I fill in the DATA Data selector with: "node:body"
And I click on Continue
Then on the page Editing action "Set a data value" I expect to be able to use the CKeditor features in the Value field
But most features are grayed out and none of them are working

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

enriquelacoma created an issue. See original summary.

enriquelacoma’s picture

This can be fixed by adding the media_wysiwyg.filter.js file

joseph.olstad’s picture

hi Enriquelacoma, can you please help me understand this issue better?
could you try reproducing this with the media_dev distribution, it uses media_wysiwyg.

does your patch work correctly when 'not' using the rules module?
both with and without rules?

would like to make sure this fix doesn't cause a regression.

enriquelacoma’s picture

Hi joseph

I have run these tests with the media profile, using the 7.x-2.x

Enable the rules and rules ui modules

.- In this case the result is the same when creating a rule without the patch, with the patch the ckeditor buttons are enabled.
.- With the patch applied, we can use the ckeditor when creating content

Disable the rules and rules ui modules

.- With the patch applied, we can use the ckeditor when creating content
.- Without the patch, we can use the ckeditor when creating content

Andras_Szilagyi’s picture

I installed media_dev
Then I installed rules and rules_admin modules
Then I install workflow and workflow_admin_ui and workflow_rules
Go to admin/config/content/formats and put the format "Full HTML" on top
Go to admin/config/content/formats/full_html, "Convert Media tags to markup" option was checked
Go to admin/config/content/wysiwyg and add the ckeditor profile to "Full HTML" and added all buttons to the profile

Then I followed add rule process from issue description "When I go to Configuration > Workflow > Rules.."
I found features are grayed out and none of them are working.

Then I applied path form #2, issue was fixed, buttons / features are working.
Then I disabled rules, when visiting pages with wysiwyg all buttoons and features are working.

Then I followed instructions as in description, issue was reproduced and fixed by patch.

Andras_Szilagyi’s picture

Status: Needs review » Reviewed & tested by the community

joseph.olstad’s picture

Status: Reviewed & tested by the community » Fixed

fixed in the dev branch

Status: Fixed » Closed (fixed)

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

joseph.olstad’s picture

Status: Closed (fixed) » Active
Related issues: +#3074774: PHP Notice while editing a node

this change caused a minor regression.
 #3074774: PHP Notice while editing a node

ayalon’s picture

This fix breaks WYSIWYG Editor with media inserts.

The issue is, that the Javascript File for the filter is added on the end of the function:

// Add filter handling.
$element['#attached']['js'][] = drupal_get_path('module', 'media_wysiwyg') . '/js/media_wysiwyg.filter.js';

Every WYSIWYG CKEditor with the media button for inline images will break, if you edit an existing node because the the $field['#value'] is not empty. I strongly recommend refactoring or reverting the patch.

  if (!empty($field['#value']) && $field['#value'] != '') {
    return $element;
  }

Uncaught TypeError: Cannot read property 'replaceTokenWithPlaceholder' of undefined
at Object.attach (wysiwyg-media.js?pxm9sh:77)
at CKEDITOR.htmlDataProcessor.toHtml (ckeditor-3.0.js?pxm9sh:168)
at $.setData (ckeditor.js?pxm9sh:934)
at $. (ckeditor.js?pxm9sh:375)
at a.m (ckeditor.js?pxm9sh:10)
at a. (ckeditor.js?pxm9sh:12)
at a.CKEDITOR.editor.CKEDITOR.editor.fire (ckeditor.js?pxm9sh:13)
at a.setData (ckeditor.js?pxm9sh:277)
at b (ckeditor.js?pxm9sh:930)
at Object.wysiwyg (ckeditor.js?pxm9sh:932)

Andras_Szilagyi’s picture

Hi @ayalon,

I cant reproduce, could you provide some steps?

Thank you.

joseph.olstad’s picture

If you're having configuration issues with the media module, I've added a new sub module/feature that provides working default configuration

Try the latest release of media and if your media embedding is unsatisfactory, try the new sub module which shows up in the 'User interface' group of modules.

I have provided one of these modules for those using the wysiwyg module (the settings module is in the media project) and another one for those using the ckeditor module (that settings module /feature is in the media_ckeditor project latest version)

When in doubt, check with the latest media recipe for installation/configuration and troubleshooting instructions.

joseph.olstad’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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