~canonical-sysadmins/wordpress/4.7.2

« back to all changes in this revision

Viewing changes to wp-includes/js/wplink.js

  • Committer: Barry Price
  • Date: 2016-08-17 04:50:12 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: barry.price@canonical.com-20160817045012-qfui81zhqnqv2ba9
Merge WP4.6 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
( function( $, wpLinkL10n, wp ) {
4
4
        var editor, searchTimer, River, Query, correctedURL, linkNode,
5
 
                emailRegexp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i,
6
 
                urlRegexp = /^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,4}[^ "]*$/i,
 
5
                emailRegexp = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,63}$/i,
 
6
                urlRegexp = /^(https?|ftp):\/\/[A-Z0-9.-]+\.[A-Z]{2,63}[^ "]*$/i,
7
7
                inputs = {},
8
8
                rivers = {},
9
9
                isTouch = ( 'ontouchend' in document );
19
19
                keySensitivity: 100,
20
20
                lastSearch: '',
21
21
                textarea: '',
 
22
                modalOpen: false,
22
23
 
23
24
                init: function() {
24
25
                        inputs.wrap = $('#wp-link-wrap');
97
98
                                $body = $( document.body );
98
99
 
99
100
                        $body.addClass( 'modal-open' );
 
101
                        wpLink.modalOpen = true;
100
102
                        linkNode = node;
101
103
 
102
104
                        wpLink.range = null;
228
230
                                onlyText = this.hasSelectedText( linkNode );
229
231
 
230
232
                        if ( linkNode ) {
231
 
                                linkText = linkNode.innerText || linkNode.textContent;
 
233
                                linkText = linkNode.textContent || linkNode.innerText;
232
234
                                href = editor.dom.getAttrib( linkNode, 'href' );
233
235
 
234
236
                                if ( ! $.trim( linkText ) ) {
274
276
 
275
277
                close: function( reset ) {
276
278
                        $( document.body ).removeClass( 'modal-open' );
 
279
                        wpLink.modalOpen = false;
277
280
 
278
281
                        if ( reset !== 'noReset' ) {
279
282
                                if ( ! wpLink.isMCE() ) {
431
434
                        editor.focus();
432
435
                        editor.nodeChanged();
433
436
 
 
437
                        if ( link && editor.plugins.wplink ) {
 
438
                                editor.plugins.wplink.checkLink( link );
 
439
                        }
 
440
 
434
441
                        // Audible confirmation message when a link has been inserted in the Editor.
435
442
                        wp.a11y.speak( wpLinkL10n.linkInserted );
436
443
                },