Commit 6bf6d580 authored by sun's avatar sun

#270780 by sun: Fixed TinyMCE 3 support for external plugins.

parent 9e04acaf
......@@ -6,6 +6,7 @@ Wysiwyg x.x-x.x, xxxx-xx-xx
Wysiwyg 6.x-x.x, xxxx-xx-xx
---------------------------
#270780 by sun: Fixed TinyMCE 3 support for external plugins.
#309832 by sun: Fixed README.txt.
#253600 by sun: Changed editor integration so that client-side editors attach to
input formats instead of textareas and are invoked for input format enabled
......
......@@ -26,10 +26,9 @@ Drupal.wysiwyg.init.tinymce = function(editorSettings) {
tinyMCE.init(config);
}
// @todo Move into global library settings.
// @todo Plugin architecture is completely different in 3.x.
// for (var plugin in Drupal.settings.wysiwygEditor.plugins.tinymce) {
// tinyMCE.loadPlugin(plugin, Drupal.settings.wysiwygEditor.plugins.tinymce[plugin]);
// }
for (var plugin in Drupal.settings.wysiwygEditor.plugins.tinymce) {
tinymce.PluginManager.load(plugin, Drupal.settings.wysiwygEditor.plugins.tinymce[plugin] + '/editor_plugin.js');
}
}
/**
......
......@@ -180,18 +180,16 @@ function wysiwyg_editor_profile_form($form_state, $profile) {
foreach ($plugins as $name => $meta) {
if (isset($meta['buttons']) && is_array($meta['buttons'])) {
foreach ($meta['buttons'] as $button => $title) {
// @todo Button icon locations are different in editors, editor versions,
// and contrib/custom plugins (like Image Assist, f.e.).
$img_src = $meta['path'] ."/images/$name.gif";
// Handle plugins that have more than one button.
if (!file_exists($img_src)) {
$img_src = $meta['path'] ."/images/$button.gif";
}
$icon = file_exists($img_src) ? '<img src="'. base_path() . $img_src .'" title="'. $button .'" style="border: 1px solid grey; vertical-align: middle;" />' : '';
if (isset($meta['url'])) {
$title = $icon .' '. l($title, $meta['url'], array('attributes' => array('target' => '_blank')));
}
else {
$title = $icon .' '. $title;
}
$title = (isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title);
$title = (!empty($icon) ? $icon .' '. $title : $title);
$form['buttons'][$name][$button] = array(
'#type' => 'checkbox',
'#title' => $title,
......@@ -201,15 +199,9 @@ function wysiwyg_editor_profile_form($form_state, $profile) {
}
else if (isset($meta['extensions']) && is_array($meta['extensions'])) {
foreach ($meta['extensions'] as $extension => $title) {
if (isset($meta['url'])) {
$title = l($title, $meta['url'], array('attributes' => array('target' => '_blank')));
}
else {
$title = $title;
}
$form['buttons'][$name][$extension] = array(
'#type' => 'checkbox',
'#title' => $title,
'#title' => isset($meta['url']) ? l($title, $meta['url'], array('target' => '_blank')) : $title,
'#default_value' => !empty($profile->settings['buttons'][$name][$extension]) ? $profile->settings['buttons'][$name][$extension] : FALSE,
);
}
......
......@@ -360,6 +360,12 @@ function wysiwyg_editor_add_plugin_settings($profile) {
$plugins = array();
$editor = wysiwyg_get_editor($profile->settings['editor']);
$info = module_invoke_all('wysiwyg_plugin', $editor['name'], $editor['installed version']);
// Only keep enabled plugins in this profile.
foreach ($info as $plugin => $meta) {
if (!isset($profile->settings['buttons'][$plugin])) {
unset($info[$plugin]);
}
}
if (isset($editor['plugin settings callback']) && function_exists($editor['plugin settings callback'])) {
$plugins = $editor['plugin settings callback']($editor, $profile, $info);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment