Jump to content

impossible de faire marcher tinymce sur un module


Recommended Posts

Bonjour à tous.

 

Je suis bloqué sur la mise à jour d'un module prestashop.

Il affiche un textarea tinymce, mais je n'arrive pas à le faire marcher sur presta 1.5

 

Je ne vois pas ce qui bloque.

Je n'utilise pas le multilangue sur mon textarea, il n'y en a pas besoin.

 

Ce que j'ai et qui marchait jusqu'à 1.4.8.2 (pas testé sur des versions postérieures) :

 

 // TinyMCE
 if (version_compare(_PS_VERSION_, '1.4.0.0') >= 0 && substr(_PS_VERSION_,0,5)!="1.4.0")
 {
 global $cookie;
 $iso = Language::getIsoById((int)($cookie->id_lang));
 $isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
 $ad = dirname($_SERVER["PHP_SELF"]);
 $this->_html.=
 '<script type="text/javascript">
  var iso = \''.$isoTinyMCE.'\' ;
  var pathCSS = \''._THEME_CSS_DIR_.'\' ;
  var ad = \''.$ad.'\' ;
  </script>
  <script type="text/javascript" src="'.__PS_BASE_URI__.'js/tiny_mce/tiny_mce.js"></script>
  <script type="text/javascript" src="'.__PS_BASE_URI__.'js/tinymce.inc.js"></script>
  <script language="javascript">id_language = Number('.(int)($cookie->id_lang).');</script>';
 }
		$this->_html.= '
 <textarea aria-hidden="true"  class="autoload_rte" cols="70" rows="30" id="body_email" name="body_email" style="width:100%; height: 300px;">
			'.Tools::getValue('body_email').'
 </textarea>

 

Le textarea est affiché, mais sans rien de tinymce.

 

Donc, si vous voyez ce que j'ai oublié, je suis preneur.

Edited by pppplus (see edit history)
Link to comment
Share on other sites

Salut,

 

Tu devrais te baser sur le Canvas de module pour 1.5 : http://www.prestashop.com/forums/index.php?/topic/188181-doc-canvas-de-module/page__view__findpost__p__930335

 

Pour ajouter un champs tinymce, il suffit d'ajouter un champs dans le array correspondant:

                 array(
                    'type' => 'textarea',
                    'label' => $this->l('Description:'),
                    'name' => 'description',
                    'lang' => true,
                    'autoload_rte' => true, // Cette ligne active tinymce sur le champs
                    'rows' => 10,
                    'cols' => 100,
                    'hint' => $this->l('Invalid characters:').' <>;=#{}'
                ),

 

Cordialement

Edited by Matt75 (see edit history)
Link to comment
Share on other sites

Ca ne m'a pas aidé, mais j'ai finalement fini par trouver mon problème !

Je n'avais pas vu qu'il fallait ajouter :

 

  $(document).ready(function(){

 tinySetup({
  editor_selector :"autoload_rte",
  theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull|cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,undo,redo",
  theme_advanced_buttons2 : "link,unlink,anchor,image,cleanup,code,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,charmap,media,|,ltr,rtl,|,fullscreen",
  theme_advanced_buttons3 : "",
  theme_advanced_buttons4 : ""
 });

  });

 

Avec ce bout de code manquant, ça va mieux !!

Link to comment
Share on other sites

  • 3 months later...

Ca ne m'a pas aidé, mais j'ai finalement fini par trouver mon problème !

Je n'avais pas vu qu'il fallait ajouter :

 

  $(document).ready(function(){

 tinySetup({
  editor_selector :"autoload_rte",
  theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull|cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,undo,redo",
  theme_advanced_buttons2 : "link,unlink,anchor,image,cleanup,code,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,charmap,media,|,ltr,rtl,|,fullscreen",
  theme_advanced_buttons3 : "",
  theme_advanced_buttons4 : ""
 });

  });

 

Avec ce bout de code manquant, ça va mieux !!

 

 

Bonsoir, pouvez-vous me dire svp où se trouve ce bout de code?

 

Merci d'avance

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...