0

I have several classes defined inside style.css, I want tinymce to recognize these classes. Below is the popup to configure hyperlinks. It also provide a way to use css styles defined already.

enter image description here

I am looking for a way to add the css class to tinymce inside wysiwyg editor in Drupal 7.

5
  • Which module you are using? tinymce or wysiwyg?
    – Jimmy Ko
    Commented Dec 14, 2016 at 10:25
  • @JimmyKo: module is wysiwyg and library is tinymce
    – ravi
    Commented Dec 14, 2016 at 11:56
  • What is the version of tinymce?
    – Jimmy Ko
    Commented Dec 14, 2016 at 12:05
  • @JimmyKo: Version 3.5.11
    – ravi
    Commented Dec 14, 2016 at 12:21
  • I have updated my answer. Please try.
    – Jimmy Ko
    Commented Dec 14, 2016 at 12:37

1 Answer 1

1

As you are using wysiwyg module with tinymce library. You should implement the alter function provided by wysiwyg module to add the editor settings.

For tinymce 4.x:

function MYMODULE_wysiwyg_editor_settings_alter(&$settings, $context) {
  if ($context['profile']->editor == 'tinymce') {
    $settings['link_class_list'] = array(
      "Class Example" => "class-example",
    );
  }
}

For tinymce 3.x:

function MYMODULE_wysiwyg_editor_settings_alter(&$settings, $context) {
  if ($context['profile']->editor == 'tinymce') {
    $settings['theme_advanced_styles'] = array(
      "Class Example" => "class-example",
    );
  }
}

References

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.