Following is the plugin code for absolute positioning the image/table i am unable to do so in fire fox and safari please help me to resolve the problem it is very very urgent.....
i have gone through the latest fck code but there is no supprot for absolute positioning.
/ BEGIN CODE
// ##### Defining a custom context menu entry.
// ## 1. Define the command to be executed when selecting the context menu item.
var FCKAbsoluteImage = new Object() ;
FCKAbsoluteImage.Name = 'AbsoluteImage' ;
// Globals for object Command Identifiers. Used with execCommand, queryCommand[Enabled|State|Supported|Value]
var CMD_ABSOLUTEPOSITION = 'AbsolutePosition';
var CMD_2DPOSITION = '2D-Position';
var CMD_LIVERESIZE = 'LiveResize';
// Initialization any document level / global wide options - this will be called after the document init has completed.
FCKAbsoluteImage.Init = function(sender, status)
{
if ( FCKBrowserInfo.IsIE ){
alert("i m in ie");
if ( status == FCK_STATUS_COMPLETE )
{
/* Causes the Editor to update an element's appearance continuously
during a resizing or moving operation, rather than updating only at the
completion of the move or resize. */
sender.EditorDocument.execCommand(CMD_LIVERESIZE, true, true);
}
}else{
alert("i m in other browser");
sender.EditorDocument.execCommand(CMD_LIVERESIZE, true, false);
// this.Events.FireEvent( "OnSelectionChange" ) ;
// sender.Focus() ;
}
}
// This is the standard function used to execute the command (called when clicking in the context menu item).
FCKAbsoluteImage.Execute = function()
{
// This command is called only when an element is selected (IMG).
if ( FCKBrowserInfo.IsIE ){
var oRange = FCK.EditorDocument.selection.createRange() ;
var state = oRange.queryCommandValue(CMD_ABSOLUTEPOSITION);
if (state){
oRange.execCommand(CMD_ABSOLUTEPOSITION,false,false);
}else{
oRange.execCommand(CMD_ABSOLUTEPOSITION,false,true);
FCKAbsoluteImage.Enable2DPositioning();
}
}else{
//alert("I am in other browser<<-->");
myelement = FCKSelection.GetSelectedElement();
myelement.style.position ="absolute";
}
}
// Allows absolutely positioned elements to be moved by dragging.
FCKAbsoluteImage.Enable2DPositioning = function()
{
var state = FCK.EditorDocument.queryCommandValue(CMD_2DPOSITION);
if (!state)
FCK.EditorDocument.execCommand(CMD_2DPOSITION);
}
// This is the standard function used to retrieve the command state (it could be disabled for some reason).
FCKAbsoluteImage.GetState = function()
{
// Let's make it always enabled.
return FCK_TRISTATE_OFF ;
}
// ## 2. Register our custom command.
FCKCommands.RegisterCommand( 'AbsoluteImage', FCKAbsoluteImage ) ;
// ## 3. Define the context menu "listener".
var oMyContextMenuListener = new Object() ;
// This is the standard function called right before sowing the context menu.
oMyContextMenuListener.AddItems = function( contextMenu, tag, tagName )
{
if ( tagName == 'IMG' || tagName == 'TABLE' || tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA' || tagName == 'LABEL')
{
contextMenu.AddSeparator() ;
contextMenu.AddItem('AbsoluteImage', 'Set absolute position' );
}
}
// ## 4. Register our context menu listener.
FCK.ContextMenu.RegisterListener( oMyContextMenuListener ) ;
FCK.Events.AttachEvent( 'OnStatusChange', FCKAbsoluteImage.Init);
//End Code
Following are broblems if i use tha above code
1.I can able to drag the control but the Focus is not returned to FCK window (i have tried FCK.Focus() but not success)
2.I am not able to apply this absolute positioning for table,radio and check box.
any one Please help me to resolve the same or any other idea for this kind of plugin.
Thanks
i have gone through the latest fck code but there is no supprot for absolute positioning.
/ BEGIN CODE
// ##### Defining a custom context menu entry.
// ## 1. Define the command to be executed when selecting the context menu item.
var FCKAbsoluteImage = new Object() ;
FCKAbsoluteImage.Name = 'AbsoluteImage' ;
// Globals for object Command Identifiers. Used with execCommand, queryCommand[Enabled|State|Supported|Value]
var CMD_ABSOLUTEPOSITION = 'AbsolutePosition';
var CMD_2DPOSITION = '2D-Position';
var CMD_LIVERESIZE = 'LiveResize';
// Initialization any document level / global wide options - this will be called after the document init has completed.
FCKAbsoluteImage.Init = function(sender, status)
{
if ( FCKBrowserInfo.IsIE ){
alert("i m in ie");
if ( status == FCK_STATUS_COMPLETE )
{
/* Causes the Editor to update an element's appearance continuously
during a resizing or moving operation, rather than updating only at the
completion of the move or resize. */
sender.EditorDocument.execCommand(CMD_LIVERESIZE, true, true);
}
}else{
alert("i m in other browser");
sender.EditorDocument.execCommand(CMD_LIVERESIZE, true, false);
// this.Events.FireEvent( "OnSelectionChange" ) ;
// sender.Focus() ;
}
}
// This is the standard function used to execute the command (called when clicking in the context menu item).
FCKAbsoluteImage.Execute = function()
{
// This command is called only when an element is selected (IMG).
if ( FCKBrowserInfo.IsIE ){
var oRange = FCK.EditorDocument.selection.createRange() ;
var state = oRange.queryCommandValue(CMD_ABSOLUTEPOSITION);
if (state){
oRange.execCommand(CMD_ABSOLUTEPOSITION,false,false);
}else{
oRange.execCommand(CMD_ABSOLUTEPOSITION,false,true);
FCKAbsoluteImage.Enable2DPositioning();
}
}else{
//alert("I am in other browser<<-->");
myelement = FCKSelection.GetSelectedElement();
myelement.style.position ="absolute";
}
}
// Allows absolutely positioned elements to be moved by dragging.
FCKAbsoluteImage.Enable2DPositioning = function()
{
var state = FCK.EditorDocument.queryCommandValue(CMD_2DPOSITION);
if (!state)
FCK.EditorDocument.execCommand(CMD_2DPOSITION);
}
// This is the standard function used to retrieve the command state (it could be disabled for some reason).
FCKAbsoluteImage.GetState = function()
{
// Let's make it always enabled.
return FCK_TRISTATE_OFF ;
}
// ## 2. Register our custom command.
FCKCommands.RegisterCommand( 'AbsoluteImage', FCKAbsoluteImage ) ;
// ## 3. Define the context menu "listener".
var oMyContextMenuListener = new Object() ;
// This is the standard function called right before sowing the context menu.
oMyContextMenuListener.AddItems = function( contextMenu, tag, tagName )
{
if ( tagName == 'IMG' || tagName == 'TABLE' || tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA' || tagName == 'LABEL')
{
contextMenu.AddSeparator() ;
contextMenu.AddItem('AbsoluteImage', 'Set absolute position' );
}
}
// ## 4. Register our context menu listener.
FCK.ContextMenu.RegisterListener( oMyContextMenuListener ) ;
FCK.Events.AttachEvent( 'OnStatusChange', FCKAbsoluteImage.Init);
//End Code
Following are broblems if i use tha above code
1.I can able to drag the control but the Focus is not returned to FCK window (i have tried FCK.Focus() but not success)
2.I am not able to apply this absolute positioning for table,radio and check box.
any one Please help me to resolve the same or any other idea for this kind of plugin.
Thanks
