/*\r
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
\r
init : function( editor )\r
{\r
- var sourcearea = CKEDITOR.plugins.sourcearea;\r
+ var sourcearea = CKEDITOR.plugins.sourcearea,\r
+ win = CKEDITOR.document.getWindow();\r
\r
editor.on( 'editingBlockReady', function()\r
{\r
textarea.setAttributes(\r
{\r
dir : 'ltr',\r
- tabIndex : -1\r
+ tabIndex : CKEDITOR.env.webkit ? -1 : editor.tabIndex,\r
+ 'role' : 'textbox',\r
+ 'aria-label' : editor.lang.editorTitle.replace( '%1', editor.name )\r
});\r
textarea.addClass( 'cke_source' );\r
textarea.addClass( 'cke_enable_context_menu' );\r
'text-align' : 'left'\r
};\r
\r
- // The textarea height/width='100%' doesn't\r
- // constraint to the 'td' in IE strick mode\r
+ // Having to make <textarea> fixed sized to conque the following bugs:\r
+ // 1. The textarea height/width='100%' doesn't constraint to the 'td' in IE6/7.\r
+ // 2. Unexpected vertical-scrolling behavior happens whenever focus is moving out of editor\r
+ // if text content within it has overflowed. (#4762)\r
if ( CKEDITOR.env.ie )\r
{\r
- if ( !CKEDITOR.env.ie8Compat )\r
+ onResize = function()\r
{\r
- onResize = function()\r
- {\r
- // Holder rectange size is stretched by textarea,\r
- // so hide it just for a moment.\r
- textarea.hide();\r
- textarea.setStyle( 'height', holderElement.$.clientHeight + 'px' );\r
- // When we have proper holder size, show textarea again.\r
- textarea.show();\r
- };\r
- editor.on( 'resize', onResize );\r
- editor.on( 'afterCommandExec', function( event )\r
- {\r
- if ( event.data.name == 'toolbarCollapse' )\r
- onResize();\r
- });\r
- styles.height = holderElement.$.clientHeight + 'px';\r
- }\r
- }\r
- else\r
- {\r
- // By some yet unknown reason, we must stop the\r
- // mousedown propagation for the textarea,\r
- // otherwise it's not possible to place the caret\r
- // inside of it (non IE).\r
- textarea.on( 'mousedown', function( evt )\r
- {\r
- evt.data.stopPropagation();\r
- } );\r
+ // Holder rectange size is stretched by textarea,\r
+ // so hide it just for a moment.\r
+ textarea.hide();\r
+ textarea.setStyle( 'height', holderElement.$.clientHeight + 'px' );\r
+ textarea.setStyle( 'width', holderElement.$.clientWidth + 'px' );\r
+ // When we have proper holder size, show textarea again.\r
+ textarea.show();\r
+ };\r
+\r
+ editor.on( 'resize', onResize );\r
+ win.on( 'resize', onResize );\r
+ setTimeout( onResize, 0 );\r
}\r
\r
// Reset the holder element and append the\r
holderElement.append( textarea );\r
textarea.setStyles( styles );\r
\r
+ editor.fire( 'ariaWidget', textarea );\r
+\r
textarea.on( 'blur', function()\r
{\r
editor.focusManager.blur();\r
\r
unload : function( holderElement )\r
{\r
+ textarea.clearCustomData();\r
editor.textarea = textarea = null;\r
\r
if ( onResize )\r
+ {\r
editor.removeListener( 'resize', onResize );\r
+ win.removeListener( 'resize', onResize );\r
+ }\r
\r
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 )\r
holderElement.removeStyle( 'position' );\r
source :\r
{\r
modes : { wysiwyg:1, source:1 },\r
+ editorFocus : false,\r
\r
exec : function( editor )\r
{\r