This is a migrated thread and some comments may be shown as answers.

I have a problem with the InsertEmoticon

1 Answer 31 Views
Editor
This is a migrated thread and some comments may be shown as answers.
dan
Top achievements
Rank 1
dan asked on 31 Dec 2008, 01:35 PM
 I have a problem with the InsertEmoticon

This is my code:

 

// Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "",

 

 

//"<script type=\"text/javascript\">function OnClientCommandExecute(editor, args){var name = args.get_name();var val = args.get_value();if (name == \"Emoticons\"){editor.pasteHtml(\"<img src='\" + val + \"'>\");args.set_cancel(true);}");

 

 

 

 

//Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "smile",

 

 

// " <script type=\"text/javascript\">" +

 

 

// " //<![CDATA[" +

 

 

// " Telerik.Web.UI.Editor.CommandList[\"InsertEmoticon\"] = function(commandName, editor, args)" +

 

 

// " {" +

 

 

// " var myCallbackFunction = function(sender, args)" +

 

 

// " {" +

 

 

// " editor.pasteHtml(String.format(\"<img src='{0}' border='0' align='middle' alt='emoticon' /> \", args.image));" +

 

 

// " }" +

 

 

// " editor.showDialog(\"InsertEmoticon\", {}, myCallbackFunction);" +

 

 

// " };" +

 

 

// " //]]>" +

 

 

// "</script>");

 

 

//main.Tools.Add(new EditorTool("InsertEmoticon"));

 

 

 

 

EditorDropDown x = new EditorDropDown("InsertEmoticon");

 

 

x.Items.Add(

new EditorDropDownItem("<IMG SRC='pages/emoticons/21.gif' />", "pages//emoticons/icon_wink.gif"));

 

main.Tools.Add(x);

 

DialogDefinition insertEmoticonDialogDefinition = new DialogDefinition("~/pages/InsertEmoticon.ascx", new DialogParameters());

 

insertEmoticonDialogDefinition.Modal =

true;

 

insertEmoticonDialogDefinition.VisibleTitlebar =

true;

 

insertEmoticonDialogDefinition.VisibleStatusbar =

true;

 

insertEmoticonDialogDefinition.Width =

Unit.Pixel(400);

 

insertEmoticonDialogDefinition.Height =

Unit.Pixel(245);

 

insertEmoticonDialogDefinition.VisibleStatusbar =

false;

 

insertEmoticonDialogDefinition.Title =

"Insert Smiley";

 

editor.AddDialogDefinition(

"InsertEmoticon", insertEmoticonDialogDefinition);

 

in this way i can see 1 image i now that there a better way in addition i don’t know how to catch the event of the click on the image
what i can do ?

 

1 Answer, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 05 Jan 2009, 04:51 PM
Hi Dan,

We would suggest examining once more the following demo that features an emoticon dropdown
http://demos.telerik.com/aspnet-ajax/Editor/Examples/CustomTools/DefaultCS.aspx



as well as the emoticon dialog:
http://demos.telerik.com/aspnet-ajax/Editor/Examples/CustomDialogs/DefaultCS.aspx




Also, I am not sure what your question is about, but you can detect when a user clicks on the emoticon button to show the dialog by subscribing to the editor's OnClientCommandExecuting. For more information please review the following example:
http://demos.telerik.com/aspnet-ajax/Editor/Examples/ClientsideEvents/DefaultCS.aspx


Best regards,
Tervel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
dan
Top achievements
Rank 1
Answers by
Tervel
Telerik team
Share this question
or