Ticket #8255: patch_ckeditor_link_dialog.patch
File patch_ckeditor_link_dialog.patch, 4.2 KB (added by , 12 years ago) |
---|
-
link.js
old new 1 /*1 /* 2 2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. 3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ … … 44 44 var linkTypeChanged = function() 45 45 { 46 46 var dialog = this.getDialog(), 47 partIds = [ 'urlOptions', 'anchorOptions', 'emailOptions' ],47 partIds = [ 'urlOptions', 'anchorOptions', 'emailOptions', 'urlListOptions' ], 48 48 typeValue = this.getValue(), 49 49 uploadTab = dialog.definition.getContents( 'upload' ), 50 50 uploadInitiallyHidden = uploadTab && uploadTab.hidden; … … 86 86 emailBodyRegex = /body=([^;?:@&=$,\/]*)/, 87 87 anchorRegex = /^#(.*)$/, 88 88 urlRegex = /^((?:http|https|ftp|news):\/\/)?(.*)$/, 89 urlListRegex = /^\/.+/, 89 90 selectableTargets = /^(_(?:self|top|parent|blank))$/, 90 91 encodedEmailLinkRegex = /^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/, 91 92 functionCallProtectedEmailLinkRegex = /^javascript:([^(]+)\(([^)]+)\)$/; … … 101 102 emailMatch, 102 103 anchorMatch, 103 104 urlMatch, 105 urlListMatch, 104 106 retval = {}; 105 107 106 108 if ( ( javascriptMatch = href.match( javascriptProtocolRegex ) ) ) … … 146 148 147 149 if ( !retval.type ) 148 150 { 149 if ( ( anchorMatch = href.match( anchorRegex ) ) ) 151 152 if ( href && ( urlListMatch = href.match( urlListRegex ) ) ) 153 { 154 var blnFound = false; 155 var strAddress = urlListMatch[0]; 156 for(i=0;i<editor.config.urlList.length;i++){ 157 if(editor.config.urlList[i][1] == strAddress) blnFound = true; 158 } 159 if(blnFound){ 160 retval.type = 'urlList'; 161 } 162 else { 163 retval.type = 'url'; 164 } 165 retval.url = {}; 166 retval.url.protocol = ""; 167 retval.url.url = strAddress; 168 } 169 else if ( ( anchorMatch = href.match( anchorRegex ) ) ) 150 170 { 151 171 retval.type = 'anchor'; 152 172 retval.anchor = {}; … … 412 432 [ 413 433 [ linkLang.toUrl, 'url' ], 414 434 [ linkLang.toAnchor, 'anchor' ], 415 [ linkLang.toEmail, 'email' ] 435 [ linkLang.toEmail, 'email' ], 436 [ 'Url list', 'urlList'] 416 437 ], 417 438 onChange : linkTypeChanged, 418 439 setup : function( data ) … … 752 773 if ( !this.getDialog().getContentElement( 'info', 'linkType' ) ) 753 774 this.getElement().hide(); 754 775 } 776 }, 777 { 778 type : 'vbox', 779 id : 'urlListOptions', 780 padding : 1, 781 children : 782 [ 783 { 784 id : 'urlListAddress', 785 type : 'select', 786 label : 'Page', 787 'default' : '/', 788 style : 'width : 100%;', 789 items : editor.config.urlList, 790 setup : function( data ) { 791 if ( data.url ) this.setValue( data.url.url ); 792 }, 793 commit : function( data ) { 794 795 if ( !data.urlList ) 796 data.urlList = {}; 797 798 data.urlList.url = this.getValue(); 799 800 } 801 } 802 ], 803 setup : function( data ) 804 { 805 if ( !this.getDialog().getContentElement( 'info', 'linkType' ) ) this.getElement().hide(); 806 } 755 807 } 808 756 809 ] 757 810 }, 758 811 { … … 1206 1259 id = ( data.anchor && data.anchor.id ); 1207 1260 attributes[ 'data-cke-saved-href' ] = '#' + ( name || id || '' ); 1208 1261 break; 1262 case 'urlList': 1263 var urlList = ( data.urlList && data.urlList.url ) || ''; 1264 attributes[ 'data-cke-saved-href' ] = urlList; 1265 break; 1209 1266 case 'email': 1210 1267 1211 1268 var linkHref,