1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
4 For licensing, see LICENSE.html or http://ckeditor.com/license
6 <html xmlns=
"http://www.w3.org/1999/xhtml">
8 <title>ENTER Key Configuration
— CKEditor Sample
</title>
9 <meta content=
"text/html; charset=utf-8" http-equiv=
"content-type" />
10 <script type=
"text/javascript" src=
"../ckeditor.js"></script>
11 <script src=
"sample.js" type=
"text/javascript"></script>
12 <link href=
"sample.css" rel=
"stylesheet" type=
"text/css" />
13 <script type=
"text/javascript">
18 function changeEnter()
20 // If we already have an editor, let's destroy it first.
22 editor.destroy( true );
24 // Create the editor again, with the appropriate settings.
25 editor = CKEDITOR.replace( 'editor1',
27 enterMode : Number( document.getElementById( 'xEnter' ).value ),
28 shiftEnterMode : Number( document.getElementById( 'xShiftEnter' ).value )
32 window.onload = changeEnter;
39 CKEditor Sample
— ENTER Key Configuration
41 <div class=
"description">
43 This sample shows how to configure the
<em>Enter
</em> and
<em>Shift+Enter
</em> keys
44 to perform actions specified in the
45 <a class=
"samples" href=
"http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.enterMode"><code>enterMode
</code></a>
46 and
<a class=
"samples" href=
"http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.shiftEnterMode"><code>shiftEnterMode
</code></a>
47 parameters, respectively.
48 You can choose from the following options:
51 <li><strong><code>ENTER_P
</code></strong> – new
<code><p
></code> paragraphs are created;
</li>
52 <li><strong><code>ENTER_BR
</code></strong> – lines are broken with
<code><br
></code> elements;
</li>
53 <li><strong><code>ENTER_DIV
</code></strong> – new
<code><div
></code> blocks are created.
</li>
56 The sample code below shows how to configure CKEditor to create a
<code><div
></code> block when
<em>Enter
</em> key is pressed.
58 <pre class=
"samples">CKEDITOR.replace( '
<em>textarea_id
</em>',
60 <strong>enterMode : CKEDITOR.ENTER_DIV
</strong>
63 Note that
<code><em>textarea_id
</em></code> in the code above is the
<code>id
</code> attribute of
64 the
<code><textarea
></code> element to be replaced.
68 <!-- This <div> holds alert messages to be display in the sample page. -->
72 <strong>CKEditor requires JavaScript to run
</strong>. In a browser with no JavaScript
73 support, like yours, you should still see the contents (HTML data) and you should
74 be able to edit it normally, without a rich editor interface.
78 <div style=
"float: left; margin-right: 20px">
79 When
<em>Enter
</em> is pressed:
<br />
80 <select id=
"xEnter" onchange=
"changeEnter();">
81 <option selected=
"selected" value=
"1">Create a new
<P
> (recommended)
</option>
82 <option value=
"3">Create a new
<DIV
></option>
83 <option value=
"2">Break the line with a
<BR
></option>
86 <div style=
"float: left">
87 When
<em>Shift+Enter
</em> is pressed:
<br />
88 <select id=
"xShiftEnter" onchange=
"changeEnter();">
89 <option value=
"1">Create a new
<P
></option>
90 <option value=
"3">Create a new
<DIV
></option>
91 <option selected=
"selected" value=
"2">Break the line with a
<BR
> (recommended)
</option>
94 <br style=
"clear: both" />
95 <form action=
"sample_posteddata.php" method=
"post">
98 <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>
101 <input type=
"submit" value=
"Submit" />
107 CKEditor - The text editor for the Internet -
<a class=
"samples" href=
"http://ckeditor.com/">http://ckeditor.com
</a>
110 Copyright
© 2003-
2011,
<a class=
"samples" href=
"http://cksource.com/">CKSource
</a> - Frederico
111 Knabben. All rights reserved.