Changeset 40598
- Timestamp:
- 05/10/2017 02:46:24 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/quicktags.js
r37661 r40598 224 224 if ( tb.addEventListener ) { 225 225 tb.addEventListener( 'click', onclick, false ); 226 226 227 227 if ( wrap ) { 228 228 wrap.addEventListener( 'click', setActiveEditor, false ); … … 244 244 }; 245 245 246 t.init = function() { 247 _domReady( function(){ qt._buttonsInit( id ); } ); 248 }; 249 250 t.remove = function() { 251 delete qt.instances[id]; 252 253 if ( tb && tb.parentNode ) { 254 tb.parentNode.removeChild( tb ); 255 } 256 }; 257 246 258 qt.instances[id] = t; 247 248 if ( ! qt.instances['0'] ) { 249 qt.instances['0'] = qt.instances[id]; 250 _domReady( function(){ qt._buttonsInit(); } ); 251 } 259 t.init(); 252 260 }; 253 261 … … 264 272 }; 265 273 266 qt._buttonsInit = function() { 267 var t = this, canvas, name, settings, theButtons, html, inst, ed, id, i, use, 268 defaults = ',strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,'; 269 270 for ( inst in t.instances ) { 271 if ( '0' === inst ) { 272 continue; 273 } 274 275 ed = t.instances[inst]; 274 qt._buttonsInit = function( id ) { 275 var t = this; 276 277 function _init( instanceId ) { 278 var canvas, name, settings, theButtons, html, ed, id, i, use, 279 defaults = ',strong,em,link,block,del,ins,img,ul,ol,li,code,more,close,'; 280 281 ed = t.instances[instanceId]; 276 282 canvas = ed.canvas; 277 283 name = ed.name; … … 287 293 288 294 for ( i in edButtons ) { 289 if ( ! edButtons[i] ) {295 if ( ! edButtons[i] ) { 290 296 continue; 291 297 } … … 296 302 } 297 303 298 if ( ! edButtons[i].instance || edButtons[i].instance === inst) {304 if ( ! edButtons[i].instance || edButtons[i].instance === instanceId ) { 299 305 theButtons[id] = edButtons[i]; 300 306 301 307 if ( edButtons[i].html ) { 302 html += edButtons[i].html( name + '_');308 html += edButtons[i].html( name + '_' ); 303 309 } 304 310 } … … 310 316 } 311 317 312 if ( 'rtl' === document.getElementsByTagName( 'html')[0].dir ) {318 if ( 'rtl' === document.getElementsByTagName( 'html' )[0].dir ) { 313 319 theButtons.textdirection = new qt.TextDirectionButton(); 314 html += theButtons.textdirection.html( name + '_');320 html += theButtons.textdirection.html( name + '_' ); 315 321 } 316 322 … … 322 328 } 323 329 } 330 331 if ( id ) { 332 _init( id ); 333 } else { 334 for ( id in t.instances ) { 335 _init( id ); 336 } 337 } 338 324 339 t.buttonsInitDone = true; 325 340 }; … … 607 622 qt.CloseButton.prototype.callback = qt._close; 608 623 609 qt.closeAllTags = function(editor_id) { 610 var ed = this.getInstance(editor_id); 611 qt._close('', ed.canvas, ed); 624 qt.closeAllTags = function( editor_id ) { 625 var ed = this.getInstance( editor_id ); 626 627 if ( ed ) { 628 qt._close( '', ed.canvas, ed ); 629 } 612 630 }; 613 631
Note: See TracChangeset
for help on using the changeset viewer.