Hi again,

I've since fixed what was of course a bug caused by my inexperience with 
JavaScript.

Since my last post, I've managed to replace specific textareas on the page with 
the tinyMCE editor via double-click events and via means of a button.
I'm also able to remove the editor instance so that the textarea it is based 
upon is visible again, with the updated contents to boot. Finding the right 
command to do this was a bit hard, as the documentation is comprehensive, but 
large, and I am, as mentioned above, a relative JS newbie.

My problem now is: I want my editor instances to have functionality so that 
when I click a button in the editor, the changed content is saved, and the 
editor is replaced with the old markup that shows the content in a read-only 
div.

Declaring a custom button within tinyMCE is easy, I just write the name and 
function of the button.

My component works like this:
- if "showEditor" is false, a div displays the String content read-only. Then 
you can raise a component event in multiple ways (double-click something etc.) 
to set "showEditor" to true. Then the zone containing all my elements is Ajax 
refreshed.
- if "showEditor" is true, a textarea is rendered, but replaced with the 
tinyMCE editor.

The textarea is updated automatically when I remove the tinyMCE editor.
But I need a way to tell the component containing the editable content that it 
should update/commit the underlying db object, set "showEditor" to false and 
refresh the zone.

Jquery can define arbitrary events that can be triggered. I thought I could 
raise a JS event and handle it via "onEVENTNAME" on the Tapestry component 
side. But of course that doesn't work, probably because no event handlers are 
generated because no corresponding eventlink is created.

How can I achieve the link between the tinymce editor and the Tapestry side?

Regards,
Daniel P.

-----Ursprüngliche Nachricht-----
Von: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com] 
Gesendet: Freitag, 22. Mai 2015 15:45
An: Tapestry users
Betreff: Re: AW: Adding JS to my component combined with using t:If

On Fri, 22 May 2015 09:59:53 -0300, Poggenpohl, Daniel 
<daniel.poggenp...@isst.fraunhofer.de> wrote:

> Hello again and thanks for answering,

Hi!

> 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.

Have you checked the browser console for JavaScript errors? Are you actually 
invoking the init() function?

> What am I doing wrong? Do I have to use the mixin per injection in the 
> java file?

No.

--
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

Reply via email to