Rank: Newbie Groups: Member
Joined: 3/1/2011 Posts: 7
|
Hi,
After an execCommand("InsertHTML", "<img />") every access to the editor's content does not yet reflect the inserted HTML, namelly: getBody(), getCurrentElement(), getHtml(), getSelection() and getText(). Is there a way to access the HTML object inserted by a InsertHTML command in an Editor?
thank you
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
This behavior is by design. You will need to wait for a little while (> 100ms) with setTimeout before you can access the updated value. The reason is in order to update the selection, the editing area must have focus first. However while you are calling execCommand from your toolbar button, your focus is away from the editing area. This makes it impossible to update the editor contents before your handler returns. As a result, the actual update is delayed until after your handler returns. Thus you will need to wait after that in order to get the updated value.
Thanks!
|