power-media / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

THtmlArea prone to double-registration, doesn't deregister properly #351

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run attached testcase
2. Observe results

What is the expected output? What do you see instead?
Showing and hiding THtmlArea controls dinamically should works fine, but in 
fact doesn't. After the 4th click on the button (2nd attempt to hide the 
THtmlAread) you either get a JavaScript error or a full page refresh (depending 
on your browsers type and debug settings).

What version of the product are you using? On what operating system?
Prado/trunk

Please provide any additional information below.
The issue is caused by THtmlArea not having proper life-cycle management on the 
client-side, which leads to both possible double-registration of the very same 
editors (for ex. when they get refreshed or re-shown in an active panel) and to 
failing to deregister editors properly with tinyMCE when needed (for ex. when 
they get hidden in an active panel, and thus are not present in the page 
anymore). This in turn leads to internal errors in tinyMCE when the latter 
tries to write back the contents of all the registered WYSIWYG editors (which - 
due to the above - might be either registered multiple times, or be lingering 
remnants of previously existing controls) to their appropriate <textarea> DOM 
elements when Prado active controls try to issue a new callback.  

The issue can be solved by introducing a client-side wrapper for the THtmlArea 
controls, which will manage THtmlArea registration and deregistration with 
tinyMCE properly. The attached fix does exactly that by making sure that it 
removes tinyMCE registrations for THtmlArea controls that have been removed, 
and also avoids having the same THtmlArea control registered multiple times 
because of partial page refreshes.

The fix also adds the ability to change a THtmlArea's options "on-the-fly" when 
being re-rendered/refreshed from a callback.

Original issue reported on code.google.com by google...@pcforum.hu on 21 Jul 2011 at 1:26

Attachments:

GoogleCodeExporter commented 8 years ago
patch applied as r3022

Original comment by ctrlal...@gmail.com on 21 Jul 2011 at 5:23