De base le bouton qui permet de désactiver / activer tinymce ne fonctionne pas !
Afin de rendre fonctionnel le bouton de tinymce “disable rich text”, il faut modifier le fichier tinymce.module :
--- tinymce.module 2008-04-08 09:53:01.000000000 -0400
+++ tinymce.fixed.module 2008-04-08 09:46:29.000000000 -0400
@@ -161,8 +161,8 @@
link = document.getElementById(linkid);
img_assist = document.getElementById('img_assist-link-'+ id);
- if (tinyMCE.getEditorId(element.id) == null) {
- tinyMCE.addMCEControl(element, element.id);
+ if (tinyMCE.get(element.id) == null) {
+ tinyMCE.execCommand('mceAddControl',false,element.id);
element.togg = 'on';
link.innerHTML = '$disable';
link.href = "javascript:mceToggle('" +id+ "', '" +linkid+ "');";
@@ -171,7 +171,7 @@
link.blur();
}
else {
- tinyMCE.removeMCEControl(tinyMCE.getEditorId(element.id));
+ tinyMCE.execCommand('mceRemoveControl',false,element.id);
element.togg = 'off';
link.innerHTML = '$enable';
link.href = "javascript:mceToggle('" +id+ "', '" +linkid+ "');";
@@ -195,10 +195,10 @@
if (img_assist) {
var img_assist_default_link = img_assist.innerHTML;
if ('$img_assist_link' == 'yes') {
- img_assist.innerHTML = tinyMCE.getEditorId('edit-$textarea_name') == null ? '' : img_assist_default_link;
+ img_assist.innerHTML = tinyMCE.get('edit-$textarea_name') == null ? '' : img_assist_default_link;
}
else {
- img_assist.innerHTML = tinyMCE.getEditorId('edit-$textarea_name') == null ? img_assist_default_link : '';
+ img_assist.innerHTML = tinyMCE.get('edit-$textarea_name') == null ? img_assist_default_link : '';
}
}
if (typeof(document.execCommand) == 'undefined') {
@@ -245,6 +245,12 @@
// Load a TinyMCE init for each textarea.
if ($init) drupal_add_js($tinymce_invoke, 'inline');
+ //settings are saved as strings, not booleans
+ if ($profile->settings['show_toggle'] == 'true') {
+ // Make sure to append to #suffix so it isn't completely overwritten
+ $element['#suffix'] .= $wysiwyg_link;
+ }
+
// Set resizable to false to avoid drupal.js resizable function from taking control of the textarea
$element['#resizable'] = FALSE;
}
source : http://drupal.org/node/244066
0 commentaires jusqu'à présent ↓
Il n'y a pas encore de commentaire… Donnez le coup d'envoi en complétant le formulaire ci-dessous.