1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
2 | |
---|
3 | <html> |
---|
4 | <head> |
---|
5 | |
---|
6 | <title>InsertAtCursor with FCKeditor</title> |
---|
7 | |
---|
8 | <script type="text/javascript" src="../ckeditor/fckeditor.js"></script> |
---|
9 | |
---|
10 | </head> |
---|
11 | |
---|
12 | <body> |
---|
13 | |
---|
14 | <script type="text/javascript"> |
---|
15 | function FCKeditor_OnComplete( editorInstance ) |
---|
16 | /* called when FCKeditor is done initializing */ |
---|
17 | { |
---|
18 | editorInstance.SetHTML(""); // this is where we can define the initial text to load in FCKeditor |
---|
19 | } |
---|
20 | |
---|
21 | function InsertAtFCKCursor(strInsertion) { |
---|
22 | /* inserts strInsertion at the cursor in FCKeditor; FCKInput is the name given to the editor instance in the declaration */ |
---|
23 | |
---|
24 | var oEditor = FCKeditorAPI.GetInstance('FCKInput'); |
---|
25 | |
---|
26 | oEditor.InsertHtml(strInsertion); |
---|
27 | |
---|
28 | oEditor.Focus(); |
---|
29 | } |
---|
30 | |
---|
31 | </script> |
---|
32 | |
---|
33 | <div> |
---|
34 | This page, using FCKeditor 2.6.4 and the methods oEditor.InsertHtml(strInsertion) and oEditor.Focus(), |
---|
35 | acts differently in IE 7 and Firefox 2 (Windows XP). |
---|
36 | </div> |
---|
37 | |
---|
38 | <div> |
---|
39 | To reproduce the issue, follow these steps in each browser: |
---|
40 | <ol> |
---|
41 | <li>click in the editor</li> |
---|
42 | <li>click A, B, C in the alphabet palette, in that order</li> |
---|
43 | <ul> |
---|
44 | <li>in IE, you'll get CAB</li> |
---|
45 | <li>in FF, you'll get ABC</li> |
---|
46 | </ul> |
---|
47 | <li>click between A and B to position the insertion point, then click D, E, F in the alphabet palette</li> |
---|
48 | <ul> |
---|
49 | <li>in IE, you'll get FCADEB</li> |
---|
50 | <li>in FF, you'll get ABDEFC</li> |
---|
51 | </ul> |
---|
52 | </ol> |
---|
53 | </div> |
---|
54 | |
---|
55 | <div>The behavior in Firefox is what one would expect. In IE, it's a different story. Is there a solution for this?</div> |
---|
56 | |
---|
57 | <div>I'd appreciate a response to sp27@cornell.edu.</div> |
---|
58 | |
---|
59 | <div name="FreeFormText" id="FreeFormText" style="width: 300px; height: 200px; "> |
---|
60 | |
---|
61 | <input type="hidden" id="FCKInput" name="FCKInput" value="" style="display:none" /> |
---|
62 | <input type="hidden" id="FCKInput___Config" value="" style="display:none" /> |
---|
63 | <iframe id="FCKInput___Frame" src="../ckeditor/editor/fckeditor.html?InstanceName=FCKInput&Toolbar=Basic" width="100%" height="100%" frameborder="0" scrolling="no"></iframe> |
---|
64 | |
---|
65 | </div> |
---|
66 | |
---|
67 | |
---|
68 | <div> |
---|
69 | |
---|
70 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('A')"> A </span> |
---|
71 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('B')"> B </span> |
---|
72 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('C')"> C </span> |
---|
73 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('D')"> D </span> |
---|
74 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('E')"> E </span> |
---|
75 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('F')"> F </span> |
---|
76 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('G')"> G </span> |
---|
77 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('H')"> H </span> |
---|
78 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('I')"> I </span> |
---|
79 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('J')"> J </span> |
---|
80 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('K')"> K </span> |
---|
81 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('L')"> L </span> |
---|
82 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('M')"> M </span> |
---|
83 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('N')"> N </span> |
---|
84 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('O')"> O </span> |
---|
85 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('P')"> P </span> |
---|
86 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('Q')"> Q </span> |
---|
87 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('R')"> R </span> |
---|
88 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('S')"> S </span> |
---|
89 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('T')"> T </span> |
---|
90 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('U')"> U </span> |
---|
91 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('V')"> V </span> |
---|
92 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('W')"> W </span> |
---|
93 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('X')"> X </span> |
---|
94 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('Y')"> Y </span> |
---|
95 | <span style="cursor: pointer; "onmousedown="InsertAtFCKCursor('Z')"> Z </span> |
---|
96 | </div> |
---|