Index: /CKEditor/trunk/_source/plugins/clipboard/dialogs/paste.js
===================================================================
--- /CKEditor/trunk/_source/plugins/clipboard/dialogs/paste.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/clipboard/dialogs/paste.js (revision 3276)
@@ -56,6 +56,6 @@
title : editor.lang.clipboard.title,
- minWidth : 400,
- minHeight : 330,
+ minWidth : 350,
+ minHeight : 240,
onShow : function()
Index: /CKEditor/trunk/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/dialog/plugin.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/dialog/plugin.js (revision 3276)
@@ -73,4 +73,7 @@
return null;
}
+
+ // Stores dialog related data from skin definitions. e.g. margin sizes.
+ var skinData = {};
/**
@@ -109,4 +112,6 @@
, editor ).definition;
+ var doc = CKEDITOR.document;
+
var themeBuilt = editor.theme.buildDialog( editor );
@@ -137,64 +142,6 @@
};
- /**
- * An associative map of elements in the dialog. It has the following members:
- *
- * - tl - top left corner.
- * - tl_resize - resize handle at the top left corner.
- * - t - top side.
- * - t_resize - resize handle at the top.
- * - tr - top right corner.
- * - tr_resize - resize handle at the top right.
- * - l - left side.
- * - l_resize - resize handle at the left side.
- * - c - center area.
- * - r - right side.
- * - r_resize - resize handle at the right side.
- * - bl - bottom left corner.
- * - bl_resize - resize handle at the bottom left.
- * - b - bottom side.
- * - b_resize - resize handle at the bottom.
- * - br - bottom right corner.
- * - br_resize - resize handle at the bottom right.
- * - title - title area.
- * - close - close button.
- * - tabs - tabs area.
- * - contents - the content page area.
- * - footer - the footer area.
- *
- * @type Object
- * @field
- */
- this.parts = {
- 'tl' : [0,0],
- 'tl_resize' : [0,0,0],
- 't' : [0,1],
- 't_resize' : [0,1,0],
- 'tr' : [0,2],
- 'tr_resize' : [0,2,0],
- 'l' : [1,0],
- 'l_resize' : [1,0,0],
- 'c' : [1,1],
- 'r' : [1,2],
- 'r_resize' : [1,2,0],
- 'bl' : [2,0],
- 'bl_resize' : [2,0,0],
- 'b' : [2,1],
- 'b_resize' : [2,1,0],
- 'br' : [2,2],
- 'br_resize' : [2,2,0],
- 'title' : [1,1,0],
- 'close' : [1,1,0,0],
- 'tabs' : [1,1,1,0,0],
- 'tabs_table' : [1,1,1],
- 'contents' : [1,1,2],
- 'footer' : [1,1,3]
- };
-
- // Initialize the parts map.
- var element = this._.element.getFirst();
- for ( var i in this.parts )
- this.parts[i] = element.getChild( this.parts[i] );
-
+ this.parts = themeBuilt.parts;
+
// Call the CKEDITOR.event constructor to initialize this instance.
CKEDITOR.event.call( this );
@@ -331,5 +278,5 @@
var nextId = shiftPressed ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me );
me.selectPage( nextId );
- me._.tabs[ nextId ][ 0 ].getFirst().focus();
+ me._.tabs[ nextId ][ 0 ].focus();
}
else
@@ -345,5 +292,5 @@
// Alt-F10 puts focus into the current tab item in the tab bar.
me._.tabBarMode = true;
- me._.tabs[ me._.currentTabId ][ 0 ].getFirst().focus();
+ me._.tabs[ me._.currentTabId ][ 0 ].focus();
processed = true;
}
@@ -353,5 +300,5 @@
var nextId = ( keystroke == 37 ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ) );
me.selectPage( nextId );
- me._.tabs[ nextId ][ 0 ].getFirst().focus();
+ me._.tabs[ nextId ][ 0 ].focus();
processed = true;
}
@@ -424,9 +371,5 @@
// Find the outer container of the tab.
- while ( target.getName() != 'td' || !tabOuterRegex.test( target.$.className ) )
- {
- target = target.getParent();
- }
- id = target.$.id.substr( 0, target.$.id.lastIndexOf( '_' ) );
+ var id = target.$.id.substr( 0, target.$.id.lastIndexOf( '_' ) );
this.selectPage( id );
@@ -455,5 +398,5 @@
// Insert dummy text box for grabbing focus away from the editing area.
this._.dummyText = CKEDITOR.dom.element.createFromHtml( '' );
- this._.dummyText.appendTo( element );
+ this._.dummyText.appendTo( themeBuilt.element );
CKEDITOR.skins.load( editor.config.skin, 'dialog' );
@@ -497,5 +440,6 @@
getSize : function()
{
- return CKEDITOR.tools.extend( {}, this._.size );
+ var element = this._.element.getFirst();
+ return { width : element.$.offsetWidth, height : element.$.offsetHeight };
},
@@ -515,6 +459,7 @@
// The dialog may be fixed positioned or absolute positioned. Ask the
// browser what is the current situation first.
+ var element = this._.element.getElementsByTag( 'div' ).getItem( 0 );
if ( isFixed === undefined )
- isFixed = this._.element.getFirst().getComputedStyle( 'position' ) == 'fixed';
+ isFixed = element.getComputedStyle( 'position' ) == 'fixed';
if ( isFixed && this._.position && this._.position.x == x && this._.position.y == y )
@@ -532,5 +477,5 @@
}
- this._.element.getFirst().setStyles(
+ element.setStyles(
{
'left' : x + 'px',
@@ -733,5 +678,7 @@
className : 'cke_dialog_page_contents',
children : contents.elements,
- expand : !!contents.expand
+ expand : !!contents.expand,
+ padding : contents.padding,
+ style : 'width: 100%; height: 100%;'
}, pageHtml );
@@ -739,26 +686,19 @@
var page = CKEDITOR.dom.element.createFromHtml( pageHtml.join( '' ) );
var tab = CKEDITOR.dom.element.createFromHtml( [
- '',
- '',
- '',
- ' | ',
- '',
- CKEDITOR.tools.htmlEncode( contents.label.replace( / /g, '\xa0' ) ),
- ' | ',
- ' | ',
- '
| '
+ ' 0 ? ' cke_last' : 'cke_first' ),
+ titleHtml,
+ ' id="', contents.id + '_', CKEDITOR.tools.getNextNumber(), '"' +
+ ' href="javascript:void(0)"',
+ ' hidefocus="true">',
+ contents.label,
+ ''
].join( '' ) );
- tab = tab.getChild( [0,0,0] );
-
- // First and last tab styles classes.
- if ( this._.lastTab )
- this._.lastTab.removeClass( 'last' );
- tab.addClass( this._.pageCount > 0 ? 'last' : 'first' );
// If only a single page exist, a different style is used in the central pane.
if ( this._.pageCount === 0 )
- this.parts.c.addClass( 'single_page' );
+ this.parts.dialog.addClass( 'cke_single_page' );
else
- this.parts.c.removeClass( 'single_page' );
+ this.parts.dialog.removeClass( 'cke_single_page' );
// Take records for the tabs and elements created.
@@ -767,7 +707,9 @@
this._.pageCount++;
this._.lastTab = tab;
+
var contentMap = this._.contents[ contents.id ] = {},
cursor,
children = vbox.getChild();
+
while ( ( cursor = children.shift() ) )
{
@@ -778,9 +720,10 @@
// Attach the DOM nodes.
+
+ page.setAttribute( 'name', contents.id );
+ page.appendTo( this.parts.contents );
+
tab.unselectable();
- page.appendTo( this.parts.contents );
- tab.insertBefore( this.parts.tabs.getChild( this.parts.tabs.getChildCount() - 1 ) );
- tab.setAttribute( 'id', contents.id + '_' + CKEDITOR.tools.getNextNumber() );
- page.setAttribute( 'name', contents.id );
+ this.parts.tabs.append( tab );
// Add access key handlers if access key is defined.
@@ -1061,5 +1004,4 @@
type : 'button',
label : editor.lang.common.ok,
- style : 'width: 60px',
onClick : function( evt )
{
@@ -1095,5 +1037,4 @@
type : 'button',
label : editor.lang.common.cancel,
- style : 'width: 60px',
onClick : function( evt )
{
@@ -1121,21 +1062,5 @@
addUIElement : function( typeName, builder )
{
- this._.uiElementBuilders[typeName] = builder;
- },
-
- /**
- * Sets the width of margins of dialogs, which is used for the dialog moving and resizing logic.
- * The margin here means the area between the dialog's container and the visual boundary of the dialog.
- * Typically this area is used for dialog shadows.
- * This function is typically called in a skin's JavaScript files.
- * @param {Number} top The top margin in pixels.
- * @param {Number} right The right margin in pixels.
- * @param {Number} bottom The bottom margin in pixels.
- * @param {Number} left The left margin in pixels.
- * @example
- */
- setMargins : function( top, right, bottom, left )
- {
- this._.margins = [ top, right, bottom, left ];
+ this._.uiElementBuilders[ typeName ] = builder;
}
});
@@ -1149,7 +1074,5 @@
currentTop : null,
- currentZIndex : null,
-
- margins : [0, 0, 0, 0]
+ currentZIndex : null
};
@@ -1352,5 +1275,5 @@
* } );
*/
- var contentObject = function( dialog, contentDefinition )
+ function contentObject( dialog, contentDefinition )
{
this._ =
@@ -1360,5 +1283,5 @@
CKEDITOR.tools.extend( this, contentDefinition );
- };
+ }
contentObject.prototype =
@@ -1405,75 +1328,79 @@
};
- var initDragAndDrop = function( dialog )
+ function initDragAndDrop( dialog )
{
var lastCoords = null,
abstractDialogCoords = null,
element = dialog.getElement().getFirst(),
- magnetDistance = dialog._.editor.config.dialog_magnetDistance,
- mouseMoveHandler = function( evt )
- {
- var dialogSize = dialog.getSize(),
- viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(),
- x = evt.data.$.screenX,
- y = evt.data.$.screenY,
- dx = x - lastCoords.x,
- dy = y - lastCoords.y,
- realX, realY;
-
- lastCoords = { x : x, y : y };
- abstractDialogCoords.x += dx;
- abstractDialogCoords.y += dy;
-
- if ( abstractDialogCoords.x + CKEDITOR.dialog._.margins[3] < magnetDistance )
- realX = - CKEDITOR.dialog._.margins[3];
- else if ( abstractDialogCoords.x - CKEDITOR.dialog._.margins[1] > viewPaneSize.width - dialogSize.width - magnetDistance )
- realX = viewPaneSize.width - dialogSize.width + CKEDITOR.dialog._.margins[1];
- else
- realX = abstractDialogCoords.x;
-
- if ( abstractDialogCoords.y + CKEDITOR.dialog._.margins[0] < magnetDistance )
- realY = - CKEDITOR.dialog._.margins[0];
- else if ( abstractDialogCoords.y - CKEDITOR.dialog._.margins[2] > viewPaneSize.height - dialogSize.height - magnetDistance )
- realY = viewPaneSize.height - dialogSize.height + CKEDITOR.dialog._.margins[2];
- else
- realY = abstractDialogCoords.y;
-
- dialog.move( realX, realY );
+ editor = dialog.getParentEditor(),
+ magnetDistance = editor.config.dialog_magnetDistance,
+ margins = skinData[ editor.config.skin ].margins || [ 0, 0, 0, 0 ];
+
+ function mouseMoveHandler( evt )
+ {
+ var dialogSize = dialog.getSize(),
+ viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(),
+ x = evt.data.$.screenX,
+ y = evt.data.$.screenY,
+ dx = x - lastCoords.x,
+ dy = y - lastCoords.y,
+ realX, realY;
+
+ lastCoords = { x : x, y : y };
+ abstractDialogCoords.x += dx;
+ abstractDialogCoords.y += dy;
+
+ if ( abstractDialogCoords.x + margins[3] < magnetDistance )
+ realX = - margins[3];
+ else if ( abstractDialogCoords.x - margins[1] > viewPaneSize.width - dialogSize.width - magnetDistance )
+ realX = viewPaneSize.width - dialogSize.width + margins[1];
+ else
+ realX = abstractDialogCoords.x;
+
+ if ( abstractDialogCoords.y + margins[0] < magnetDistance )
+ realY = - margins[0];
+ else if ( abstractDialogCoords.y - margins[2] > viewPaneSize.height - dialogSize.height - magnetDistance )
+ realY = viewPaneSize.height - dialogSize.height + margins[2];
+ else
+ realY = abstractDialogCoords.y;
+
+ dialog.move( realX, realY );
+
+ evt.data.preventDefault();
+ }
+
+ function mouseUpHandler( evt )
+ {
+ CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
+ CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
+
+ if ( CKEDITOR.env.ie6Compat )
+ {
+ var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
+ coverDoc.removeListener( 'mousemove', mouseMoveHandler );
+ coverDoc.removeListener( 'mouseup', mouseUpHandler );
+ }
+ }
+
+ dialog.parts.title.on( 'mousedown', function( evt )
+ {
+ lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
+
+ CKEDITOR.document.on( 'mousemove', mouseMoveHandler );
+ CKEDITOR.document.on( 'mouseup', mouseUpHandler );
+ abstractDialogCoords = dialog.getPosition();
+
+ if ( CKEDITOR.env.ie6Compat )
+ {
+ var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
+ coverDoc.on( 'mousemove', mouseMoveHandler );
+ coverDoc.on( 'mouseup', mouseUpHandler );
+ }
evt.data.preventDefault();
- },
- mouseUpHandler = function( evt )
- {
- CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
- CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
-
- if ( CKEDITOR.env.ie6Compat )
- {
- var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
- coverDoc.removeListener( 'mousemove', mouseMoveHandler );
- coverDoc.removeListener( 'mouseup', mouseUpHandler );
- }
- };
-
- dialog.parts.title.on( 'mousedown', function( evt )
- {
- lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
-
- CKEDITOR.document.on( 'mousemove', mouseMoveHandler );
- CKEDITOR.document.on( 'mouseup', mouseUpHandler );
- abstractDialogCoords = dialog.getPosition();
-
- if ( CKEDITOR.env.ie6Compat )
- {
- var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
- coverDoc.on( 'mousemove', mouseMoveHandler );
- coverDoc.on( 'mouseup', mouseUpHandler );
- }
-
- evt.data.preventDefault();
- }, dialog );
- };
-
- var initResizeHandles = function( dialog )
+ }, dialog );
+ }
+
+ function initResizeHandles( dialog )
{
var definition = dialog.definition,
@@ -1481,130 +1408,140 @@
minHeight = definition.minHeight || 0,
resizable = definition.resizable,
- topSizer = function( coords, dy )
- {
- coords.y += dy;
- },
- rightSizer = function( coords, dx )
- {
- coords.x2 += dx;
- },
- bottomSizer = function( coords, dy )
- {
- coords.y2 += dy;
- },
- leftSizer = function( coords, dx )
- {
- coords.x += dx;
- },
- lastCoords = null,
+ margins = skinData[ dialog.getParentEditor().config.skin ].margins || [ 0, 0, 0, 0 ];
+
+ function topSizer( coords, dy )
+ {
+ coords.y += dy;
+ }
+
+ function rightSizer( coords, dx )
+ {
+ coords.x2 += dx;
+ }
+
+ function bottomSizer( coords, dy )
+ {
+ coords.y2 += dy;
+ }
+
+ function leftSizer( coords, dx )
+ {
+ coords.x += dx;
+ }
+
+ var lastCoords = null,
abstractDialogCoords = null,
magnetDistance = dialog._.editor.config.magnetDistance,
- parts = [ 'tl', 't', 'tr', 'l', 'r', 'bl', 'b', 'br' ],
- mouseDownHandler = function( evt )
- {
- var partName = evt.listenerData.part, size = dialog.getSize();
- abstractDialogCoords = dialog.getPosition();
- CKEDITOR.tools.extend( abstractDialogCoords,
- {
- x2 : abstractDialogCoords.x + size.width,
- y2 : abstractDialogCoords.y + size.height
- } );
- lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
-
- CKEDITOR.document.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } );
- CKEDITOR.document.on( 'mouseup', mouseUpHandler, dialog, { part : partName } );
-
- if ( CKEDITOR.env.ie6Compat )
- {
- var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
- coverDoc.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } );
- coverDoc.on( 'mouseup', mouseUpHandler, dialog, { part : partName } );
- }
-
- evt.data.preventDefault();
- },
- mouseMoveHandler = function( evt )
- {
- var x = evt.data.$.screenX,
- y = evt.data.$.screenY,
- dx = x - lastCoords.x,
- dy = y - lastCoords.y,
- viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(),
- partName = evt.listenerData.part;
-
- if ( partName.search( 't' ) != -1 )
- topSizer( abstractDialogCoords, dy );
- if ( partName.search( 'l' ) != -1 )
- leftSizer( abstractDialogCoords, dx );
- if ( partName.search( 'b' ) != -1 )
- bottomSizer( abstractDialogCoords, dy );
- if ( partName.search( 'r' ) != -1 )
- rightSizer( abstractDialogCoords, dx );
-
- lastCoords = { x : x, y : y };
-
- var realX, realY, realX2, realY2;
-
- if ( abstractDialogCoords.x + CKEDITOR.dialog._.margins[3] < magnetDistance )
- realX = - CKEDITOR.dialog._.margins[3];
- else if ( partName.search( 'l' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance )
- realX = abstractDialogCoords.x2 - minWidth;
- else
- realX = abstractDialogCoords.x;
-
- if ( abstractDialogCoords.y + CKEDITOR.dialog._.margins[0] < magnetDistance )
- realY = - CKEDITOR.dialog._.margins[0];
- else if ( partName.search( 't' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance )
- realY = abstractDialogCoords.y2 - minHeight;
- else
- realY = abstractDialogCoords.y;
-
- if ( abstractDialogCoords.x2 - CKEDITOR.dialog._.margins[1] > viewPaneSize.width - magnetDistance )
- realX2 = viewPaneSize.width + CKEDITOR.dialog._.margins[1] ;
- else if ( partName.search( 'r' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance )
- realX2 = abstractDialogCoords.x + minWidth;
- else
- realX2 = abstractDialogCoords.x2;
-
- if ( abstractDialogCoords.y2 - CKEDITOR.dialog._.margins[2] > viewPaneSize.height - magnetDistance )
- realY2= viewPaneSize.height + CKEDITOR.dialog._.margins[2] ;
- else if ( partName.search( 'b' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance )
- realY2 = abstractDialogCoords.y + minHeight;
- else
- realY2 = abstractDialogCoords.y2 ;
-
- dialog.move( realX, realY );
- dialog.resize( realX2 - realX, realY2 - realY );
-
- evt.data.preventDefault();
- },
- mouseUpHandler = function( evt )
- {
- CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
- CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
-
- if ( CKEDITOR.env.ie6Compat )
- {
- var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
- coverDoc.removeListener( 'mouseup', mouseUpHandler );
- coverDoc.removeListener( 'mousemove', mouseMoveHandler );
- }
- };
-
- var widthTest = /[lr]/,
- heightTest = /[tb]/;
- for ( var i = 0 ; i < parts.length ; i++ )
- {
- var element = dialog.parts[ parts[i] + '_resize' ];
- if ( resizable == CKEDITOR.DIALOG_RESIZE_NONE ||
- resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT && widthTest.test( parts[i] ) ||
- resizable == CKEDITOR.DIALOG_RESIZE_WIDTH && heightTest.test( parts[i] ) )
- {
- element.hide();
- continue;
- }
- element.on( 'mousedown', mouseDownHandler, dialog, { part : parts[i] } );
- }
- };
+ parts = [ 'tl', 't', 'tr', 'l', 'r', 'bl', 'b', 'br' ];
+
+ function mouseDownHandler( evt )
+ {
+ var partName = evt.listenerData.part, size = dialog.getSize();
+ abstractDialogCoords = dialog.getPosition();
+ CKEDITOR.tools.extend( abstractDialogCoords,
+ {
+ x2 : abstractDialogCoords.x + size.width,
+ y2 : abstractDialogCoords.y + size.height
+ } );
+ lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
+
+ CKEDITOR.document.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } );
+ CKEDITOR.document.on( 'mouseup', mouseUpHandler, dialog, { part : partName } );
+
+ if ( CKEDITOR.env.ie6Compat )
+ {
+ var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
+ coverDoc.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } );
+ coverDoc.on( 'mouseup', mouseUpHandler, dialog, { part : partName } );
+ }
+
+ evt.data.preventDefault();
+ }
+
+ function mouseMoveHandler( evt )
+ {
+ var x = evt.data.$.screenX,
+ y = evt.data.$.screenY,
+ dx = x - lastCoords.x,
+ dy = y - lastCoords.y,
+ viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(),
+ partName = evt.listenerData.part;
+
+ if ( partName.search( 't' ) != -1 )
+ topSizer( abstractDialogCoords, dy );
+ if ( partName.search( 'l' ) != -1 )
+ leftSizer( abstractDialogCoords, dx );
+ if ( partName.search( 'b' ) != -1 )
+ bottomSizer( abstractDialogCoords, dy );
+ if ( partName.search( 'r' ) != -1 )
+ rightSizer( abstractDialogCoords, dx );
+
+ lastCoords = { x : x, y : y };
+
+ var realX, realY, realX2, realY2;
+
+ if ( abstractDialogCoords.x + margins[3] < magnetDistance )
+ realX = - margins[3];
+ else if ( partName.search( 'l' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance )
+ realX = abstractDialogCoords.x2 - minWidth;
+ else
+ realX = abstractDialogCoords.x;
+
+ if ( abstractDialogCoords.y + margins[0] < magnetDistance )
+ realY = - margins[0];
+ else if ( partName.search( 't' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance )
+ realY = abstractDialogCoords.y2 - minHeight;
+ else
+ realY = abstractDialogCoords.y;
+
+ if ( abstractDialogCoords.x2 - margins[1] > viewPaneSize.width - magnetDistance )
+ realX2 = viewPaneSize.width + margins[1] ;
+ else if ( partName.search( 'r' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance )
+ realX2 = abstractDialogCoords.x + minWidth;
+ else
+ realX2 = abstractDialogCoords.x2;
+
+ if ( abstractDialogCoords.y2 - margins[2] > viewPaneSize.height - magnetDistance )
+ realY2= viewPaneSize.height + margins[2] ;
+ else if ( partName.search( 'b' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance )
+ realY2 = abstractDialogCoords.y + minHeight;
+ else
+ realY2 = abstractDialogCoords.y2 ;
+
+ dialog.move( realX, realY );
+ dialog.resize( realX2 - realX, realY2 - realY );
+
+ evt.data.preventDefault();
+ }
+
+ function mouseUpHandler( evt )
+ {
+ CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
+ CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
+
+ if ( CKEDITOR.env.ie6Compat )
+ {
+ var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
+ coverDoc.removeListener( 'mouseup', mouseUpHandler );
+ coverDoc.removeListener( 'mousemove', mouseMoveHandler );
+ }
+ }
+
+// TODO : Simplify the resize logic, having just a single resize grip .
+// var widthTest = /[lr]/,
+// heightTest = /[tb]/;
+// for ( var i = 0 ; i < parts.length ; i++ )
+// {
+// var element = dialog.parts[ parts[i] + '_resize' ];
+// if ( resizable == CKEDITOR.DIALOG_RESIZE_NONE ||
+// resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT && widthTest.test( parts[i] ) ||
+// resizable == CKEDITOR.DIALOG_RESIZE_WIDTH && heightTest.test( parts[i] ) )
+// {
+// element.hide();
+// continue;
+// }
+// element.on( 'mousedown', mouseDownHandler, dialog, { part : parts[i] } );
+// }
+ }
var resizeCover;
@@ -1664,8 +1601,8 @@
var size = win.getViewPaneSize();
element.setStyles(
- {
- width : size.width + 'px',
- height : size.height + 'px'
- });
+ {
+ width : size.width + 'px',
+ height : size.height + 'px'
+ } );
};
@@ -2025,7 +1962,13 @@
};
- CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition || { type : 'hbox' }, htmlList, 'table', styles,
- { align : ( elementDefinition && elementDefinition.align ) ||
- ( dialog.getParentEditor().lang.dir == 'ltr' ? 'left' : 'right' ) }, innerHTML );
+ CKEDITOR.ui.dialog.uiElement.call(
+ this,
+ dialog,
+ elementDefinition || { type : 'hbox' },
+ htmlList,
+ 'table',
+ styles,
+ elementDefinition && elementDefinition.align && { align : elementDefinition.align } || null,
+ innerHTML );
},
@@ -2598,4 +2541,14 @@
})();
+ // Grab the margin data from skin definition and store it away.
+ CKEDITOR.skins.add = ( function()
+ {
+ var original = CKEDITOR.skins.add;
+ return function( skinName, skinDefinition )
+ {
+ skinData[ skinName ] = { margins : skinDefinition.margins };
+ return original.apply( this, arguments );
+ };
+ } )();
})();
Index: /CKEditor/trunk/_source/plugins/dialogui/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/dialogui/plugin.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/dialogui/plugin.js (revision 3276)
@@ -435,111 +435,87 @@
button : function( dialog, elementDefinition, htmlList )
{
- if ( arguments.length < 3)
+ if ( !arguments.length )
return;
- if ( typeof( elementDefinition ) == 'function' )
+ if ( typeof elementDefinition == 'function' )
elementDefinition = elementDefinition( dialog.getParentEditor() );
+
initPrivateObject.call( this, elementDefinition, { disabled : elementDefinition.disabled || false } );
-
- /** @ignore */
- var innerHTML = function()
- {
- var styles = [],
- align = elementDefinition.align || ( dialog.getParentEditor().lang.dir == 'ltr' ? 'left' : 'right' );
-
- if ( elementDefinition.style )
- {
- var defStyle = CKEDITOR.tools.trim( elementDefinition.style );
- styles.push( defStyle );
- if ( defStyle.charAt( defStyle.length - 1 ) != ';' )
- styles.push( ';' );
- }
-
- // IE6 & 7 BUG: Need to set margin as well as align.
- if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 )
- {
- styles.push( [
- 'margin:',
- 'auto',
- align == 'right' ? '0px' : 'auto',
- 'auto',
- align == 'left' ? '0px' : 'auto' ].join( ' ' ), ';' );
- }
-
- return [
- ' 0 ? 'style="' + styles.join( '' ) + '">' : '>',
- '',
- CKEDITOR.tools.htmlEncode( elementDefinition.label ),
- ' | '
- ].join( '' );
- };
// Add OnClick event to this input.
CKEDITOR.event.implementOn( this );
+ var me = this;
+
// Register an event handler for processing button clicks.
- var me = this;
dialog.on( 'load', function( eventInfo )
+ {
+ var element = this.getElement();
+
+ element.on( 'mousedown', function( evt )
+ {
+ // If button is disabled, don't do anything.
+ if ( me._.disabled )
+ return;
+
+ // Store the currently active button.
+ CKEDITOR.ui.dialog.button._.activeButton = [ me, me.getElement() ];
+ } );
+
+ element.on( 'keydown', function( evt )
+ {
+ // Click if Enter is pressed.
+ if ( evt.data.$.keyCode == 13 )
+ {
+ me.fire( 'click', { dialog : me.getDialog() } );
+ evt.data.preventDefault();
+ }
+ } );
+
+ if ( !eventInfo.data.buttonHandlerRegistered )
{
- var element = this.getElement();
- (function()
- {
- element.on( 'mousedown', function( evt )
- {
- // If button is disabled, don't do anything.
- if ( me._.disabled )
- return;
-
- // Store the currently active button.
- CKEDITOR.ui.dialog.button._.activeButton = [ me, me.getElement() ];
- } );
-
- element.on( 'keydown', function( evt )
- {
- // Click if Enter is pressed.
- if ( evt.data.$.keyCode == 13 )
- {
- me.fire( 'click', { dialog : me.getDialog() } );
- evt.data.preventDefault();
- }
- } );
- })();
-
- // IE BUG: Padding attributes are ignored for cells.
- if ( CKEDITOR.env.ie )
- element.getChild( [0, 0, 0, 0] ).$.innerHTML += '';
-
- if ( !eventInfo.data.buttonHandlerRegistered )
- {
- CKEDITOR.document.on( 'mouseup', function( evt )
- {
- var target = evt.data.getTarget(),
- activeButton = CKEDITOR.ui.dialog.button._.activeButton;
-
- // If there's no active button, bail out.
- if ( !activeButton )
- return;
-
- // Fire the click event - but only if the
- // active button is the same as target.
- if ( activeButton[1].equals( target.getAscendant( 'a' ) ) )
- activeButton[0].fire( 'click', { dialog : activeButton[0].getDialog() } );
-
- // Clear active button flag.
- CKEDITOR.ui.dialog.button._.activeButton = null;
- } );
-
- eventInfo.data.buttonHandlerRegistered = true;
- }
-
- this.getElement().getFirst().unselectable();
- }, this );
+ CKEDITOR.document.on( 'mouseup', function( evt )
+ {
+ var target = evt.data.getTarget(),
+ activeButton = CKEDITOR.ui.dialog.button._.activeButton;
+
+ // If there's no active button, bail out.
+ if ( !activeButton )
+ return;
+
+ // Fire the click event - but only if the
+ // active button is the same as target.
+ if ( activeButton[1].equals( target.getAscendant( 'a' ) ) )
+ activeButton[0].fire( 'click', { dialog : activeButton[0].getDialog() } );
+
+ // Clear active button flag.
+ CKEDITOR.ui.dialog.button._.activeButton = null;
+ } );
+
+ eventInfo.data.buttonHandlerRegistered = true;
+ }
+
+ this.getElement().getFirst().unselectable();
+ }, this );
var outerDefinition = CKEDITOR.tools.extend( {}, elementDefinition );
delete outerDefinition.style;
- CKEDITOR.ui.dialog.uiElement.call( this, dialog, outerDefinition, htmlList, 'a', { display : 'block', outline : 'none' },
- { href : 'javascript:void(0);', title : elementDefinition.label, hidefocus : 'true' },
- innerHTML );
+ CKEDITOR.ui.dialog.uiElement.call(
+ this,
+ dialog,
+ outerDefinition,
+ htmlList,
+ 'a',
+ null,
+ {
+ style : elementDefinition.style,
+ href : 'javascript:void(0);',
+ title : elementDefinition.label,
+ hidefocus : 'true'
+ },
+ '' +
+ CKEDITOR.tools.htmlEncode( elementDefinition.label ) +
+ '' );
},
Index: /CKEditor/trunk/_source/plugins/find/dialogs/find.js
===================================================================
--- /CKEditor/trunk/_source/plugins/find/dialogs/find.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/find/dialogs/find.js (revision 3276)
@@ -555,6 +555,6 @@
title : editor.lang.findAndReplace.title,
resizable : CKEDITOR.DIALOG_RESIZE_NONE,
- minWidth : 400,
- minHeight : 255,
+ minWidth : 350,
+ minHeight : 165,
buttons : [ CKEDITOR.dialog.cancelButton ], //Cancel button only.
contents : [
Index: /CKEditor/trunk/_source/plugins/flash/dialogs/flash.js
===================================================================
--- /CKEditor/trunk/_source/plugins/flash/dialogs/flash.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/flash/dialogs/flash.js (revision 3276)
@@ -180,6 +180,6 @@
return {
title : editor.lang.flash.title,
- minWidth : 450,
- minHeight : 400,
+ minWidth : 400,
+ minHeight : 310,
onLoad : function()
{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/button.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/button.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/button.js (revision 3276)
@@ -7,6 +7,6 @@
return {
title : editor.lang.button.title,
- minWidth : 400,
- minHeight : 230,
+ minWidth : 350,
+ minHeight : 140,
onShow : function()
{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/checkbox.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/checkbox.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/checkbox.js (revision 3276)
@@ -7,6 +7,6 @@
return {
title : editor.lang.checkboxAndRadio.checkboxTitle,
- minWidth : 400,
- minHeight : 230,
+ minWidth : 350,
+ minHeight : 140,
onShow : function()
{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/form.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/form.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/form.js (revision 3276)
@@ -7,6 +7,6 @@
return {
title : editor.lang.form.title,
- minWidth : 400,
- minHeight : 270,
+ minWidth : 350,
+ minHeight : 190,
onShow : function()
{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/hiddenfield.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/hiddenfield.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/hiddenfield.js (revision 3276)
@@ -7,6 +7,6 @@
return {
title : editor.lang.hidden.title,
- minWidth : 400,
- minHeight : 200,
+ minWidth : 350,
+ minHeight : 110,
onShow : function()
{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/radio.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/radio.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/radio.js (revision 3276)
@@ -7,6 +7,6 @@
return {
title : editor.lang.checkboxAndRadio.radioTitle,
- minWidth : 400,
- minHeight : 200,
+ minWidth : 350,
+ minHeight : 130,
onShow : function()
{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/select.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/select.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/select.js (revision 3276)
@@ -131,6 +131,6 @@
return {
title : editor.lang.select.title,
- minWidth : 400,
- minHeight : 370,
+ minWidth : 375,
+ minHeight : 270,
onShow : function()
{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/textarea.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/textarea.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/textarea.js (revision 3276)
@@ -7,6 +7,6 @@
return {
title : editor.lang.textarea.title,
- minWidth : 400,
- minHeight : 230,
+ minWidth : 350,
+ minHeight : 140,
onShow : function()
{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/textfield.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/textfield.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/textfield.js (revision 3276)
@@ -7,6 +7,6 @@
return {
title : editor.lang.textfield.title,
- minWidth : 400,
- minHeight : 230,
+ minWidth : 350,
+ minHeight : 140,
onShow : function()
{
Index: /CKEditor/trunk/_source/plugins/image/dialogs/image.js
===================================================================
--- /CKEditor/trunk/_source/plugins/image/dialogs/image.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/image/dialogs/image.js (revision 3276)
@@ -187,6 +187,6 @@
return {
title : ( dialogType == 'image' ) ? editor.lang.image.title : editor.lang.image.titleButton,
- minWidth : 450,
- minHeight : 400,
+ minWidth : 420,
+ minHeight : 310,
onShow : function()
{
Index: /CKEditor/trunk/_source/plugins/link/dialogs/anchor.js
===================================================================
--- /CKEditor/trunk/_source/plugins/link/dialogs/anchor.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/link/dialogs/anchor.js (revision 3276)
@@ -22,6 +22,6 @@
return {
title : editor.lang.anchor.title,
- minWidth : 350,
- minHeight : 150,
+ minWidth : 300,
+ minHeight : 60,
onOk : function()
{
Index: /CKEditor/trunk/_source/plugins/link/dialogs/link.js
===================================================================
--- /CKEditor/trunk/_source/plugins/link/dialogs/link.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/link/dialogs/link.js (revision 3276)
@@ -240,6 +240,6 @@
return {
title : editor.lang.link.title,
- minWidth : 400,
- minHeight : 320,
+ minWidth : 350,
+ minHeight : 230,
contents : [
{
Index: /CKEditor/trunk/_source/plugins/pastefromword/dialogs/pastefromword.js
===================================================================
--- /CKEditor/trunk/_source/plugins/pastefromword/dialogs/pastefromword.js (revision 3275)
+++ /CKEditor/trunk/_source/plugins/pastefromword/dialogs/pastefromword.js (revision 3276)
@@ -8,6 +8,6 @@
return {
title : editor.lang.pastefromword.title,
- minWidth : 400,
- minHeight : 340,
+ minWidth : 350,
+ minHeight : 250,
htmlToLoad : ' | |