Ticket #13020: replacebycode3.html

File replacebycode3.html, 2.4 KB (added by Jakub Ś, 10 years ago)
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<!--
3Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
4For licensing, see LICENSE.html or http://ckeditor.com/license
5-->
6<html>
7<head>
8        <title>Replace Textarea by Code &mdash; CKEditor Sample</title>                 
9        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />   
10        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
11        <script src="../ckeditor.js" ></script> 
12        <link href="sample.css" rel="stylesheet">
13</head>
14<body>
15        <h1 class="samples">
16                <a href="index.html">CKEditor Samples</a> &raquo; Replace Textarea Elements Using JavaScript Code
17        </h1>
18        <form action="sample_posteddata.php" method="post"> <!-- accept-charset="windows-1252" -->
19                <div class="description">
20                        <p>
21                                This editor is using an <code>&lt;iframe&gt;</code> element-based editing area, provided by the <strong>Wysiwygarea</strong> plugin.
22                        </p>
23<pre class="samples">
24
25CKEDITOR.replace( '<em>textarea_id</em>' )
26</pre>
27                </div>
28               
29                <div id="editor1" autocomplete="off" autocorrect="off" role="group" aria-label="Rich Text Editor - type your response."></div>
30                <script>                       
31                        var editor = CKEDITOR.appendTo('editor1');
32                       
33                        editor.on('instanceReady', function (ev) {
34                                var doc = editor.document.$;
35                                var win = editor.document.getWindow().$;
36                               
37                                var s = '<style>.cke_editable ul, .cke_editable ol { ' +
38                                                'margin-left: .5em; ' +
39                                                'list-style: inside; ' +
40                                                '}</style>';
41
42                                if(doc == document){
43                                        console.log('*** Inline');
44                                        $('head').append(s);
45                                }else{
46                                        console.log('*** iFrame');
47                                        $('.cke_wysiwyg_frame').contents().find('head').append(s);
48                                }
49                               
50
51                        });
52                </script>
53                <p>
54                        <input type="submit" value="Submit">
55                </p>
56                <p>
57                        <input type="text" id="marginsTxt" maxlength="4" /><input type="button" onclick="changeMargins(document.getElementById('marginsTxt').value)" value="Change Margin">
58                </p>
59        </form>
60        <div id="footer">
61                <hr>
62                <p>
63                        CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
64                </p>
65                <p id="copy">
66                        Copyright &copy; 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
67                        Knabben. All rights reserved.
68                </p>
69        </div>
70</body>
71</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy