JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.6
[ckeditor.git] / _samples / divreplace.html
index bee6797..6f4ff41 100644 (file)
@@ -1,11 +1,11 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
 <!--\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 -->\r
 <html xmlns="http://www.w3.org/1999/xhtml">\r
 <head>\r
-       <title>Replace DIV - CKEditor Sample</title>\r
+       <title>Replace DIV &mdash; CKEditor Sample</title>\r
        <meta content="text/html; charset=utf-8" http-equiv="content-type" />\r
        <script type="text/javascript" src="../ckeditor.js"></script>\r
        <script src="sample.js" type="text/javascript"></script>\r
@@ -48,10 +48,15 @@ function onDoubleClick( ev )
        var element = ev.target || ev.srcElement;\r
 \r
        // Find out the div that holds this element.\r
-       element = element.parentNode;\r
+       var name;\r
+       do\r
+       {\r
+               element = element.parentNode;\r
+       }\r
+       while ( element && ( name = element.nodeName.toLowerCase() ) && ( name != 'div' || element.className.indexOf( 'editable' ) == -1 ) && name != 'body' )\r
 \r
-       if ( element.nodeName.toLowerCase() == 'div'\r
-                && ( element.className.indexOf( 'editable' ) != -1 ) )\r
+\r
+       if ( name == 'div' && element.className.indexOf( 'editable' ) != -1 )\r
                replaceDiv( element );\r
 }\r
 \r
@@ -70,9 +75,20 @@ function replaceDiv( div )
 \r
 </head>\r
 <body>\r
-       <h1>\r
-               CKEditor Sample\r
+       <h1 class="samples">\r
+               CKEditor Sample &mdash; Replace DIV with CKEditor on the Fly\r
        </h1>\r
+       <div class="description">\r
+       <p>\r
+               This sample shows how to automatically replace <code>&lt;div&gt;</code> elements\r
+               with a CKEditor instance on the fly, following user's doubleclick. The content\r
+               that was previously placed inside the <code>&lt;div&gt;</code> element will now\r
+               be moved into CKEditor editing area.\r
+       </p>\r
+       <p>\r
+               For details on how to create this setup check the source code of this sample page.\r
+       </p>\r
+       </div>\r
        <!-- This <div> holds alert messages to be display in the sample page. -->\r
        <div id="alerts">\r
                <noscript>\r
@@ -84,7 +100,8 @@ function replaceDiv( div )
                </noscript>\r
        </div>\r
        <p>\r
-               Double-click on any of the following DIVs to transform them into editor instances.</p>\r
+               Double-click any of the following <code>&lt;div&gt;</code> elements to transform them into\r
+               editor instances.</p>\r
        <div class="editable">\r
                <h3>\r
                        Part 1</h3>\r
@@ -126,10 +143,10 @@ function replaceDiv( div )
        <div id="footer">\r
                <hr />\r
                <p>\r
-                       CKEditor - The text editor for Internet - <a href="http://ckeditor.com/">http://ckeditor.com</a>\r
+                       CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>\r
                </p>\r
                <p id="copy">\r
-                       Copyright &copy; 2003-2010, <a href="http://cksource.com/">CKSource</a> - Frederico\r
+                       Copyright &copy; 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico\r
                        Knabben. All rights reserved.\r
                </p>\r
        </div>\r