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