|
Rank: Advanced Member Groups: Member
Joined: 8/4/2007 Posts: 42
|
I need to modify the Editor to do an Upload and Insert an Image function instead of the current Url input function. I have the AJAXUploader working properly as per your Attachements Demo. What I need to do now is upon FileUploaded Event somehow insert at the cursor in the Editor the link to the image in the FinalFileLocation directory.
<img src="Upload/image.jpg" />
This is so on a website the user can upload a file to display in the editor and eventually post. When they post we'll add the uploaded file as CID: attachements to the message.
I just don't get how to insert text programatically at the cursor while editing
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Hi, I believe you can call execCommand method on the editor to insert any HTML at the cursor: http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.Editor.execCommand.htmlYou would use "InsertHTML" command. You will need to use some kind of AJAX solution that captures the Uploader's FileUploaded event (which you probably already have in place) and then pass the Url of the uploaded files to the client side in order to call execCommand though. Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 8/4/2007 Posts: 42
|
I've been able to pass the image path information after the Upload using the CallBackPanel.Execute event in the CallbackEventArgs Data property. On the Client side I have a CallbackAfterUpdate event handler that finds the editor and does the insert.
Code: JavaScript
function after_update(sender, data)
{
if (data.length > 0)
{
oEditor = eo_GetObject('HtmlEditor1');
oEditor.execCommand('InsertHTML','<img src="' + data + '" />');
}
}
This inserts the image, but it _always inserts it in the first position of the editor field instead of at the cursor insertion point. Can't seem to get InsertHTML to do anything else.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
That's interesting. We will look into it and see what we can find.
|
|
Rank: Advanced Member Groups: Member
Joined: 8/4/2007 Posts: 42
|
More and further. It inserts in the first position with IE7. With Firefox and Safari it inserts correctly at the cursor position. Opera won't accept the added toolItems. Opera also will not run your AJAXUploader Toolbar demo.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Thanks for the additional information!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,193
|
Both issues have been fixed in build 2008.0.35 (6.0.35).
|
|