Welcome Guest Search | Active Topics | Sign In | Register

Acessing inserted HTML after execCommand on HTML Editor Options
ztp
Posted: Monday, March 7, 2011 12:53:20 PM
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
eo_support
Posted: Monday, March 7, 2011 1:32:12 PM
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!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.