Hello everyone,

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?

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. I then chose the editable element to be an element 
inside an <t:If>.
The editor is not shown because the element that is editable is only shown 
after an event happens (i.e. clicking).

My component works like this:
- If the component has no content, nothing is shown in a content field. You can 
click on the content field to activate the editor.
- If the component has content, it is shown in a pure read-only field. When you 
double-click on the content field, the editor should be shown instead.
- The above is done by refreshing zones and toggling Boolean values.

How should I do it right? Creating a mixin that receives the script?

Regards,
Daniel P.

Reply via email to