Hello again and thanks for answering, I removed the <script> from the beginning of the component template and created a mixin like on http://metacoder.de/entry/TinyMCE-Mixin-in-Tapestry-5---Version-2-4 .
From what I understand, when this mixin is placed on a Tapestry component, I declare the underlying client element to be editable with TinyMCE, i.e. replaced with the TinyMCE editor. But when I create a page containing some textarea in a form, import the tinyMCE.js, and put the mixin on the textarea in the tml, the editor is not started. What am I doing wrong? Do I have to use the mixin per injection in the java file? Regards, Daniel P. -----Ursprüngliche Nachricht----- Von: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com] Gesendet: Freitag, 22. Mai 2015 14:32 An: Tapestry users Betreff: Re: Adding JS to my component combined with using t:If On Fri, 22 May 2015 07:01:14 -0300, Poggenpohl, Daniel <daniel.poggenp...@isst.fraunhofer.de> wrote: > Hello everyone, Hi! > I am trying to add the capabilities of a WYSIWYG editor to my Tapestry > 5.3.8 project, namely TinyMCE. > > I have some questions regarding use of JavaScript in my pages/components: > > > 1) Reading https://tapestry.apache.org/legacy-javascript.html , the > preferred way to reference a javascript library is to use the @Import > annotation and not referencing via <script src> in the tml file. If I > do it the second way and reference the script in a component that is > used multiple times on the same page, it is not ensured that the > javascript is added only once to the resulting source. Am I correct? Yep! > 2) TinyMCE is used via an "init" method that has a "selector" > argument to choose which html elements will be replaced with the editor. > I placed the "init" method at the beginning of the component > containing the elements to be replaced. You're calling this init() function directly in the .tml, like <script>init()</script>? Hmm, not good. Use JavascriptSupport.addScript() instead. This guarantees that you dynamically-added script will be executed after the imports. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org