1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<!--
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
5 *
6 * == BEGIN LICENSE ==
7 *
8 * Licensed under the terms of any of the following licenses at your
9 * choice:
10 *
11 *  - GNU General Public License Version 2 or later (the "GPL")
12 *    http://www.gnu.org/licenses/gpl.html
13 *
14 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15 *    http://www.gnu.org/licenses/lgpl.html
16 *
17 *  - Mozilla Public License Version 1.1 or later (the "MPL")
18 *    http://www.mozilla.org/MPL/MPL-1.1.html
19 *
20 * == END LICENSE ==
21 *
22 * Sample page.
23-->
24<html xmlns="http://www.w3.org/1999/xhtml">
25<head>
26	<title>FCKeditor - Sample</title>
27	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
28	<meta name="robots" content="noindex, nofollow" />
29	<link href="../sample.css" rel="stylesheet" type="text/css" />
30	<script type="text/javascript" src="../../fckeditor.js"></script>
31	<script type="text/javascript">
32<!--
33// The following function is used in this samples to reload the page,
34// setting the querystring parameters for the enter mode.
35function ChangeMode()
36{
37	var sEnterMode = document.getElementById('xEnter').value ;
38	var sShiftEnterMode = document.getElementById('xShiftEnter').value ;
39
40	window.location.href = window.location.pathname + '?enter=' + sEnterMode + '&shift=' + sShiftEnterMode ;
41}
42-->
43	</script>
44</head>
45<body>
46	<h1>
47		FCKeditor - JavaScript - Sample 12</h1>
48	<div>
49		This sample shows the different ways to configure the [Enter] key behavior on FCKeditor.
50	</div>
51	<hr />
52	<table cellpadding="0" cellspacing="0" border="0">
53		<tr>
54			<td>
55				When [Enter] is pressed:&nbsp;
56			</td>
57			<td>
58				<select id="xEnter" onchange="ChangeMode();">
59					<option value="p" selected="selected">Create new &lt;P&gt;</option>
60					<option value="div">Create new &lt;DIV&gt;</option>
61					<option value="br">Break the line with a &lt;BR&gt;</option>
62				</select>
63			</td>
64		</tr>
65		<tr>
66			<td>
67				When [Shift] + [Enter] is pressed:&nbsp;
68			</td>
69			<td>
70				<select id="xShiftEnter" onchange="ChangeMode();">
71					<option value="p">Create new &lt;P&gt;</option>
72					<option value="div">Create new &lt;DIV&gt;</option>
73					<option value="br" selected="selected">Break the line with a &lt;BR&gt;</option>
74				</select>
75			</td>
76		</tr>
77	</table>
78	<br />
79	<form action="sampleposteddata.asp" method="post" target="_blank">
80		<script type="text/javascript">
81<!--
82// Automatically calculates the editor base path based on the _samples directory.
83// This is usefull only for these samples. A real application should use something like this:
84// oFCKeditor.BasePath = '/fckeditor/' ;	// '/fckeditor/' is the default value.
85var sBasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('_samples')) ;
86
87// The following are the default configurations for the Enter and Shift+Enter modes.
88var sEnterMode = 'p' ;
89var sShiftEnterMode = 'br' ;
90
91// Try to get the new configurations from the querystring, if available.
92if ( document.location.search.length > 1 )
93{
94	var aMatch = document.location.search.match( /enter=(p|div|br)/ ) ;
95	if ( aMatch )
96		sEnterMode = aMatch[1] ;
97
98	aMatch = document.location.search.match( /shift=(p|div|br)/ ) ;
99	if ( aMatch )
100		sShiftEnterMode = aMatch[1] ;
101}
102
103// Create the FCKeditor instance.
104var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
105oFCKeditor.BasePath	= sBasePath ;
106oFCKeditor.Value	= 'This is some <strong>sample text<\/strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor<\/a>.' ;
107
108// Set the configuration options for the Enter Key mode.
109oFCKeditor.Config["EnterMode"]		= sEnterMode ;
110oFCKeditor.Config["ShiftEnterMode"]	= sShiftEnterMode ;
111
112oFCKeditor.Create() ;
113
114// Update the select combos with the current values.
115document.getElementById('xEnter').value = sEnterMode ;
116document.getElementById('xShiftEnter').value = sShiftEnterMode ;
117
118//-->
119		</script>
120		<br />
121		<input type="submit" value="Submit" />
122	</form>
123</body>
124</html>
125