restored fixes and tweaks on blog mod
[elgg.git] / _tinymce / docs / option_execcommand_callback.html
blob3d9a19c9d15bcba13cf7ec69ecd38a2ec2098e3b
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title>Option: execcommand_callback</title>
5 <link href="css/screen.css" rel="stylesheet" type="text/css" />
6 </head>
7 <body>
9 <div class="header">
10 <h1>Option: execcommand_callback</h1>
11 </div>
13 <div class="content">
14 <p>
15 This option allows you to add a custom callback function for execCommand handling. This enables you to override internal
16 command functions in TinyMCE. The example below shows how the mceLink and mceImage are overriden.
17 </p>
19 <div class="separator"></div>
21 <h3>Example of usage of the execcommand_callback option:</h3>
22 <div class="example">
23 <pre>
24 function <strong>myCustomExecCommandHandler</strong>(editor_id, elm, command, user_interface, value) {
25 var linkElm, imageElm, inst;
27 switch (command) {
28 case "mceLink":
29 inst = tinyMCE.getInstanceById(editor_id);
30 linkElm = tinyMCE.getParentElement(inst.selection.getFocusElement(), "a");
32 if (linkElm)
33 alert("Link dialog has been overriden. Found link href: " + tinyMCE.getAttrib(linkElm, "href"));
34 else
35 alert("Link dialog has been overriden.");
37 return true;
39 case "mceImage":
40 inst = tinyMCE.getInstanceById(editor_id);
41 imageElm = tinyMCE.getParentElement(inst.selection.getFocusElement(), "img");
43 if (imageElm)
44 alert("Image dialog has been overriden. Found image src: " + tinyMCE.getAttrib(imageElm, "src"));
45 else
46 alert("Image dialog has been overriden.");
48 return true;
51 return false; // Pass to next handler in chain
54 tinyMCE.init({
55 ...
56 <strong>execcommand_callback : "myCustomExecCommandHandler"</strong>
57 });
58 </pre>
59 </div>
60 </div>
62 <div class="footer">
63 <div class="helpindexlink"><a href="index.html">Index</a></div>
64 <div class="copyright">Copyright &copy; 2003-2006 <a href="http://www.moxiecode.com">Moxiecode Systems AB</a></div>
65 <br style="clear: both" />
66 </div>
68 </body>
69 </html>