Ticket #3279: ckeditor.htm

File ckeditor.htm, 2.3 KB (added by Colin Wismean, 15 years ago)

HTML File with FORM and DIV replace

Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
3<html xmlns="http://www.w3.org/1999/xhtml">
4<head>
5    <title></title>
6    <script type="text/javascript" src="/admin/ckeditor/ckeditor.js"></script>
7    <script src="/common/mootools-1.2.1-core.js" type="text/javascript"></script>
8</head>
9<body>
10    <form action="twitter.aspx" method="post">
11   
12        <script id="javascript" type="text/javascript">
13        //<![CDATA[
14        // Uncomment the following code to test the 'Timeout Loading Method'.
15            // CKEDITOR.loadFullCoreTimeout = 5;
16        window.addEvent('domready', function() {
17            // Listen to the double click event.
18            if (window.addEventListener)
19                document.body.addEventListener('dblclick', onDoubleClick, false);
20            else if (window.attachEvent)
21                document.body.attachEvent('ondblclick', onDoubleClick);
22//            $('<%= this.Page.Form.ClientID %>').addEvent('submit', function(e) {
23//                $('<%= hfLive.ClientID %>').value = editor.getData();
24//            });
25        });
26
27        function onDoubleClick(ev) {
28            // Get the element which fired the event. This is not necessarily the
29            // element to which the event has been attached.
30            var line = 0;
31            try
32            {
33                var element = ev.target || ev.srcElement;
34                // Find out the div that holds this element.
35                while ($(element).getParent() && !element.hasClass('editable'))
36                    element = $(element).getParent();
37
38                line = 2;
39                if (element.nodeName.toLowerCase() == 'div')
40                    replaceDiv(element);
41                   
42                line = 3;
43            }
44            catch(ex)
45            {
46                alert(ex.message + " LINE "+ line);   
47            }
48           
49        }
50
51        var editor;
52        function replaceDiv(div) {
53            if (editor)
54                editor.destroy();
55
56            editor = CKEDITOR.replace(div);                       
57        }
58
59        //]]>
60</script>
61<div class="editable">
62    This will be a pain in the ass if this works.
63</div>
64   
65    </form>
66</body>
67</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy