2
* FCKeditor - The text editor for internet
3
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
5
* Licensed under the terms of the GNU Lesser General Public License:
6
* http://www.opensource.org/licenses/lgpl-license.php
8
* For further information visit:
9
* http://www.fckeditor.net/
11
* "Support Open Source software. What about a donation today?"
13
* File Name: fck_1_ie.js
14
* This is the first part of the "FCK" object creation. This is the main
15
* object that represents an editor instance.
16
* (IE specific implementations)
19
* Frederico Caldeira Knabben (fredck@fckeditor.net)
22
FCK.Description = "FCKeditor for Internet Explorer 5.5+" ;
24
// The behaviors should be pointed using the FullBasePath to avoid security
25
// errors when using a differente BaseHref.
27
'<style type="text/css" _fcktemp="true"> \
28
INPUT { behavior: url(' + FCKConfig.FullBasePath + 'css/behaviors/hiddenfield.htc) ; } ' ;
30
if ( FCKConfig.ShowBorders )
31
FCK._BehaviorsStyle += 'TABLE { behavior: url(' + FCKConfig.FullBasePath + 'css/behaviors/showtableborders.htc) ; }' ;
33
// Disable resize handlers.
34
var sNoHandlers = 'INPUT, TEXTAREA, SELECT, .FCK__Anchor, .FCK__PageBreak' ;
36
if ( FCKConfig.DisableImageHandles )
37
sNoHandlers += ', IMG' ;
39
if ( FCKConfig.DisableTableHandles )
40
sNoHandlers += ', TABLE' ;
42
FCK._BehaviorsStyle += sNoHandlers + ' { behavior: url(' + FCKConfig.FullBasePath + 'css/behaviors/disablehandles.htc) ; }' ;
44
FCK._BehaviorsStyle += '</style>' ;
46
function Doc_OnMouseUp()
48
if ( FCK.EditorWindow.event.srcElement.tagName == 'HTML' )
51
FCK.EditorWindow.event.cancelBubble = true ;
52
FCK.EditorWindow.event.returnValue = false ;
56
function Doc_OnPaste()
58
if ( FCK.Status == FCK_STATUS_COMPLETE )
59
return FCK.Events.FireEvent( "OnPaste" ) ;
64
function Doc_OnContextMenu()
66
var e = FCK.EditorWindow.event ;
68
FCK.ShowContextMenu( e.screenX, e.screenY ) ;
72
function Doc_OnKeyDown()
74
var e = FCK.EditorWindow.event ;
80
if ( FCKConfig.UseBROnCarriageReturn && !(e.ctrlKey || e.altKey || e.shiftKey) )
84
// We must ignore it if we are inside a List.
85
if ( FCK.EditorDocument.queryCommandState( 'InsertOrderedList' ) || FCK.EditorDocument.queryCommandState( 'InsertUnorderedList' ) )
88
// Insert the <BR> (The must be also inserted to make it work)
89
FCK.InsertHtml( '<br> ' ) ;
92
var oRange = FCK.EditorDocument.selection.createRange() ;
93
oRange.moveStart( 'character', -1 ) ;
95
FCK.EditorDocument.selection.clear() ;
101
case 8 : // BACKSPACE
102
// We must delete a control selection by code and cancels the
103
// keystroke, otherwise IE will execute the browser's "back" button.
104
if ( FCKSelection.GetType() == 'Control' )
106
FCKSelection.Delete() ;
112
if ( FCKConfig.TabSpaces > 0 && !(e.ctrlKey || e.altKey || e.shiftKey) )
114
Doc_OnKeyDownUndo() ;
116
FCK.InsertHtml( window.FCKTabHTML ) ;
121
if ( e.ctrlKey && !(e.altKey || e.shiftKey) )
128
if ( e.ctrlKey && !(e.altKey || e.shiftKey) )
136
if ( !( e.keyCode >=16 && e.keyCode <= 18 ) )
137
Doc_OnKeyDownUndo() ;
141
function Doc_OnKeyDownUndo()
143
if ( !FCKUndo.Typing )
145
FCKUndo.SaveUndoStep() ;
146
FCKUndo.Typing = true ;
147
FCK.Events.FireEvent( "OnSelectionChange" ) ;
150
FCKUndo.TypesCount++ ;
152
if ( FCKUndo.TypesCount > FCKUndo.MaxTypes )
154
FCKUndo.TypesCount = 0 ;
155
FCKUndo.SaveUndoStep() ;
159
function Doc_OnDblClick()
161
FCK.OnDoubleClick( FCK.EditorWindow.event.srcElement ) ;
162
FCK.EditorWindow.event.cancelBubble = true ;
165
function Doc_OnSelectionChange()
167
FCK.Events.FireEvent( "OnSelectionChange" ) ;
170
FCK.InitializeBehaviors = function( dontReturn )
172
// Set the focus to the editable area when clicking in the document area.
173
// TODO: The cursor must be positioned at the end.
174
this.EditorDocument.attachEvent( 'onmouseup', Doc_OnMouseUp ) ;
176
// Intercept pasting operations
177
this.EditorDocument.body.attachEvent( 'onpaste', Doc_OnPaste ) ;
179
// Disable Right-Click and shows the context menu.
180
this.EditorDocument.attachEvent('oncontextmenu', Doc_OnContextMenu ) ;
182
// Build the "TAB" key replacement (if necessary).
183
if ( FCKConfig.TabSpaces > 0 )
185
window.FCKTabHTML = '' ;
186
for ( i = 0 ; i < FCKConfig.TabSpaces ; i++ )
187
window.FCKTabHTML += " " ;
189
this.EditorDocument.attachEvent("onkeydown", Doc_OnKeyDown ) ;
191
this.EditorDocument.attachEvent("ondblclick", Doc_OnDblClick ) ;
193
// Catch cursor movements
194
this.EditorDocument.attachEvent("onselectionchange", Doc_OnSelectionChange ) ;
197
// this.EditorDocument.body.contentEditable = true ;
200
FCK.Focus = function()
204
if ( FCK.EditMode == FCK_EDITMODE_WYSIWYG )
205
FCK.EditorDocument.body.focus() ;
207
document.getElementById('eSourceField').focus() ;
212
FCK.SetHTML = function( html, forceWYSIWYG )
214
if ( forceWYSIWYG || FCK.EditMode == FCK_EDITMODE_WYSIWYG )
216
html = FCKConfig.ProtectedSource.Protect( html ) ;
217
html = FCK.ProtectUrls( html ) ;
221
if ( FCKConfig.FullPage )
224
FCK._BehaviorsStyle +
225
'<link href="' + FCKConfig.FullBasePath + 'css/fck_internal.css' + '" rel="stylesheet" type="text/css" _fcktemp="true" />' ;
227
if ( FCK.TempBaseTag.length > 0 && !FCKRegexLib.HasBaseTag.test( html ) )
228
sHtml += FCK.TempBaseTag ;
230
sHtml = html.replace( FCKRegexLib.HeadOpener, '$&' + sHtml ) ;
236
'<html dir="' + FCKConfig.ContentLangDirection + '"' ;
238
if ( FCKConfig.IEForceVScroll )
239
sHtml += ' style="overflow-y: scroll"' ;
242
'><head><title></title>' +
243
'<link href="' + FCKConfig.EditorAreaCSS + '" rel="stylesheet" type="text/css" />' +
244
'<link href="' + FCKConfig.FullBasePath + 'css/fck_internal.css' + '" rel="stylesheet" type="text/css" _fcktemp="true" />' ;
246
sHtml += FCK._BehaviorsStyle ;
247
sHtml += FCK.TempBaseTag ;
248
sHtml += '</head><body>' + html + '</body></html>' ;
251
// this.EditorDocument.open( '', '_self', '', true ) ; // This one opens popups in IE 5.5 - BUG 1204220 (I was not able to reproduce the problem).
252
this.EditorDocument.open( '', 'replace' ) ;
253
this.EditorDocument.write( sHtml ) ;
254
this.EditorDocument.close() ;
256
this.InitializeBehaviors() ;
257
this.EditorDocument.body.contentEditable = true ;
259
FCK.OnAfterSetHTML() ;
262
document.getElementById('eSourceField').value = html ;
265
FCK.InsertHtml = function( html )
267
html = FCKConfig.ProtectedSource.Protect( html ) ;
268
html = FCK.ProtectUrls( html ) ;
272
FCKUndo.SaveUndoStep() ;
274
// Gets the actual selection.
275
var oSel = FCK.EditorDocument.selection ;
277
// Deletes the actual selection contents.
278
if ( oSel.type.toLowerCase() != "none" )
282
oSel.createRange().pasteHTML( html ) ;
285
FCK.SetInnerHtml = function( html ) // IE Only
287
var oDoc = FCK.EditorDocument ;
288
// Using the following trick, any comment in the begining of the HTML will
290
oDoc.body.innerHTML = '<div id="__fakeFCKRemove__"> </div>' + html ;
291
oDoc.getElementById('__fakeFCKRemove__').removeNode( true ) ;
b'\\ No newline at end of file'