/*\r
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
CKEDITOR.themes.add( 'default', (function()\r
{\r
+ function checkSharedSpace( editor, spaceName )\r
+ {\r
+ var container,\r
+ element;\r
+\r
+ // Try to retrieve the target element from the sharedSpaces settings.\r
+ element = editor.config.sharedSpaces;\r
+ element = element && element[ spaceName ];\r
+ element = element && CKEDITOR.document.getById( element );\r
+\r
+ // If the element is available, we'll then create the container for\r
+ // the space.\r
+ if ( element )\r
+ {\r
+ // Creates an HTML structure that reproduces the editor class hierarchy.\r
+ var html =\r
+ '<span class="cke_shared">' +\r
+ '<span class="' + editor.skinClass + ' cke_editor_' + editor.name + '">' +\r
+ '<span class="' + CKEDITOR.env.cssClass + '">' +\r
+ '<span class="cke_wrapper cke_' + editor.lang.dir + '">' +\r
+ '<span class="cke_editor">' +\r
+ '<div class="cke_' + spaceName + '">' +\r
+ '</div></span></span></span></span></span>';\r
+\r
+ var mainContainer = element.append( CKEDITOR.dom.element.createFromHtml( html, element.getDocument() ) );\r
+\r
+ // Only the first container starts visible. Others get hidden.\r
+ if ( element.getCustomData( 'cke_hasshared' ) )\r
+ mainContainer.hide();\r
+ else\r
+ element.setCustomData( 'cke_hasshared', 1 );\r
+\r
+ // Get the deeper inner <div>.\r
+ container = mainContainer.getChild( [0,0,0,0] );\r
+\r
+ // When the editor gets focus, we show the space container, hiding others.\r
+ editor.on( 'focus', function()\r
+ {\r
+ for ( var i = 0, sibling, children = element.getChildren() ; ( sibling = children.getItem( i ) ) ; i++ )\r
+ {\r
+ if ( sibling.type == CKEDITOR.NODE_ELEMENT\r
+ && !sibling.equals( mainContainer )\r
+ && sibling.hasClass( 'cke_shared' ) )\r
+ {\r
+ sibling.hide();\r
+ }\r
+ }\r
+\r
+ mainContainer.show();\r
+ });\r
+\r
+ editor.on( 'destroy', function()\r
+ {\r
+ mainContainer.remove();\r
+ });\r
+ }\r
+\r
+ return container;\r
+ }\r
+\r
return {\r
build : function( editor, themePath )\r
{\r
style += "width: " + width + ";";\r
}\r
\r
+ var sharedTop = topHtml && checkSharedSpace( editor, 'top' ),\r
+ sharedBottoms = checkSharedSpace( editor, 'bottom' );\r
+\r
+ sharedTop && ( sharedTop.setHtml( topHtml ) , topHtml = '' );\r
+ sharedBottoms && ( sharedBottoms.setHtml( bottomHtml ), bottomHtml = '' );\r
+\r
var container = CKEDITOR.dom.element.createFromHtml( [\r
'<span' +\r
' id="cke_', name, '"' +\r
' onmousedown="return false;"' +\r
- ' class="', editor.skinClass, '"' +\r
+ ' class="', editor.skinClass, ' cke_editor_', name, '"' +\r
' dir="', editor.lang.dir, '"' +\r
' title="', ( CKEDITOR.env.gecko ? ' ' : '' ), '"' +\r
' lang="', editor.langCode, '"' +\r
- ' tabindex="' + tabIndex + '"' +\r
+ ' role="application"' +\r
+ ' aria-labelledby="cke_', name, '_arialbl"' +\r
( style ? ' style="' + style + '"' : '' ) +\r
'>' +\r
- '<span class="' , CKEDITOR.env.cssClass, '">' +\r
- '<span class="cke_wrapper cke_', editor.lang.dir, '">' +\r
- '<table class="cke_editor" border="0" cellspacing="0" cellpadding="0"><tbody>' +\r
- '<tr', topHtml ? '' : ' style="display:none"', '><td id="cke_top_' , name, '" class="cke_top">' , topHtml , '</td></tr>' +\r
- '<tr', contentsHtml ? '' : ' style="display:none"', '><td id="cke_contents_', name, '" class="cke_contents" style="height:', height, '">', contentsHtml, '</td></tr>' +\r
- '<tr', bottomHtml ? '' : ' style="display:none"', '><td id="cke_bottom_' , name, '" class="cke_bottom">' , bottomHtml , '</td></tr>' +\r
+ '<span id="cke_', name, '_arialbl" class="cke_voice_label">' + editor.lang.editor + '</span>' +\r
+ '<span class="' , CKEDITOR.env.cssClass, '" role="presentation">' +\r
+ '<span class="cke_wrapper cke_', editor.lang.dir, '" role="presentation">' +\r
+ '<table class="cke_editor" border="0" cellspacing="0" cellpadding="0" role="presentation"><tbody>' +\r
+ '<tr', topHtml ? '' : ' style="display:none"', '><td id="cke_top_' , name, '" class="cke_top" role="presentation">' , topHtml , '</td></tr>' +\r
+ '<tr', contentsHtml ? '' : ' style="display:none"', '><td id="cke_contents_', name, '" class="cke_contents" style="height:', height, '" role="presentation">', contentsHtml, '</td></tr>' +\r
+ '<tr', bottomHtml ? '' : ' style="display:none"', '><td id="cke_bottom_' , name, '" class="cke_bottom" role="presentation">' , bottomHtml , '</td></tr>' +\r
'</tbody></table>' +\r
//Hide the container when loading skins, later restored by skin css.\r
'<style>.', editor.skinClass, '{visibility:hidden;}</style>' +\r
'</span>' +\r
'</span>' ].join( '' ) );\r
\r
- container.getChild( [0, 0, 0, 0, 0] ).unselectable();\r
- container.getChild( [0, 0, 0, 0, 2] ).unselectable();\r
+ container.getChild( [1, 0, 0, 0, 0] ).unselectable();\r
+ container.getChild( [1, 0, 0, 0, 2] ).unselectable();\r
\r
if ( elementMode == CKEDITOR.ELEMENT_MODE_REPLACE )\r
container.insertAfter( element );\r
var baseIdNumber = CKEDITOR.tools.getNextNumber();\r
\r
var element = CKEDITOR.dom.element.createFromHtml( [\r
- '<div id="cke_' + editor.name.replace('.', '\\.') + '_dialog" class="cke_skin_', editor.skinName,\r
+ '<div class="cke_editor_' + editor.name.replace('.', '\\.') + '_dialog cke_skin_', editor.skinName,\r
'" dir="', editor.lang.dir, '"' +\r
' lang="', editor.langCode, '"' +\r
+ ' role="dialog"' +\r
+ ' aria-labelledby="%title#"' +\r
'>' +\r
'<table class="cke_dialog', ' ' + CKEDITOR.env.cssClass,\r
- ' cke_', editor.lang.dir, '" style="position:absolute">' +\r
- '<tr><td>' +\r
- '<div class="%body">' +\r
- '<div id="%title#" class="%title"></div>' +\r
- '<div id="%close_button#" class="%close_button">' +\r
- '<span>X</span>' +\r
- '</div>' +\r
- '<div id="%tabs#" class="%tabs"></div>' +\r
- '<table class="%contents"><tr>' +\r
- '<td id="%contents#" class="%contents"></td>' +\r
- '</tr></table>' +\r
- '<div id="%footer#" class="%footer"></div>' +\r
+ ' cke_', editor.lang.dir, '" style="position:absolute" role="presentation">' +\r
+ '<tr><td role="presentation">' +\r
+ '<div class="%body" role="presentation">' +\r
+ '<div id="%title#" class="%title" role="presentation"></div>' +\r
+ '<a id="%close_button#" class="%close_button" href="javascript:void(0)" title="' + editor.lang.common.close+'" role="button"><span class="cke_label">X</span></a>' +\r
+ '<div id="%tabs#" class="%tabs" role="tablist"></div>' +\r
+ '<table class="%contents" role="presentation"><tr>' +\r
+ '<td id="%contents#" class="%contents" role="presentation"></td>' +\r
+ '</tr></table>' +\r
+ '<div id="%footer#" class="%footer" role="presentation"></div>' +\r
'</div>' +\r
'<div id="%tl#" class="%tl"></div>' +\r
'<div id="%tc#" class="%tc"></div>' +\r
if ( numberRegex.test( width ) )\r
width += 'px';\r
\r
- var contents = CKEDITOR.document.getById( 'cke_contents_' + this.name );\r
- var outer = resizeInner ? contents.getAscendant( 'table' ).getParent()\r
- : contents.getAscendant( 'table' ).getParent().getParent().getParent();\r
+ var container = this.container,\r
+ contents = CKEDITOR.document.getById( 'cke_contents_' + this.name ),\r
+ outer = resizeInner ? container.getChild( 1 ) : container;\r
\r
// Resize the width first.\r
// WEBKIT BUG: Webkit requires that we put the editor off from display when we\r
\r
CKEDITOR.editor.prototype.getResizable = function()\r
{\r
- return this.container.getChild( [ 0, 0 ] );\r
+ return this.container.getChild( 1 );\r
};\r
+\r
+/**\r
+ * Makes it possible to place some of the editor UI blocks, like the toolbar\r
+ * and the elements path, into any element in the page.\r
+ * The elements used to hold the UI blocks can be shared among several editor\r
+ * instances. In that case, only the blocks of the active editor instance will\r
+ * display.\r
+ * @name CKEDITOR.config.sharedSpaces\r
+ * @type Object\r
+ * @default undefined\r
+ * @example\r
+ * // Place the toolbar inside the element with ID "someElementId" and the\r
+ * // elements path into the element with ID "anotherId".\r
+ * config.sharedSpaces =\r
+ * {\r
+ * top : 'someElementId',\r
+ * bottom : 'anotherId'\r
+ * };\r
+ * @example\r
+ * // Place the toolbar inside the element with ID "someElementId". The\r
+ * // elements path will remain attached to the editor UI.\r
+ * config.sharedSpaces =\r
+ * {\r
+ * top : 'someElementId'\r
+ * };\r
+ */\r