<cfsetting enablecfoutputonly="true">
<!---
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2008 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
 *
 * Sample page for ColdFusion.
--->
<cfoutput>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>FCKeditor - extra Par tags inserted</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<link href="../ckeditor/sample.css" rel="stylesheet" type="text/css" />

		<cfparam name="Form.FCKInput" default="">
		<!--- <CF_CleanFCKOutput Text = #Form.FCKInput#> --->	<!--- this returns variable CleanFCKOutput that has none of the extraneous white space that FCKeditor inserts here and there, around line breaks and at the top and bottom of the document --->

		<script type="text/javascript">
		
			function FCKeditor_OnComplete( editorInstance )
				{
			
					var HTMLToLoad = "<cfoutput>#Form.FCKInput#</cfoutput>";
				
					editorInstance.InsertHtml(HTMLToLoad);	
				
				}

		</script>
	</head>
	<body>

	<H4>Trying to figure out why extra &lt;p&gt and &lt;p&gt nbsp &lt;/p&gt are inserted at the start and end of the text.</H4>
	
	<ol>
		<li>cype ABC in the empty editor box</li>
		<li>click Submit</li>
		<li>view the source of the page and look at the FCKeditor_OnComplete function; HTMLToLoad is what you submitted: &lt;p&gt;ABC&lt;/p&gt;</li>
		<li>without changing anything in the ditor box, click Submit again</li>
		<li>view the source of the page again and look at the FCKeditor_OnComplete function; HTMLToLoad now has extra opening and closing Paragrah tags:
		&lt;p&gt;&lt;p&gt;ABC&lt;/p&gt;&lt;/p&gt;</li>
	</ol>
	
	<div>Under slightly different circumstances a blank line is also added at the bottom of the text, like so: &lt;p&gt;nbsp;&lt;/p&gt;. This page doesn't demonstrate that because I don't want to complicate this example.</div>

	<p>
	<div>Why is that happening and how do we prevent it? I'd appreciate a response sent to sp27@cornell.edu.</div>
	
		<cfif (IsDefined("Form.FCKInput"))>
			<div>You submitted:</div>
			<div>#Form.FCKInput#</div>
		</cfif>
		
		<form action="#CGI.Script_Name#" method="post">
		</cfoutput>
		
		<cfmodule
			template="../ckeditor/fckeditor.cfm"
			basePath="../ckeditor/"
			instanceName="FCKInput"
			value=''
			width="300"
			height="200"
			toolbarSet="Basic"
		>
		<cfoutput>
			<br>
			<input type="submit" value="Submit" onclick="CheckContents(); ">

		</form>
	</body>
</html>
</cfoutput>
<cfsetting enablecfoutputonly="false">
