After spending 2 hours reading and searching for information, I've understood that I can use a hook to add new buttons into my textarea (hook_wysiwyg_editor_settings_alter) so I've created a module to add buttons to my markItUp textarea, copying from the HTMl set downloaded from markItUp official website.

But I cant change the theme. I've tried $settings['theme'] = 'markitup'; but doesnt work, the only way of changing theme that worked for me was to edit editors/markitup.inc core module file, but I dont like to change this, would love to find a way to change the theme from my hook.

And I cant change from where my set loads images. No mather what, it will always load images from the default set. So in the markitup.js core module file I've found this line:

.css({ backgroundImage: 'url(' + settings.root + 'sets/default/images/' + button + '.png' + ')' })

where it can be clearly seen that the img path is hardcoded to the default set. Is there anyway I can change this without changing core, or if I have to change it, where should I add set variable?

Thanks!

Comments

mbavio’s picture

No one can help me here?

twod’s picture

What did you have to edit in markitup.inc to get the theme working?
What you change in the $settings variable should override anything set by that file since the hook runs last.

I haven't worked with markitUp for a while (and technically speaking, we don't yet support custom sets because of all the hardcoded things in them) so I don't know if there's a way to avoid running the codepath which adds the hardcoded style you mention.

Encarte’s picture

+1

SilverBallz’s picture

The only way I've found to make the theme work is to open markitup.inc and replace

function wysiwyg_markitup_themes($editor, $profile) {
  return array('simple', 'markitup');
}

with

function wysiwyg_markitup_themes($editor, $profile) {
  return array('markitup', 'simple');
}

Maybe the simple theme is not the best choice as the default theme for the wysiwyg module as suggested once upon a time.

So far I have been able to replace the contents of /sites/all/libraries/markitup/markitup/skins/markitup/ with the contents of the theme of your choosing.

twod’s picture

Hmm, markitup doesn't have a theme setting, which is why wysiwyg/editors/markitup.inc basically does drupal_add_css($editor['library path'] . '/markitup/skins/' . $theme . '/style.css'). It's not possible to override that using $settings['theme'] = 'whatever'; in hook_wysiwyg_editor_settings_alter(), as the stylesheet has already been added and there is no $settings['theme'].

I think it'd be possible to override what's added by drupal_add_css() though, using the regular CSS override behavior in the settings hook. That is, add a new CSS file with the same [base] name as the old one. The default base name would be 'markitup.simple.style.css', so if you add a stylesheet with that name, it should work.
I haven't tested it yet though.