wp/wp-includes/js/tinymce/plugins/wplink/plugin.js
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
   224 			}
   224 			}
   225 
   225 
   226 			linkNode = getSelectedLink();
   226 			linkNode = getSelectedLink();
   227 			editToolbar.tempHide = false;
   227 			editToolbar.tempHide = false;
   228 
   228 
   229 			if ( linkNode ) {
   229 			if ( ! linkNode ) {
   230 				editor.dom.setAttribs( linkNode, { 'data-wplink-edit': true } );
       
   231 			} else {
       
   232 				removePlaceholders();
   230 				removePlaceholders();
   233 				editor.execCommand( 'mceInsertLink', false, { href: '_wp_link_placeholder' } );
   231 				editor.execCommand( 'mceInsertLink', false, { href: '_wp_link_placeholder' } );
   234 
   232 
   235 				linkNode = editor.$( 'a[href="_wp_link_placeholder"]' )[0];
   233 				linkNode = editor.$( 'a[href="_wp_link_placeholder"]' )[0];
   236 				editor.nodeChanged();
   234 				editor.nodeChanged();
   237 			}
   235 			}
       
   236 
       
   237 			editor.dom.setAttribs( linkNode, { 'data-wplink-edit': true } );
   238 		} );
   238 		} );
   239 
   239 
   240 		editor.addCommand( 'wp_link_apply', function() {
   240 		editor.addCommand( 'wp_link_apply', function() {
   241 			if ( editToolbar.scrolling ) {
   241 			if ( editToolbar.scrolling ) {
   242 				return;
   242 				return;
   282 				speak( window.wpLinkL10n.linkInserted );
   282 				speak( window.wpLinkL10n.linkInserted );
   283 			}
   283 			}
   284 		} );
   284 		} );
   285 
   285 
   286 		editor.addCommand( 'wp_link_cancel', function() {
   286 		editor.addCommand( 'wp_link_cancel', function() {
       
   287 			inputInstance.reset();
       
   288 
   287 			if ( ! editToolbar.tempHide ) {
   289 			if ( ! editToolbar.tempHide ) {
   288 				inputInstance.reset();
       
   289 				removePlaceholders();
   290 				removePlaceholders();
   290 			}
   291 			}
   291 		} );
   292 		} );
   292 
   293 
   293 		editor.addCommand( 'wp_unlink', function() {
   294 		editor.addCommand( 'wp_unlink', function() {
   581 			onclick: function() {
   582 			onclick: function() {
   582 				if ( typeof window.wpLink !== 'undefined' ) {
   583 				if ( typeof window.wpLink !== 'undefined' ) {
   583 					var url = inputInstance.getURL() || null,
   584 					var url = inputInstance.getURL() || null,
   584 						text = inputInstance.getLinkText() || null;
   585 						text = inputInstance.getLinkText() || null;
   585 
   586 
   586 					/*
   587 					window.wpLink.open( editor.id, url, text );
   587 					 * Accessibility note: moving focus back to the editor confuses
       
   588 					 * screen readers. They will announce again the Editor ARIA role
       
   589 					 * `application` and the iframe `title` attribute.
       
   590 					 *
       
   591 					 * Unfortunately IE looses the selection when the editor iframe
       
   592 					 * looses focus, so without returning focus to the editor, the code
       
   593 					 * in the modal will not be able to get the selection, place the caret
       
   594 					 * at the same location, etc.
       
   595 					 */
       
   596 					if ( tinymce.Env.ie ) {
       
   597 						editor.focus(); // Needed for IE
       
   598 					}
       
   599 
   588 
   600 					editToolbar.tempHide = true;
   589 					editToolbar.tempHide = true;
   601 					window.wpLink.open( editor.id, url, text, linkNode );
   590 					editToolbar.hide();
   602 
       
   603 					inputInstance.reset();
       
   604 				}
   591 				}
   605 			}
   592 			}
   606 		} );
   593 		} );
   607 
   594 
   608 		editor.addButton( 'wp_link_apply', {
   595 		editor.addButton( 'wp_link_apply', {