431 |
ddelon |
1 |
/*
|
|
|
2 |
* FCKeditor - The text editor for internet
|
|
|
3 |
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
|
|
|
4 |
*
|
|
|
5 |
* Licensed under the terms of the GNU Lesser General Public License:
|
|
|
6 |
* http://www.opensource.org/licenses/lgpl-license.php
|
|
|
7 |
*
|
|
|
8 |
* For further information visit:
|
|
|
9 |
* http://www.fckeditor.net/
|
|
|
10 |
*
|
|
|
11 |
* File Name: fckcontextmenu_ie.js
|
|
|
12 |
* Context Menu operations. (IE specific implementations)
|
|
|
13 |
*
|
|
|
14 |
* File Authors:
|
|
|
15 |
* Frederico Caldeira Knabben (fredck@fckeditor.net)
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
function FCKContextMenu_OnContextMenu() { return false ; }
|
|
|
19 |
|
|
|
20 |
FCKContextMenu.Show = function( x, y )
|
|
|
21 |
{
|
|
|
22 |
// Create the Popup used to show the menu (this is a IE 5.5+ feature).
|
|
|
23 |
if ( ! this._Popup )
|
|
|
24 |
{
|
|
|
25 |
this._Popup = window.createPopup() ;
|
|
|
26 |
this._Document = this._Popup.document ;
|
|
|
27 |
this._Document.createStyleSheet( FCKConfig.SkinPath + 'fck_contextmenu.css' ) ;
|
|
|
28 |
this._Document.oncontextmenu = FCKContextMenu_OnContextMenu ;
|
|
|
29 |
|
|
|
30 |
aCleanupDocs[ aCleanupDocs.length ] = this._Document ;
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
// Create the context menu if needed.
|
|
|
34 |
if ( !this._IsLoaded )
|
|
|
35 |
{
|
|
|
36 |
this.Reload() ;
|
|
|
37 |
this._Div.style.visibility = '' ;
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
this.RefreshState() ;
|
|
|
41 |
|
|
|
42 |
// IE doens't get the offsetWidth and offsetHeight values if the element is not visible.
|
|
|
43 |
// So the Popup must be "shown" with no size to be able to get these values.
|
|
|
44 |
this._Popup.show( x, y, 0, 0 ) ;
|
|
|
45 |
|
|
|
46 |
// This was the previous solution. It works well to.
|
|
|
47 |
// So a temporary element is created to get this for us.
|
|
|
48 |
/*
|
|
|
49 |
if ( !this._DivCopy )
|
|
|
50 |
{
|
|
|
51 |
this._DivCopy = document.createElement( 'DIV' ) ;
|
|
|
52 |
this._DivCopy.className = 'CM_ContextMenu' ;
|
|
|
53 |
this._DivCopy.style.position = 'absolute' ;
|
|
|
54 |
this._DivCopy.style.visibility = 'hidden' ;
|
|
|
55 |
document.body.appendChild( this._DivCopy );
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
this._DivCopy.innerHTML = this._Div.innerHTML ;
|
|
|
59 |
*/
|
|
|
60 |
|
|
|
61 |
// Show the Popup at the specified location.
|
|
|
62 |
this._Popup.show( x, y, this._Div.offsetWidth, this._Div.offsetHeight ) ;
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
FCKContextMenu.Hide = function()
|
|
|
66 |
{
|
|
|
67 |
if ( this._Popup )
|
|
|
68 |
this._Popup.hide() ;
|
|
|
69 |
}
|