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