Ticket #11343: replacebycode.html

File replacebycode.html, 2.0 KB (added by Wiktor Walc, 10 years ago)
Line 
1<!DOCTYPE html>
2<!--
3Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
4For licensing, see LICENSE.md or http://ckeditor.com/license
5-->
6<html>
7<head>
8        <title>Replace Textarea by Code &mdash; CKEditor Sample</title>
9        <meta charset="utf-8">
10        <script src="../ckeditor.js"></script>
11        <link href="sample.css" rel="stylesheet">
12</head>
13<body>
14<h1 class="samples">
15        <a href="index.html">CKEditor Samples</a> &raquo; Replace Textarea Elements Using JavaScript Code
16</h1>
17<form action="sample_posteddata.php" method="post">
18<div class="description">
19        <p>
20                This editor is using an <code>&lt;iframe&gt;</code> element-based editing area, provided by the <strong>Wysiwygarea</strong> plugin.
21        </p>
22<pre class="samples">
23CKEDITOR.replace( '<em>textarea_id</em>' )
24</pre>
25</div>
26<textarea cols="80" id="editor1" name="editor1" rows="10">
27        <p>some text <span class="insertedSpan">Content...</span> some text</p>
28</textarea>
29<script>
30        (function () {
31                CKEDITOR.plugins.add('simplebox', {
32                        requires: 'widget',
33                        init: function (editor) {
34                                editor.ui.addButton('simplebox', {
35                                        label: "SIMPLEBOX TEST",
36                                        command: 'simplebox',
37                                        icon: this.path + 'icons/simplebox.png'
38                                });
39                                editor.widgets.add('simplebox', {
40                                        allowedContent:'span(!insertedSpan)',
41                                        upcast: function (element) {
42                                                if (element.hasClass('insertedSpan')) {
43                                                        return true;
44                                                }
45                                        },
46                                        template: '<span class="insertedSpan">Content...</span>'
47                                });
48                        }
49                });
50        })();
51        CKEDITOR.replace( 'editor1', {
52                extraPlugins : 'simplebox',
53                forcePasteAsPlainText : true
54        });
55
56
57
58</script>
59<p>
60        <input type="submit" value="Submit">
61</p>
62</form>
63<div id="footer">
64        <hr>
65        <p>
66                CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
67        </p>
68        <p id="copy">
69                Copyright &copy; 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
70                Knabben. All rights reserved.
71        </p>
72</div>
73</body>
74</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy