Migration vers version 4 : restauration des outils. Prise en charge de 'allowedConten...
[ckeditor.git] / skins / ckeditor / samples / plugins / enterkey / enterkey.html
1 <!DOCTYPE html>
2 <!--
3 Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
4 For licensing, see LICENSE.md or http://ckeditor.com/license
5 -->
6 <html>
7 <head>
8 <meta charset="utf-8">
9 <title>ENTER Key Configuration &mdash; CKEditor Sample</title>
10 <script src="../../../ckeditor.js"></script>
11 <link href="../../../samples/sample.css" rel="stylesheet">
12 <meta name="ckeditor-sample-name" content="Using the &quot;Enter&quot; key in CKEditor">
13 <meta name="ckeditor-sample-group" content="Advanced Samples">
14 <meta name="ckeditor-sample-description" content="Configuring the behavior of &lt;em&gt;Enter&lt;/em&gt; and &lt;em&gt;Shift+Enter&lt;/em&gt; keys.">
15 <script>
16
17 var editor;
18
19 function changeEnter() {
20 // If we already have an editor, let's destroy it first.
21 if ( editor )
22 editor.destroy( true );
23
24 // Create the editor again, with the appropriate settings.
25 editor = CKEDITOR.replace( 'editor1', {
26 extraPlugins: 'enterkey',
27 enterMode: Number( document.getElementById( 'xEnter' ).value ),
28 shiftEnterMode: Number( document.getElementById( 'xShiftEnter' ).value )
29 });
30 }
31
32 window.onload = changeEnter;
33
34 </script>
35 </head>
36 <body>
37 <h1 class="samples">
38 <a href="../../../samples/index.html">CKEditor Samples</a> &raquo; ENTER Key Configuration
39 </h1>
40 <div class="description">
41 <p>
42 This sample shows how to configure the <em>Enter</em> and <em>Shift+Enter</em> keys
43 to perform actions specified in the
44 <a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-enterMode"><code>enterMode</code></a>
45 and <a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-shiftEnterMode"><code>shiftEnterMode</code></a>
46 parameters, respectively.
47 You can choose from the following options:
48 </p>
49 <ul class="samples">
50 <li><strong><code>ENTER_P</code></strong> &ndash; new <code>&lt;p&gt;</code> paragraphs are created;</li>
51 <li><strong><code>ENTER_BR</code></strong> &ndash; lines are broken with <code>&lt;br&gt;</code> elements;</li>
52 <li><strong><code>ENTER_DIV</code></strong> &ndash; new <code>&lt;div&gt;</code> blocks are created.</li>
53 </ul>
54 <p>
55 The sample code below shows how to configure CKEditor to create a <code>&lt;div&gt;</code> block when <em>Enter</em> key is pressed.
56 </p>
57 <pre class="samples">
58 CKEDITOR.replace( '<em>textarea_id</em>', {
59 <strong>enterMode: CKEDITOR.ENTER_DIV</strong>
60 });</pre>
61 <p>
62 Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
63 the <code>&lt;textarea&gt;</code> element to be replaced.
64 </p>
65 </div>
66 <div style="float: left; margin-right: 20px">
67 When <em>Enter</em> is pressed:<br>
68 <select id="xEnter" onchange="changeEnter();">
69 <option selected="selected" value="1">Create a new &lt;P&gt; (recommended)</option>
70 <option value="3">Create a new &lt;DIV&gt;</option>
71 <option value="2">Break the line with a &lt;BR&gt;</option>
72 </select>
73 </div>
74 <div style="float: left">
75 When <em>Shift+Enter</em> is pressed:<br>
76 <select id="xShiftEnter" onchange="changeEnter();">
77 <option value="1">Create a new &lt;P&gt;</option>
78 <option value="3">Create a new &lt;DIV&gt;</option>
79 <option selected="selected" value="2">Break the line with a &lt;BR&gt; (recommended)</option>
80 </select>
81 </div>
82 <br style="clear: both">
83 <form action="../../../samples/sample_posteddata.php" method="post">
84 <p>
85 <br>
86 <textarea cols="80" id="editor1" name="editor1" rows="10">This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.</textarea>
87 </p>
88 <p>
89 <input type="submit" value="Submit">
90 </p>
91 </form>
92 <div id="footer">
93 <hr>
94 <p>
95 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
96 </p>
97 <p id="copy">
98 Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
99 Knabben. All rights reserved.
100 </p>
101 </div>
102 </body>
103 </html>