mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-19 15:14:54 +00:00
Imported CKEDITOR 3.0
Monotone-Parent: 5f9c08dd6b5b34d815ddb2108abbf4055e846934 Monotone-Revision: b2cf7eda0ef8f15fb6e78f8c38a7406a47bcdd2f Monotone-Author: crobert@inverse.ca Monotone-Date: 2009-08-26T14:03:12 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -358,7 +358,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
|
||||
* IE BUG: If the initial focus went into a non-text element (e.g. button),
|
||||
* then IE would still leave the caret inside the editing area.
|
||||
*/
|
||||
if ( CKEDITOR.env.ie )
|
||||
if ( this._.editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
|
||||
{
|
||||
var $selection = editor.document.$.selection,
|
||||
$range = $selection.createRange();
|
||||
@@ -442,6 +442,35 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
|
||||
CKEDITOR.skins.load( editor, 'dialog' );
|
||||
};
|
||||
|
||||
// Focusable interface. Use it via dialog.addFocusable.
|
||||
function Focusable( dialog, element, index ) {
|
||||
this.element = element;
|
||||
this.focusIndex = index;
|
||||
this.isFocusable = function()
|
||||
{
|
||||
return true;
|
||||
};
|
||||
this.focus = function()
|
||||
{
|
||||
dialog._.currentFocusIndex = this.focusIndex;
|
||||
this.element.focus();
|
||||
};
|
||||
// Bind events
|
||||
element.on( 'keydown', function( e )
|
||||
{
|
||||
if ( e.data.getKeystroke() in { 32:1, 13:1 } )
|
||||
this.fire( 'click' );
|
||||
} );
|
||||
element.on( 'focus', function()
|
||||
{
|
||||
this.fire( 'mouseover' );
|
||||
} );
|
||||
element.on( 'blur', function()
|
||||
{
|
||||
this.fire( 'mouseout' );
|
||||
} );
|
||||
}
|
||||
|
||||
CKEDITOR.dialog.prototype =
|
||||
{
|
||||
/**
|
||||
@@ -547,7 +576,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
|
||||
*/
|
||||
show : function()
|
||||
{
|
||||
if ( CKEDITOR.env.ie )
|
||||
if ( this._.editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
|
||||
this._.editor.getSelection().lock();
|
||||
|
||||
// Insert the dialog's element to the root document.
|
||||
@@ -618,7 +647,9 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
|
||||
var viewSize = CKEDITOR.document.getWindow().getViewPaneSize();
|
||||
var dialogSize = this.getSize();
|
||||
|
||||
this.move( ( viewSize.width - dialogSize.width ) / 2, ( viewSize.height - dialogSize.height ) / 2 );
|
||||
// We're using definition size for initial position because of
|
||||
// offten corrupted data in offsetWidth at this point. (#4084)
|
||||
this.move( ( viewSize.width - definition.minWidth ) / 2, ( viewSize.height - dialogSize.height ) / 2 );
|
||||
|
||||
this.parts.dialog.setStyle( 'visibility', '' );
|
||||
|
||||
@@ -722,7 +753,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
|
||||
var editor = this._.editor;
|
||||
editor.focus();
|
||||
|
||||
if ( CKEDITOR.env.ie )
|
||||
if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
|
||||
editor.getSelection().unlock( true );
|
||||
}
|
||||
else
|
||||
@@ -988,6 +1019,26 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
|
||||
getSelectedElement : function()
|
||||
{
|
||||
return this.getParentEditor().getSelection().getSelectedElement();
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds element to dialog's focusable list.
|
||||
*
|
||||
* @param {CKEDITOR.dom.element} element
|
||||
* @param {Number} [index]
|
||||
*/
|
||||
addFocusable: function( element, index ) {
|
||||
if ( typeof index == 'undefined' )
|
||||
{
|
||||
index = this._.focusList.length;
|
||||
this._.focusList.push( new Focusable( this, element, index ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
this._.focusList.splice( index, 0, new Focusable( this, element, index ) );
|
||||
for ( var i = index + 1 ; i < this._.focusList.length ; i++ )
|
||||
this._.focusList[ i ].focusIndex++;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1423,6 +1474,8 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
|
||||
|
||||
dialog.parts.title.on( 'mousedown', function( evt )
|
||||
{
|
||||
dialog._.updateSize = true;
|
||||
|
||||
lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
|
||||
|
||||
CKEDITOR.document.on( 'mousemove', mouseMoveHandler );
|
||||
|
||||
Reference in New Issue
Block a user