Ticket #2750: fckeditor_ExtraParProblem.cfm

File fckeditor_ExtraParProblem.cfm, 3.0 KB (added by Slava, 15 years ago)
Line 
1<cfsetting enablecfoutputonly="true">
2<!---
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4 * Copyright (C) 2003-2008 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 for ColdFusion.
23--->
24<cfoutput>
25<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
26<html>
27        <head>
28                <title>FCKeditor - extra Par tags inserted</title>
29                <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
30                <link href="../ckeditor/sample.css" rel="stylesheet" type="text/css" />
31
32                <cfparam name="Form.FCKInput" default="">
33                <!--- <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 --->
34
35                <script type="text/javascript">
36               
37                        function FCKeditor_OnComplete( editorInstance )
38                                {
39                       
40                                        var HTMLToLoad = "<cfoutput>#Form.FCKInput#</cfoutput>";
41                               
42                                        editorInstance.InsertHtml(HTMLToLoad); 
43                               
44                                }
45
46                </script>
47        </head>
48        <body>
49
50        <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>
51       
52        <ol>
53                <li>cype ABC in the empty editor box</li>
54                <li>click Submit</li>
55                <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>
56                <li>without changing anything in the ditor box, click Submit again</li>
57                <li>view the source of the page again and look at the FCKeditor_OnComplete function; HTMLToLoad now has extra opening and closing Paragrah tags:
58                &lt;p&gt;&lt;p&gt;ABC&lt;/p&gt;&lt;/p&gt;</li>
59        </ol>
60       
61        <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>
62
63        <p>
64        <div>Why is that happening and how do we prevent it? I'd appreciate a response sent to sp27@cornell.edu.</div>
65       
66                <cfif (IsDefined("Form.FCKInput"))>
67                        <div>You submitted:</div>
68                        <div>#Form.FCKInput#</div>
69                </cfif>
70               
71                <form action="#CGI.Script_Name#" method="post">
72                </cfoutput>
73               
74                <cfmodule
75                        template="../ckeditor/fckeditor.cfm"
76                        basePath="../ckeditor/"
77                        instanceName="FCKInput"
78                        value=''
79                        width="300"
80                        height="200"
81                        toolbarSet="Basic"
82                >
83                <cfoutput>
84                        <br>
85                        <input type="submit" value="Submit" onclick="CheckContents(); ">
86
87                </form>
88        </body>
89</html>
90</cfoutput>
91<cfsetting enablecfoutputonly="false">
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy