1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
* Copyright (C) 2003-2008 Frederico Caldeira Knabben
8
* Licensed under the terms of any of the following licenses at your
11
* - GNU General Public License Version 2 or later (the "GPL")
12
* http://www.gnu.org/licenses/gpl.html
14
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
15
* http://www.gnu.org/licenses/lgpl.html
17
* - Mozilla Public License Version 1.1 or later (the "MPL")
18
* http://www.mozilla.org/MPL/MPL-1.1.html
24
<html xmlns="http://www.w3.org/1999/xhtml">
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">
33
// The following function is used in this samples to reload the page,
34
// setting the querystring parameters for the enter mode.
37
var sEnterMode = document.getElementById('xEnter').value ;
38
var sShiftEnterMode = document.getElementById('xShiftEnter').value ;
40
window.location.href = window.location.pathname + '?enter=' + sEnterMode + '&shift=' + sShiftEnterMode ;
47
FCKeditor - JavaScript - Sample 12</h1>
49
This sample shows the different ways to configure the [Enter] key behavior on FCKeditor.
52
<table cellpadding="0" cellspacing="0" border="0">
55
When [Enter] is pressed:
58
<select id="xEnter" onchange="ChangeMode();">
59
<option value="p" selected="selected">Create new <P></option>
60
<option value="div">Create new <DIV></option>
61
<option value="br">Break the line with a <BR></option>
67
When [Shift] + [Enter] is pressed:
70
<select id="xShiftEnter" onchange="ChangeMode();">
71
<option value="p">Create new <P></option>
72
<option value="div">Create new <DIV></option>
73
<option value="br" selected="selected">Break the line with a <BR></option>
79
<form action="../php/sampleposteddata.php" method="post" target="_blank">
80
<script type="text/javascript">
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.
85
var sBasePath = document.location.href.substring(0,document.location.href.lastIndexOf('_samples')) ;
87
// The following are the default configurations for the Enter and Shift+Enter modes.
88
var sEnterMode = 'p' ;
89
var sShiftEnterMode = 'br' ;
91
// Try to get the new configurations from the querystring, if available.
92
if ( document.location.search.length > 1 )
94
var aMatch = document.location.search.match( /enter=(p|div|br)/ ) ;
96
sEnterMode = aMatch[1] ;
98
aMatch = document.location.search.match( /shift=(p|div|br)/ ) ;
100
sShiftEnterMode = aMatch[1] ;
103
// Create the FCKeditor instance.
104
var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
105
oFCKeditor.BasePath = sBasePath ;
106
oFCKeditor.Value = 'This is some <strong>sample text<\/strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor<\/a>.' ;
108
// Set the configuration options for the Enter Key mode.
109
oFCKeditor.Config["EnterMode"] = sEnterMode ;
110
oFCKeditor.Config["ShiftEnterMode"] = sShiftEnterMode ;
112
oFCKeditor.Create() ;
114
// Update the select combos with the current values.
115
document.getElementById('xEnter').value = sEnterMode ;
116
document.getElementById('xShiftEnter').value = sShiftEnterMode ;
121
<input type="submit" value="Submit" />