1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
2 | <!-- |
---|
3 | * FCKeditor - The text editor for internet |
---|
4 | * Copyright (C) 2003-2006 Frederico Caldeira Knabben |
---|
5 | * |
---|
6 | * Licensed under the terms of the GNU Lesser General Public License: |
---|
7 | * http://www.opensource.org/licenses/lgpl-license.php |
---|
8 | * |
---|
9 | * For further information visit: |
---|
10 | * http://www.fckeditor.net/ |
---|
11 | * |
---|
12 | * "Support Open Source software. What about a donation today?" |
---|
13 | * |
---|
14 | * File Name: 009.html |
---|
15 | * Test page. |
---|
16 | * |
---|
17 | * File Authors: |
---|
18 | * Frederico Caldeira Knabben (fredck@fckeditor.net) |
---|
19 | --> |
---|
20 | <html> |
---|
21 | <head> |
---|
22 | <title>FCKeditor - Sample</title> |
---|
23 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
---|
24 | <meta name="robots" content="noindex, nofollow"> |
---|
25 | <link href="testcases.css" rel="stylesheet" type="text/css"> |
---|
26 | <script type="text/javascript" src="../fckeditor.js"></script> |
---|
27 | <script> |
---|
28 | |
---|
29 | function FCKeditor_OnComplete( editorInstance ) |
---|
30 | { |
---|
31 | // Attach to the event fired when the editor's HTML is set. |
---|
32 | editorInstance.Events.AttachEvent( 'OnAfterSetHTML', FCKeditor_OnAfterSetHTML ) ; |
---|
33 | } |
---|
34 | |
---|
35 | function FCKeditor_OnAfterSetHTML( editorInstance ) |
---|
36 | { |
---|
37 | // Get the actual color from the combo. |
---|
38 | var sColor = document.getElementById('ActualColor').value ; |
---|
39 | |
---|
40 | // Set the color of the editor instance. |
---|
41 | editorInstance.EditorDocument.body.style.backgroundColor = sColor ; |
---|
42 | } |
---|
43 | |
---|
44 | function SetActualColor() |
---|
45 | { |
---|
46 | // Get the editor instance that we want to interact with. |
---|
47 | var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ; |
---|
48 | |
---|
49 | // Call the event function to set the color. |
---|
50 | FCKeditor_OnAfterSetHTML( oEditor ) ; |
---|
51 | } |
---|
52 | |
---|
53 | </script> |
---|
54 | </head> |
---|
55 | <body> |
---|
56 | <h1>FCKeditor - Test 009</h1> |
---|
57 | <P> |
---|
58 | <STRONG>Expected results</STRONG> : The user should be able to background color |
---|
59 | of the editor by code.<BR> |
---|
60 | <STRONG>Configurations</STRONG>: Default<BR> |
---|
61 | <STRONG>Steps to Reproduce</STRONG>: |
---|
62 | </P> |
---|
63 | <OL> |
---|
64 | <LI> |
---|
65 | Wait the editor to load. |
---|
66 | <LI> |
---|
67 | Type some text. |
---|
68 | <LI> |
---|
69 | Change the background color using the combo. |
---|
70 | <LI> |
---|
71 | Type more text. |
---|
72 | <LI> |
---|
73 | Switch to source view. |
---|
74 | <LI> |
---|
75 | Switch back to WYSIWYG. The background color must be the same. |
---|
76 | <LI> |
---|
77 | Repeate steps 3 to 6. |
---|
78 | <LI> |
---|
79 | Submit the form.</LI></OL> |
---|
80 | <P> |
---|
81 | <hr> |
---|
82 | <P> |
---|
83 | Select a color for the background:<br> |
---|
84 | <select id="ActualColor" onchange="SetActualColor();"> |
---|
85 | <option value="white" selected>White</option> |
---|
86 | <option value="red">Red</option> |
---|
87 | <option value="green">Green</option> |
---|
88 | <option value="gold">Gold</option> |
---|
89 | </select> |
---|
90 | </P> |
---|
91 | <form action="sampleposteddata.asp" method="post" target="_blank"> |
---|
92 | <script type="text/javascript"> |
---|
93 | <!-- |
---|
94 | // Automatically calculates the editor base path based on the _samples directory. |
---|
95 | // This is usefull only for these samples. A real application should use something like this: |
---|
96 | // oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value. |
---|
97 | var sBasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('_testcases')) ; |
---|
98 | |
---|
99 | var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ; |
---|
100 | oFCKeditor.BasePath = sBasePath ; |
---|
101 | oFCKeditor.Value = 'This is some <strong>sample text</strong>. You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.' ; |
---|
102 | oFCKeditor.Create() ; |
---|
103 | //--> |
---|
104 | </script> |
---|
105 | <br> |
---|
106 | <input type="submit" value="Submit"> |
---|
107 | </form> |
---|
108 | </body> |
---|
109 | </html> |
---|