Application de la css Plinn pour l'édition.
[ckeditor.git] / skins / ckeditor / _samples / divreplace.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <!--
3 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
4 For licensing, see LICENSE.html or http://ckeditor.com/license
5 -->
6 <html xmlns="http://www.w3.org/1999/xhtml">
7 <head>
8 <title>Replace DIV &mdash; CKEditor Sample</title>
9 <meta content="text/html; charset=utf-8" http-equiv="content-type" />
10 <script type="text/javascript" src="../ckeditor.js"></script>
11 <script src="sample.js" type="text/javascript"></script>
12 <link href="sample.css" rel="stylesheet" type="text/css" />
13 <style id="styles" type="text/css">
14
15 div.editable
16 {
17 border: solid 2px Transparent;
18 padding-left: 15px;
19 padding-right: 15px;
20 }
21
22 div.editable:hover
23 {
24 border-color: black;
25 }
26
27 </style>
28 <script type="text/javascript">
29 //<![CDATA[
30
31 // Uncomment the following code to test the "Timeout Loading Method".
32 // CKEDITOR.loadFullCoreTimeout = 5;
33
34 window.onload = function()
35 {
36 // Listen to the double click event.
37 if ( window.addEventListener )
38 document.body.addEventListener( 'dblclick', onDoubleClick, false );
39 else if ( window.attachEvent )
40 document.body.attachEvent( 'ondblclick', onDoubleClick );
41
42 };
43
44 function onDoubleClick( ev )
45 {
46 // Get the element which fired the event. This is not necessarily the
47 // element to which the event has been attached.
48 var element = ev.target || ev.srcElement;
49
50 // Find out the div that holds this element.
51 var name;
52 do
53 {
54 element = element.parentNode;
55 }
56 while ( element && ( name = element.nodeName.toLowerCase() ) && ( name != 'div' || element.className.indexOf( 'editable' ) == -1 ) && name != 'body' )
57
58
59 if ( name == 'div' && element.className.indexOf( 'editable' ) != -1 )
60 replaceDiv( element );
61 }
62
63 var editor;
64
65 function replaceDiv( div )
66 {
67 if ( editor )
68 editor.destroy();
69
70 editor = CKEDITOR.replace( div );
71 }
72
73 //]]>
74 </script>
75
76 </head>
77 <body>
78 <h1 class="samples">
79 CKEditor Sample &mdash; Replace DIV with CKEditor on the Fly
80 </h1>
81 <div class="description">
82 <p>
83 This sample shows how to automatically replace <code>&lt;div&gt;</code> elements
84 with a CKEditor instance on the fly, following user's doubleclick. The content
85 that was previously placed inside the <code>&lt;div&gt;</code> element will now
86 be moved into CKEditor editing area.
87 </p>
88 <p>
89 For details on how to create this setup check the source code of this sample page.
90 </p>
91 </div>
92 <!-- This <div> holds alert messages to be display in the sample page. -->
93 <div id="alerts">
94 <noscript>
95 <p>
96 <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
97 support, like yours, you should still see the contents (HTML data) and you should
98 be able to edit it normally, without a rich editor interface.
99 </p>
100 </noscript>
101 </div>
102 <p>
103 Double-click any of the following <code>&lt;div&gt;</code> elements to transform them into
104 editor instances.</p>
105 <div class="editable">
106 <h3>
107 Part 1</h3>
108 <p>
109 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
110 semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
111 rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
112 nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
113 eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
114 </p>
115 </div>
116 <div class="editable">
117 <h3>
118 Part 2</h3>
119 <p>
120 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
121 semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
122 rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
123 nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
124 eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
125 </p>
126 <p>
127 Donec velit. Mauris massa. Vestibulum non nulla. Nam suscipit arcu nec elit. Phasellus
128 sollicitudin iaculis ante. Ut non mauris et sapien tincidunt adipiscing. Vestibulum
129 vitae leo. Suspendisse nec mi tristique nulla laoreet vulputate.
130 </p>
131 </div>
132 <div class="editable">
133 <h3>
134 Part 3</h3>
135 <p>
136 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras et ipsum quis mi
137 semper accumsan. Integer pretium dui id massa. Suspendisse in nisl sit amet urna
138 rutrum imperdiet. Nulla eu tellus. Donec ante nisi, ullamcorper quis, fringilla
139 nec, sagittis eleifend, pede. Nulla commodo interdum massa. Donec id metus. Fusce
140 eu ipsum. Suspendisse auctor. Phasellus fermentum porttitor risus.
141 </p>
142 </div>
143 <div id="footer">
144 <hr />
145 <p>
146 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
147 </p>
148 <p id="copy">
149 Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
150 Knabben. All rights reserved.
151 </p>
152 </div>
153 </body>
154 </html>