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