Ticket #3104: 3104_4.patch
File 3104_4.patch, 15.1 KB (added by , 16 years ago) |
---|
-
_source/core/config.js
154 154 plugins : 'basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,elementspath,enterkey,entities,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,save,smiley,showblocks,sourcearea,stylescombo,table,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc', 155 155 156 156 /** 157 * The editor tabindex value. 158 * @type Number 159 * @default 0 (zero) 160 * @example 161 * config.tabIndex = 1; 162 */ 163 tabIndex : 0, 164 165 /** 157 166 * The theme to be used to build the UI. 158 167 * @type String 159 168 * @default 'default' -
_source/core/dom/element.js
732 732 }, 733 733 734 734 /** 735 * Checks if this element is visible. May not work if the element is 736 * child of an element with visibility set to "hidden", but works well 737 * on the great majority of cases. 738 * @return {Boolean} True if the element is visible. 739 */ 740 isVisible : function() 741 { 742 return this.$.offsetWidth && ( this.$.style.visibility != 'hidden' ); 743 }, 744 745 /** 735 746 * Indicates that the element has defined attributes. 736 747 * @returns {Boolean} True if the element has attributes. 737 748 * @example … … 883 894 { 884 895 if ( name == 'class' ) 885 896 this.$.className = value; 886 if ( name == 'style' )897 else if ( name == 'style' ) 887 898 this.$.style.cssText = value; 899 else if ( name == 'tabindex' ) // Case sensitive. 900 this.$.tabIndex = value; 888 901 else 889 902 standard.apply( this, arguments ); 890 903 return this; -
_source/core/dom/node.js
308 308 309 309 getPreviousSourceNode : function( startFromSibling, nodeType ) 310 310 { 311 var $ = startFromSibling ? this.$.previousSibling : this.$, 312 node = null; 311 var $ = this.$; 313 312 314 if ( !$ ) 315 return null; 313 var node = ( !startFromSibling && $.lastChild ) ? 314 $.lastChild : 315 $.previousSibling; 316 316 317 if ( ( node = $.previousSibling ) ) 318 { 319 while ( node.lastChild ) 320 node = node.lastChild; 321 } 322 else 323 node = $.parentNode; 317 var parent; 324 318 319 while ( !node && ( parent = ( parent || $ ).parentNode ) ) 320 node = parent.previousSibling; 321 325 322 if ( !node ) 326 323 return null; 327 324 328 325 if ( nodeType && node.nodeType != nodeType ) 329 return arguments.callee. apply( { $ : node }, false, nodeType );326 return arguments.callee.call( { $ : node }, false, nodeType ); 330 327 331 328 return new CKEDITOR.dom.node( node ); 332 329 }, -
_source/plugins/editingblock/plugin.js
98 98 // Do that once only. 99 99 event.removeListener(); 100 100 101 // Grab editor focus if the editor container is focused. (#3104) 102 editor.container.on( 'focus', function() 103 { 104 editor.focus(); 105 }); 106 101 107 // Fire instanceReady for both the editor and CKEDITOR. 102 108 editor.fireOnce( 'instanceReady' ); 103 109 CKEDITOR.fire( 'instanceReady', null, editor ); -
_source/plugins/sourcearea/plugin.js
26 26 { 27 27 // Create the source area <textarea>. 28 28 textarea = new CKEDITOR.dom.element( 'textarea' ); 29 textarea.setAttribute( 'dir', 'ltr' ); 29 textarea.setAttributes( 30 { 31 dir : 'ltr', 32 tabIndex : -1 33 }); 30 34 textarea.addClass( 'cke_source' ); 31 35 textarea.setStyles({ 32 36 width : '100%', … … 35 39 outline : 'none', 36 40 'text-align' : 'left' }); 37 41 38 // Add the tab index for #3098.39 var tabIndex = editor.element && editor.element.getAttribute( 'tabIndex' );40 if ( tabIndex )41 textarea.setAttribute( 'tabIndex', tabIndex );42 43 42 // The textarea height/width='100%' doesn't 44 43 // constraint to the 'td' in IE strick mode 45 44 if ( CKEDITOR.env.ie ) … … 74 73 // Set the <textarea> value. 75 74 this.loadData( data ); 76 75 76 var keystrokeHandler = editor.keystrokeHandler; 77 if ( keystrokeHandler ) 78 keystrokeHandler.attach( textarea ); 79 77 80 editor.mode = 'source'; 78 81 editor.fire( 'mode' ); 79 82 }, -
_source/plugins/tab/plugin.js
5 5 6 6 (function() 7 7 { 8 var blurInternal = function( editor, previous )9 {10 var hasContainer = editor.container;11 12 if ( hasContainer )13 {14 // We need an empty element after the container, so the focus don't go to a container child.15 var tempSpan = new CKEDITOR.dom.element( 'span' );16 tempSpan.setAttribute( 'tabindex', editor.container.getTabIndex() );17 tempSpan.hide();18 19 // Insert the temp element and set the focus.20 if ( previous )21 {22 tempSpan.insertBefore( editor.container );23 tempSpan.focusPrevious();24 }25 else26 {27 tempSpan.insertAfter( editor.container );28 tempSpan.focusNext();29 }30 31 // Remove the temporary node.32 tempSpan.remove();33 }34 35 return hasContainer;36 };37 38 8 var blurCommand = 39 9 { 40 10 exec : function( editor ) 41 11 { 42 return blurInternal( editor);12 editor.container.focusNext( true ); 43 13 } 44 14 }; 45 15 … … 47 17 { 48 18 exec : function( editor ) 49 19 { 50 return blurInternal( editor,true );20 editor.container.focusPrevious( true ); 51 21 } 52 22 }; 53 23 … … 122 92 * var element = CKEDITOR.document.getById( 'example' ); 123 93 * element.focusNext(); 124 94 */ 125 CKEDITOR.dom.element.prototype.focusNext = function( )95 CKEDITOR.dom.element.prototype.focusNext = function( ignoreChildren ) 126 96 { 127 97 var $ = this.$, 128 98 curTabIndex = this.getTabIndex(), 129 passedCurrent = false,130 elected, 131 ele ctedTabIndex;99 passedCurrent, enteredCurrent, 100 elected, electedTabIndex, 101 element, elementTabIndex; 132 102 133 var all = document.body.all || document.body.getElementsByTagName( '*' );134 135 103 if ( curTabIndex <= 0 ) 136 104 { 137 for ( var i = 0, element ; element = all[ i ] ; i++ ) 138 { 139 if ( !passedCurrent ) 140 { 141 if ( element == $ ) 142 passedCurrent = true; 143 continue; 144 } 105 // If this element has tabindex <= 0 then we must simply look for any 106 // element following it containing tabindex=0. 145 107 146 element = new CKEDITOR.dom.element( element);108 var element = this.getNextSourceNode( ignoreChildren, CKEDITOR.NODE_ELEMENT ); 147 109 148 if ( element.getComputedStyle( 'display' ) == 'none' || element.getComputedStyle( 'visibility' ) == 'hidden' ) 149 continue; 150 151 if ( element.getTabIndex() === 0 ) 110 while( element ) 111 { 112 if ( element.isVisible() && element.getTabIndex() === 0 ) 152 113 { 153 114 elected = element; 154 115 break; 155 116 } 117 118 element = element.getNextSourceNode( false, CKEDITOR.NODE_ELEMENT ); 156 119 } 157 120 } 158 121 else 159 122 { 160 for ( i = 0, element ; element = all[ i ] ; i++ ) 123 // If this element has tabindex > 0 then we must look for: 124 // 1. An element following this element with the same tabindex. 125 // 2. The first element in source other with the lowest tabindex 126 // that is higher than this element tabindex. 127 // 3. The first element with tabindex=0. 128 129 var element = this.getDocument().getBody().getFirst(); 130 131 while( ( element = element.getNextSourceNode( false, CKEDITOR.NODE_ELEMENT ) ) ) 161 132 { 162 if ( !passedCurrent && element == $)133 if ( !passedCurrent ) 163 134 { 164 passedCurrent = true; 165 continue; 135 if ( !enteredCurrent && element.equals( this ) ) 136 { 137 enteredCurrent = true; 138 139 // Ignore this element, if required. 140 if ( ignoreChildren ) 141 { 142 if ( !( element = element.getNextSourceNode( true, CKEDITOR.NODE_ELEMENT ) ) ) 143 break; 144 passedCurrent = 1; 145 } 146 } 147 else if ( enteredCurrent && !this.contains( element ) ) 148 passedCurrent = 1; 166 149 } 167 150 168 element = new CKEDITOR.dom.element( element ); 169 170 if ( element.getComputedStyle( 'display' ) == 'none' || element.getComputedStyle( 'visibility' ) == 'hidden' ) 151 if ( !element.isVisible() || ( elementTabIndex = element.getTabIndex() ) < 0 ) 171 152 continue; 172 153 173 var elementTabIndex = element.getTabIndex();174 175 154 if ( passedCurrent && elementTabIndex == curTabIndex ) 176 155 { 177 156 elected = element; 178 157 break; 179 158 } 180 else if ( elementTabIndex > curTabIndex && ( !elected || electedTabIndex > elementTabIndex || electedTabIndex === 0 ) ) 159 160 if ( elementTabIndex > curTabIndex && ( !elected || !electedTabIndex || elementTabIndex < electedTabIndex ) ) 181 161 { 182 162 elected = element; 183 163 electedTabIndex = elementTabIndex; … … 200 180 * var element = CKEDITOR.document.getById( 'example' ); 201 181 * element.focusPrevious(); 202 182 */ 203 CKEDITOR.dom.element.prototype.focusPrevious = function( )183 CKEDITOR.dom.element.prototype.focusPrevious = function( ignoreChildren ) 204 184 { 205 185 var $ = this.$, 206 186 curTabIndex = this.getTabIndex(), 207 passedCurrent = false,187 passedCurrent, enteredCurrent, 208 188 elected, 209 electedTabIndex; 189 electedTabIndex = 0, 190 elementTabIndex; 210 191 211 var all = document.body.all || document.body.getElementsByTagName( '*');192 var element = this.getDocument().getBody().getLast(); 212 193 213 if ( curTabIndex <= 0)194 while( ( element = element.getPreviousSourceNode( false, CKEDITOR.NODE_ELEMENT ) ) ) 214 195 { 215 for ( var i = 0, element ; element = all[ i ] ; i++)196 if ( !passedCurrent ) 216 197 { 217 if ( ! passedCurrent && element == $)198 if ( !enteredCurrent && element.equals( this ) ) 218 199 { 219 if ( elected && electedTabIndex === 0 ) 220 break; 200 enteredCurrent = true; 221 201 222 passedCurrent = true; 223 continue; 202 // Ignore this element, if required. 203 if ( ignoreChildren ) 204 { 205 if ( !( element = element.getPreviousSourceNode( true, CKEDITOR.NODE_ELEMENT ) ) ) 206 break; 207 passedCurrent = 1; 208 } 224 209 } 210 else if ( enteredCurrent && !this.contains( element ) ) 211 passedCurrent = 1; 212 } 225 213 226 element = new CKEDITOR.dom.element( element ); 214 if ( !element.isVisible() || ( elementTabIndex = element.getTabIndex() ) < 0 ) 215 continue; 227 216 228 if ( element.getComputedStyle( 'display' ) == 'none' || element.getComputedStyle( 'visibility' ) == 'hidden' ) 229 continue; 217 if ( curTabIndex <= 0 ) 218 { 219 // If this element has tabindex <= 0 then we must look for: 220 // 1. An element before this one containing tabindex=0. 221 // 2. The last element with the highest tabindex. 230 222 231 var elementTabIndex = element.getTabIndex(); 223 if ( passedCurrent && elementTabIndex === 0 ) 224 { 225 elected = element; 226 break; 227 } 232 228 233 if ( ( !passedCurrent && elementTabIndex === 0 ) 234 || ( elementTabIndex > 0 && ( !elected || ( electedTabIndex > 0 && electedTabIndex <= elementTabIndex ) ) ) ) 229 if ( elementTabIndex > electedTabIndex ) 235 230 { 236 231 elected = element; 237 232 electedTabIndex = elementTabIndex; 238 233 } 239 234 } 240 } 241 else 242 { 243 for ( i = 0, element ; element = all[ i ] ; i++ ) 235 else 244 236 { 245 if ( !passedCurrent && element == $ )246 {247 if ( elected && electedTabIndex == curTabIndex )248 break;237 // If this element has tabindex > 0 we must look for: 238 // 1. An element preceeding this one, with the same tabindex. 239 // 2. The last element in source other with the highest tabindex 240 // that is lower than this element tabindex. 249 241 250 passedCurrent = true; 251 continue; 242 if ( passedCurrent && elementTabIndex == curTabIndex ) 243 { 244 elected = element; 245 break; 252 246 } 253 247 254 element = new CKEDITOR.dom.element( element ); 255 256 elementTabIndex = element.getTabIndex(); 257 258 if ( elementTabIndex > 0 ) 248 if ( elementTabIndex < curTabIndex && ( !elected || elementTabIndex > electedTabIndex ) ) 259 249 { 260 if ( ( !passedCurrent && elementTabIndex == curTabIndex ) 261 || ( elementTabIndex < curTabIndex && ( !elected || electedTabIndex <= elementTabIndex ) ) ) 262 { 263 elected = element; 264 electedTabIndex = elementTabIndex; 265 } 250 elected = element; 251 electedTabIndex = elementTabIndex; 266 252 } 267 253 } 268 254 } -
_source/plugins/wysiwygarea/plugin.js
116 116 iframe = new CKEDITOR.dom.element( 'iframe' ) 117 117 .setAttributes({ 118 118 frameBorder : 0, 119 tabIndex : -1, 119 120 allowTransparency : true }) 120 121 .setStyles({ 121 122 width : '100%', 122 123 height : '100%' }); 123 124 124 var tabIndex = editor.element && editor.element.getAttribute( 'tabIndex' );125 if ( tabIndex )126 iframe.setAttribute( 'tabIndex', tabIndex );127 128 125 if ( CKEDITOR.env.ie ) 129 126 { 130 127 if ( isCustomDomain ) -
_source/themes/default/theme.js
46 46 var height = contentsHtml && editor.config.height; 47 47 var width = editor.config.width; 48 48 49 var tabIndex = editor.config.tabIndex || editor.element.getAttribute( 'tabindex' ) || 0; 50 49 51 // The editor height is considered only if the contents space got filled. 50 52 if ( !contentsHtml ) 51 53 height = 'auto'; … … 65 67 // bring any evident problem as it seems that tables are treated 66 68 // differently by the browsers ("semi-inline"). 67 69 var container = CKEDITOR.dom.element.createFromHtml( [ 68 '<span id="cke_', name, '" onmousedown="return false;" class="', editor.skinClass, 69 '" dir="', editor.lang.dir, '" title="', ( CKEDITOR.env.gecko ? ' ' : '' ), '">' + 70 '<span' + 71 ' id="cke_', name, '"' + 72 ' onmousedown="return false;"' + 73 ' class="', editor.skinClass, '"' + 74 ' dir="', editor.lang.dir, '"' + 75 ' title="', ( CKEDITOR.env.gecko ? ' ' : '' ), '"' + 76 ' tabindex="' + tabIndex + '">' + 70 77 '<span class="' , browserCssClass, ' cke_', editor.lang.dir, '">' + 71 78 '<table class="cke_editor" border="0" cellspacing="0" cellpadding="0" style="width:', width, ';height:', height, '"><tbody>' + 72 79 '<tr', topHtml ? '' : ' style="display:none"', '><td id="cke_top_' , name, '" class="cke_top">' , topHtml , '</td></tr>' +