Ticket #15544: 15544.3.diff
File 15544.3.diff, 35.6 KB (added by , 14 years ago) |
---|
-
wp-includes/js/tinymce/plugins/wplink/editor_plugin.js
1 (function(){tinymce.create("tinymce.plugins.wpLink",{init:function(a,b){ a.addCommand("WP_Link",function(){a.windowManager.open({id:"wp-link",width:480,height:"auto",wpDialog:true,title:a.getLang("advlink.link_desc")},{plugin_url:b})});a.addButton("link",{title:a.getLang("advanced.link_desc"),cmd:"WP_Link"});a.addShortcut("alt+shift+a",a.getLang("advanced.link_desc"),"WP_Link");a.onNodeChange.add(function(d,c,e){c.setActive("wplink",e.nodeName=="A")})},getInfo:function(){return{longname:"WordPress Link Dialog",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wplink",tinymce.plugins.wpLink)})();2 No newline at end of file 1 (function(){tinymce.create("tinymce.plugins.wpLink",{init:function(a,b){var c=true;a.addCommand("WP_Link",function(){if(c){return}a.windowManager.open({id:"wp-link",width:480,height:"auto",wpDialog:true,title:a.getLang("advlink.link_desc")},{plugin_url:b})});a.addButton("link",{title:a.getLang("advanced.link_desc"),cmd:"WP_Link"});a.addShortcut("alt+shift+a",a.getLang("advanced.link_desc"),"WP_Link");a.onNodeChange.add(function(e,d,g,f){c=f&&g.nodeName!="A"})},getInfo:function(){return{longname:"WordPress Link Dialog",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wplink",tinymce.plugins.wpLink)})(); 2 No newline at end of file -
wp-includes/js/tinymce/plugins/wplink/css/wplink.dev.css
46 46 background: #fff; 47 47 height: 185px; 48 48 overflow: auto; 49 position: relative; 49 50 } 50 51 #wp-link li, 51 52 #wp-link .query-notice { … … 104 105 #wp-link-update { 105 106 line-height: 23px; 106 107 float: right; 107 }108 #wp-link-update a {109 display: inline-block;110 108 } 111 No newline at end of file -
wp-includes/js/tinymce/plugins/wplink/css/wplink.css
1 #wp-link p.howto{margin:3px;}#link-options{padding:10px 0 14px;border-bottom:1px solid #dfdfdf;margin:0 6px 14px;}#wp-link label input[type="text"]{width:360px;margin-top:5px;}#wp-link label span{display:inline-block;width:80px;text-align:right;padding-right:5px;}#wp-link .link-search-wrapper{margin:5px 5px 9px;display:block;overflow:hidden;}#wp-link .link-search-wrapper span{float:left;margin-top:6px;}#wp-link .link-search-wrapper input[type="text"]{float:left;width:220px;}#wp-link .link-search-wrapper img.waiting{margin:8px 1px 0 4px;float:left;display:none;}#wp-link .link-target{width:auto;padding:3px 0 0;margin:0 0 0 87px;font-size:11px;}#wp-link .query-results{border:1px #dfdfdf solid;margin:0 5px 5px;background:#fff;height:185px;overflow:auto; }#wp-link li,#wp-link .query-notice{margin-bottom:0;border-bottom:1px solid #f1f1f1;color:#333;padding:4px 6px;cursor:pointer;}#wp-link li:hover{background:#eaf2fa;color:#151515;}#wp-link li.unselectable{border-bottom:1px solid #dfdfdf;}#wp-link li.unselectable:hover{background:#fff;cursor:auto;color:#333;}#wp-link li.selected{background:#ddd;color:#333;}#wp-link li.selected .item-title{font-weight:bold;}#wp-link .item-info{text-transform:uppercase;color:#666;font-size:11px;float:right;}#search-results{display:none;}#wp-link .river-waiting{display:none;padding:10px 0;}#wp-link .river-waiting img.waiting{margin:0 auto;display:block;}#wp-link .submitbox{padding:5px 10px;font-size:11px;overflow:auto;height:29px;}#wp-link-cancel{line-height:25px;float:left;}#wp-link-update{line-height:23px;float:right;}#wp-link-update a{display:inline-block;}2 No newline at end of file 1 #wp-link p.howto{margin:3px;}#link-options{padding:10px 0 14px;border-bottom:1px solid #dfdfdf;margin:0 6px 14px;}#wp-link label input[type="text"]{width:360px;margin-top:5px;}#wp-link label span{display:inline-block;width:80px;text-align:right;padding-right:5px;}#wp-link .link-search-wrapper{margin:5px 5px 9px;display:block;overflow:hidden;}#wp-link .link-search-wrapper span{float:left;margin-top:6px;}#wp-link .link-search-wrapper input[type="text"]{float:left;width:220px;}#wp-link .link-search-wrapper img.waiting{margin:8px 1px 0 4px;float:left;display:none;}#wp-link .link-target{width:auto;padding:3px 0 0;margin:0 0 0 87px;font-size:11px;}#wp-link .query-results{border:1px #dfdfdf solid;margin:0 5px 5px;background:#fff;height:185px;overflow:auto;position:relative;}#wp-link li,#wp-link .query-notice{margin-bottom:0;border-bottom:1px solid #f1f1f1;color:#333;padding:4px 6px;cursor:pointer;}#wp-link li:hover{background:#eaf2fa;color:#151515;}#wp-link li.unselectable{border-bottom:1px solid #dfdfdf;}#wp-link li.unselectable:hover{background:#fff;cursor:auto;color:#333;}#wp-link li.selected{background:#ddd;color:#333;}#wp-link li.selected .item-title{font-weight:bold;}#wp-link .item-info{text-transform:uppercase;color:#666;font-size:11px;float:right;}#search-results{display:none;}#wp-link .river-waiting{display:none;padding:10px 0;}#wp-link .river-waiting img.waiting{margin:0 auto;display:block;}#wp-link .submitbox{padding:5px 10px;font-size:11px;overflow:auto;height:29px;}#wp-link-cancel{line-height:25px;float:left;}#wp-link-update{line-height:23px;float:right;} 2 No newline at end of file -
wp-includes/js/tinymce/plugins/wplink/js/wplink.js
1 var wpLink;(function(f){var b={},e={},d,a,c;wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5, lastSearch:"",init:function(){b.dialog=f("#wp-link");b.update=f("#wp-link-update a");b.url=f("#url-field");b.title=f("#link-title-field");b.openInNewTab=f("#link-target-checkbox");b.search=f("#search-field");e.search=new a(f("#search-results"));e.recent=new a(f("#most-recent-results"));e.elements=f(".query-results",b.dialog);b.update.click(wpLink.update);f("#wp-link-cancel").click(function(){tinyMCEPopup.close()});e.elements.delegate("li","click",wpLink.selectInternalLink);b.search.keyup(wpLink.searchInternalLinks);b.dialog.bind("dialogopen",wpLink.refresh)},refresh:function(){var g;d=tinyMCEPopup.editor;e.elements.find(".selected").removeClass("selected");tinyMCEPopup.restoreSelection();if(g=d.dom.getParent(d.selection.getNode(),"A")){b.url.val(g.href);b.title.val(d.dom.getAttrib(g,"title"));if("_blank"==d.dom.getAttrib(g,"target")){b.openInNewTab.attr("checked","checked")}b.update.text(wpLinkL10n.update)}else{b.url.val("http://");b.title.val("");b.update.text(wpLinkL10n.save)}tinyMCEPopup.storeSelection();b.url.focus();if(!e.recent.ul.children().length){e.recent.ajax()}},update:function(){var k,h=tinyMCEPopup.editor,i={href:b.url.val(),title:b.title.val(),target:b.openInNewTab.attr("checked")?"_blank":""},l,g,j=i.title?i.title:i.href;tinyMCEPopup.restoreSelection();l=h.dom.getParent(h.selection.getNode(),"A");if(!i.href||i.href=="http://"){if(h.selection.isCollapsed()){tinyMCEPopup.close();return}else{if(l){tinyMCEPopup.execCommand("mceBeginUndoLevel");g=h.selection.getBookmark();h.dom.remove(l,1);h.selection.moveToBookmark(g);tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close();return}}}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(l==null){h.getDoc().execCommand("unlink",false,null);if(h.selection.isCollapsed()){k=h.dom.create("a",{href:"#mce_temp_url#"},j);h.selection.setNode(k)}else{tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1})}tinymce.each(h.dom.select("a"),function(m){if(h.dom.getAttrib(m,"href")=="#mce_temp_url#"){l=m;h.dom.setAttribs(l,i)}})}else{h.dom.setAttribs(l,i)}children=f(l).children();if(l.childNodes.length!=1||l.firstChild.nodeName!="IMG"){h.focus();h.selection.select(l);h.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()},selectInternalLink:function(){var g=f(this);if(g.hasClass("unselectable")){return}g.siblings(".selected").removeClass("selected");g.addClass("selected");b.url.val(g.children(".item-permalink").val());b.title.val(g.children(".item-title").text())},searchInternalLinks:function(){var h=f(this),i,g=h.val();if(g.length>2){e.recent.element.hide();e.search.element.show();if(wpLink.lastSearch==g){return}wpLink.lastSearch=g;i=h.siblings("img.waiting").show();e.search.change(g);e.search.ajax(function(){i.hide()})}else{e.search.element.hide();e.recent.element.show()}},delayedCallback:function(i,g){var l,k,j,h;if(!g){return i}setTimeout(function(){if(k){return i.apply(h,j)}l=true},g);return function(){if(l){return i.apply(this,arguments)}j=arguments;h=this;k=true}}};a=function(i,h){var g=this;this.element=i;this.ul=i.children("ul");this.waiting=i.find(".river-waiting");this.change(h);i.scroll(function(){g.maybeLoad()})};f.extend(a.prototype,{ajax:function(j){var h=this,i=this.query.page==1?0:wpLink.minRiverAJAXDuration,g=wpLink.delayedCallback(function(k,l){h.process(k,l);if(j){j(k,l)}},i);this.query.ajax(g)},change:function(g){if(this.query&&this._search==g){return}this._search=g;this.query=new c(g);this.element.scrollTop(0)},process:function(g,k){var h="",i=true,j=k.page==1;if(!g){if(j){h+='<li class="unselectable"><span class="item-title"><em>'+wpLinkL10n.noMatchesFound+"</em></span></li>"}}else{f.each(g,function(){h+=i?'<li class="alternate">':"<li>";h+='<input type="hidden" class="item-permalink" value="'+this["permalink"]+'" />';h+='<span class="item-title">';h+=this["title"]?this["title"]:"<em>"+wpLinkL10n.untitled+"</em>";h+='</span><span class="item-info">'+this["info"]+"</span></li>";i=!i})}this.ul[j?"html":"append"](h)},maybeLoad:function(){var h=this,i=this.element,g=i.scrollTop()+i.height();if(!this.query.ready()||g<this.ul.height()-wpLink.riverBottomThreshold){return}setTimeout(function(){var j=i.scrollTop(),k=j+i.height();if(!h.query.ready()||k<h.ul.height()-wpLink.riverBottomThreshold){return}h.waiting.show();i.scrollTop(j+h.waiting.outerHeight());h.ajax(function(){h.waiting.hide()})},wpLink.timeToTriggerRiver)}});c=function(g){this.page=1;this.allLoaded=false;this.querying=false;this.search=g};f.extend(c.prototype,{ready:function(){return !(this.querying||this.allLoaded)},ajax:function(i){var g=this,h={action:"wp-link-ajax",page:this.page};if(this.search){h.search=this.search}this.querying=true;f.post(ajaxurl,h,function(j){g.page++;g.querying=false;g.allLoaded=!j;i(j,h)},"json")}});f(document).ready(wpLink.init)})(jQuery);2 No newline at end of file 1 var wpLink;(function(f){var b={},e={},d,a,c;wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5,keySensitivity:100,lastSearch:"",init:function(){b.dialog=f("#wp-link");b.submit=f("#wp-link-submit");b.url=f("#url-field");b.title=f("#link-title-field");b.openInNewTab=f("#link-target-checkbox");b.search=f("#search-field");e.search=new a(f("#search-results"));e.recent=new a(f("#most-recent-results"));e.elements=f(".query-results",b.dialog);b.dialog.keydown(wpLink.keydown);b.dialog.keyup(wpLink.keyup);b.submit.click(function(g){wpLink.update();g.preventDefault()});f("#wp-link-cancel").click(wpLink.cancel);e.elements.bind("river-select",wpLink.updateFields);b.search.keyup(wpLink.searchInternalLinks);b.dialog.bind("wpdialogrefresh",wpLink.refresh)},refresh:function(){var g;d=tinyMCEPopup.editor;e.search.refresh();e.recent.refresh();tinyMCEPopup.restoreSelection();if(g=d.dom.getParent(d.selection.getNode(),"A")){b.url.val(g.href);b.title.val(d.dom.getAttrib(g,"title"));if("_blank"==d.dom.getAttrib(g,"target")){b.openInNewTab.attr("checked","checked")}b.submit.val(wpLinkL10n.update)}else{wpLink.setDefaultValues();b.submit.val(wpLinkL10n.save)}tinyMCEPopup.storeSelection();b.url.focus()[0].select();if(!e.recent.ul.children().length){e.recent.ajax()}},cancel:function(){tinyMCEPopup.close()},update:function(){var h=tinyMCEPopup.editor,i={href:b.url.val(),title:b.title.val(),target:b.openInNewTab.attr("checked")?"_blank":""},j,g;tinyMCEPopup.restoreSelection();j=h.dom.getParent(h.selection.getNode(),"A");if(!i.href||i.href=="http://"){if(j){tinyMCEPopup.execCommand("mceBeginUndoLevel");g=h.selection.getBookmark();h.dom.remove(j,1);h.selection.moveToBookmark(g);tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()}return}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(j==null){h.getDoc().execCommand("unlink",false,null);tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});tinymce.each(h.dom.select("a"),function(k){if(h.dom.getAttrib(k,"href")=="#mce_temp_url#"){j=k;h.dom.setAttribs(j,i)}});if(f(j).text()=="#mce_temp_url#"){h.dom.remove(j);j=null}}else{h.dom.setAttribs(j,i)}if(j&&(j.childNodes.length!=1||j.firstChild.nodeName!="IMG")){h.focus();h.selection.select(j);h.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()},updateFields:function(i,h,g){b.url.val(h.children(".item-permalink").val());b.title.val(h.children(".item-title").text());if(g&&g.type=="click"){b.url.focus()}},setDefaultValues:function(){b.url.val("http://");b.title.val("")},searchInternalLinks:function(){var h=f(this),i,g=h.val();if(g.length>2){e.recent.hide();e.search.show();if(wpLink.lastSearch==g){return}wpLink.lastSearch=g;i=h.siblings("img.waiting").show();e.search.change(g);e.search.ajax(function(){i.hide()})}else{e.search.hide();e.recent.show()}},next:function(){e.search.next();e.recent.next()},prev:function(){e.search.prev();e.recent.prev()},keydown:function(i){var h,g=f.ui.keyCode;switch(i.which){case g.UP:h="prev";case g.DOWN:h=h||"next";clearInterval(wpLink.keyInterval);wpLink[h]();wpLink.keyInterval=setInterval(wpLink[h],wpLink.keySensitivity);break;default:return}i.preventDefault()},keyup:function(h){var g=f.ui.keyCode;switch(h.which){case g.ESCAPE:wpLink.cancel();break;case g.UP:case g.DOWN:clearInterval(wpLink.keyInterval);break;default:return}h.preventDefault()},delayedCallback:function(i,g){var l,k,j,h;if(!g){return i}setTimeout(function(){if(k){return i.apply(h,j)}l=true},g);return function(){if(l){return i.apply(this,arguments)}j=arguments;h=this;k=true}}};a=function(i,h){var g=this;this.element=i;this.ul=i.children("ul");this.waiting=i.find(".river-waiting");this.change(h);this.refresh();i.scroll(function(){g.maybeLoad()});i.delegate("li","click",function(j){g.select(f(this),j)})};f.extend(a.prototype,{refresh:function(){this.deselect();this.visible=this.element.is(":visible")},show:function(){if(!this.visible){this.deselect();this.element.show();this.visible=true}},hide:function(){this.element.hide();this.visible=false},select:function(h,k){var j,i,l,g;if(h.hasClass("unselectable")||h==this.selected){return}this.deselect();this.selected=h.addClass("selected");j=h.outerHeight();i=this.element.height();l=h.position().top;g=this.element.scrollTop();if(l<0){this.element.scrollTop(g+l)}else{if(l+j>i){this.element.scrollTop(g+l-i+j)}}this.element.trigger("river-select",[h,k,this])},deselect:function(){if(this.selected){this.selected.removeClass("selected")}this.selected=false},prev:function(){if(!this.visible){return}var g;if(this.selected){g=this.selected.prev("li");if(g.length){this.select(g)}}},next:function(){if(!this.visible){return}var g=this.selected?this.selected.next("li"):f("li:not(.unselectable):first",this.element);if(g.length){this.select(g)}},ajax:function(j){var h=this,i=this.query.page==1?0:wpLink.minRiverAJAXDuration,g=wpLink.delayedCallback(function(k,l){h.process(k,l);if(j){j(k,l)}},i);this.query.ajax(g)},change:function(g){if(this.query&&this._search==g){return}this._search=g;this.query=new c(g);this.element.scrollTop(0)},process:function(g,k){var h="",i=true,j=k.page==1;if(!g){if(j){h+='<li class="unselectable"><span class="item-title"><em>'+wpLinkL10n.noMatchesFound+"</em></span></li>"}}else{f.each(g,function(){h+=i?'<li class="alternate">':"<li>";h+='<input type="hidden" class="item-permalink" value="'+this["permalink"]+'" />';h+='<span class="item-title">';h+=this["title"]?this["title"]:"<em>"+wpLinkL10n.untitled+"</em>";h+='</span><span class="item-info">'+this["info"]+"</span></li>";i=!i})}this.ul[j?"html":"append"](h)},maybeLoad:function(){var h=this,i=this.element,g=i.scrollTop()+i.height();if(!this.query.ready()||g<this.ul.height()-wpLink.riverBottomThreshold){return}setTimeout(function(){var j=i.scrollTop(),k=j+i.height();if(!h.query.ready()||k<h.ul.height()-wpLink.riverBottomThreshold){return}h.waiting.show();i.scrollTop(j+h.waiting.outerHeight());h.ajax(function(){h.waiting.hide()})},wpLink.timeToTriggerRiver)}});c=function(g){this.page=1;this.allLoaded=false;this.querying=false;this.search=g};f.extend(c.prototype,{ready:function(){return !(this.querying||this.allLoaded)},ajax:function(i){var g=this,h={action:"wp-link-ajax",page:this.page};if(this.search){h.search=this.search}this.querying=true;f.post(ajaxurl,h,function(j){g.page++;g.querying=false;g.allLoaded=!j;i(j,h)},"json")}});f(document).ready(wpLink.init)})(jQuery); 2 No newline at end of file -
wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js
7 7 timeToTriggerRiver: 150, 8 8 minRiverAJAXDuration: 200, 9 9 riverBottomThreshold: 5, 10 keySensitivity: 100, 10 11 lastSearch: '', 11 12 init : function() { 12 13 inputs.dialog = $('#wp-link'); 13 inputs. update = $('#wp-link-update a');14 inputs.submit = $('#wp-link-submit'); 14 15 // URL 15 16 inputs.url = $('#url-field'); 16 17 // Secondary options … … 24 25 rivers.elements = $('.query-results', inputs.dialog); 25 26 26 27 // Bind event handlers 27 inputs.update.click( wpLink.update ); 28 $('#wp-link-cancel').click( function() { tinyMCEPopup.close(); } ); 28 inputs.dialog.keydown( wpLink.keydown ); 29 inputs.dialog.keyup( wpLink.keyup ); 30 inputs.submit.click( function(e){ 31 wpLink.update(); 32 e.preventDefault(); 33 }); 34 $('#wp-link-cancel').click( wpLink.cancel ); 29 35 30 rivers.elements. delegate('li', 'click', wpLink.selectInternalLink )36 rivers.elements.bind('river-select', wpLink.updateFields ); 31 37 32 38 inputs.search.keyup( wpLink.searchInternalLinks ); 33 39 34 inputs.dialog.bind(' dialogopen', wpLink.refresh);40 inputs.dialog.bind('wpdialogrefresh', wpLink.refresh); 35 41 }, 36 42 37 43 refresh : function() { 38 44 var e; 39 45 ed = tinyMCEPopup.editor; 40 46 41 // Clear previously selected links 42 rivers.elements.find('.selected').removeClass('selected'); 47 // Refresh rivers (clear links, check visibility) 48 rivers.search.refresh(); 49 rivers.recent.refresh(); 43 50 44 51 tinyMCEPopup.restoreSelection(); 45 52 … … 52 59 if ( "_blank" == ed.dom.getAttrib(e, 'target') ) 53 60 inputs.openInNewTab.attr('checked','checked'); 54 61 // Update save prompt. 55 inputs. update.text( wpLinkL10n.update );62 inputs.submit.val( wpLinkL10n.update ); 56 63 57 64 // If there's no link, set the default values. 58 65 } else { 59 // Set URL and description to defaults. 60 // Leave the new tab setting as-is. 61 inputs.url.val('http://'); 62 inputs.title.val(''); 66 wpLink.setDefaultValues(); 63 67 // Update save prompt. 64 inputs. update.text( wpLinkL10n.save );68 inputs.submit.val( wpLinkL10n.save ); 65 69 } 66 70 67 71 tinyMCEPopup.storeSelection(); 68 // If the focus is moved above the selection changes, 69 // IE will show a flashing cursor over the dialog. 70 inputs.url.focus(); 72 // Focus the URL field and highlight its contents. 73 // If this is moved above the selection changes, 74 // IE will show a flashing cursor over the dialog. 75 inputs.url.focus()[0].select(); 71 76 // Load the most recent results if this is the first time opening the panel. 72 77 if ( ! rivers.recent.ul.children().length ) 73 78 rivers.recent.ajax(); 74 79 }, 80 81 cancel : function() { 82 tinyMCEPopup.close(); 83 }, 75 84 76 85 update : function() { 77 var el, 78 ed = tinyMCEPopup.editor, 86 var ed = tinyMCEPopup.editor, 79 87 attrs = { 80 88 href : inputs.url.val(), 81 89 title : inputs.title.val(), 82 90 target : inputs.openInNewTab.attr('checked') ? '_blank' : '' 83 }, e, b, 84 defaultContent = attrs.title ? attrs.title : attrs.href; 91 }, e, b; 85 92 86 93 tinyMCEPopup.restoreSelection(); 87 94 e = ed.dom.getParent(ed.selection.getNode(), 'A'); 88 95 89 // If the values are empty ...96 // If the values are empty, unlink and return 90 97 if ( ! attrs.href || attrs.href == 'http://' ) { 91 // ...and nothing is selected, we should return 92 if ( ed.selection.isCollapsed() ) { 93 tinyMCEPopup.close(); 94 return; 95 // ...and a link exists, we should unlink and return 96 } else if ( e ) { 98 if ( e ) { 97 99 tinyMCEPopup.execCommand("mceBeginUndoLevel"); 98 100 b = ed.selection.getBookmark(); 99 101 ed.dom.remove(e, 1); 100 102 ed.selection.moveToBookmark(b); 101 103 tinyMCEPopup.execCommand("mceEndUndoLevel"); 102 104 tinyMCEPopup.close(); 103 return;104 105 } 106 return; 105 107 } 106 108 107 109 tinyMCEPopup.execCommand("mceBeginUndoLevel"); 108 110 109 111 if (e == null) { 110 112 ed.getDoc().execCommand("unlink", false, null); 113 tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); 111 114 112 // If no selection exists, create a new link from scratch.113 if ( ed.selection.isCollapsed() ) {114 el = ed.dom.create('a', { href: "#mce_temp_url#" }, defaultContent);115 ed.selection.setNode(el);116 // If a selection exists, wrap it in a link.117 } else {118 tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});119 }120 121 115 tinymce.each(ed.dom.select("a"), function(n) { 122 116 if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { 123 117 e = n; 124 118 ed.dom.setAttribs(e, attrs); 125 119 } 126 120 }); 121 122 // Sometimes WebKit lets a user create a link where 123 // they shouldn't be able to. In this case, CreateLink 124 // injects "#mce_temp_url#" into their content. Fix it. 125 if ( $(e).text() == '#mce_temp_url#' ) { 126 ed.dom.remove(e); 127 e = null; 128 } 127 129 } else { 128 130 ed.dom.setAttribs(e, attrs); 129 131 } 130 132 131 children = $(e).children();132 133 // Don't move caret if selection was image 133 if ( e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {134 if ( e && (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') ) { 134 135 ed.focus(); 135 136 ed.selection.select(e); 136 137 ed.selection.collapse(0); … … 141 142 tinyMCEPopup.close(); 142 143 }, 143 144 144 selectInternalLink : function() { 145 var t = $(this); 146 if ( t.hasClass('unselectable') ) 147 return; 148 t.siblings('.selected').removeClass('selected'); 149 t.addClass('selected'); 150 inputs.url.val( t.children('.item-permalink').val() ); 151 inputs.title.val( t.children('.item-title').text() ); 145 updateFields : function( e, li, originalEvent ) { 146 inputs.url.val( li.children('.item-permalink').val() ); 147 inputs.title.val( li.children('.item-title').text() ); 148 if ( originalEvent && originalEvent.type == "click" ) 149 inputs.url.focus(); 152 150 }, 151 setDefaultValues : function() { 152 // Set URL and description to defaults. 153 // Leave the new tab setting as-is. 154 inputs.url.val('http://'); 155 inputs.title.val(''); 156 }, 153 157 154 158 searchInternalLinks : function() { 155 159 var t = $(this), waiting, 156 160 search = t.val(); 157 161 158 162 if ( search.length > 2 ) { 159 rivers.recent. element.hide();160 rivers.search. element.show();163 rivers.recent.hide(); 164 rivers.search.show(); 161 165 162 166 // Don't search if the keypress didn't change the title. 163 167 if ( wpLink.lastSearch == search ) … … 169 173 rivers.search.change( search ); 170 174 rivers.search.ajax( function(){ waiting.hide(); }); 171 175 } else { 172 rivers.search. element.hide();173 rivers.recent. element.show();176 rivers.search.hide(); 177 rivers.recent.show(); 174 178 } 175 179 }, 180 181 next : function() { 182 rivers.search.next(); 183 rivers.recent.next(); 184 }, 185 prev : function() { 186 rivers.search.prev(); 187 rivers.recent.prev(); 188 }, 189 190 keydown : function( event ) { 191 var fn, key = $.ui.keyCode; 192 193 switch( event.which ) { 194 case key.UP: 195 fn = 'prev'; 196 case key.DOWN: 197 fn = fn || 'next'; 198 clearInterval( wpLink.keyInterval ); 199 wpLink[ fn ](); 200 wpLink.keyInterval = setInterval( wpLink[ fn ], wpLink.keySensitivity ); 201 break; 202 default: 203 return; 204 } 205 event.preventDefault(); 206 }, 207 keyup: function( event ) { 208 var key = $.ui.keyCode; 209 210 switch( event.which ) { 211 case key.ESCAPE: 212 wpLink.cancel(); 213 break; 214 case key.UP: 215 case key.DOWN: 216 clearInterval( wpLink.keyInterval ); 217 break; 218 default: 219 return; 220 } 221 event.preventDefault(); 222 }, 176 223 177 224 delayedCallback : function( func, delay ) { 178 225 var timeoutTriggered, funcTriggered, funcArgs, funcContext; … … 205 252 this.waiting = element.find('.river-waiting'); 206 253 207 254 this.change( search ); 255 this.refresh(); 208 256 209 257 element.scroll( function(){ self.maybeLoad(); }); 258 element.delegate('li', 'click', function(e){ self.select( $(this), e ); }); 210 259 }; 211 260 212 261 $.extend( River.prototype, { 262 refresh: function() { 263 this.deselect(); 264 this.visible = this.element.is(':visible'); 265 }, 266 show: function() { 267 if ( ! this.visible ) { 268 this.deselect(); 269 this.element.show(); 270 this.visible = true; 271 } 272 }, 273 hide: function() { 274 this.element.hide(); 275 this.visible = false; 276 }, 277 // Selects a list item and triggers the river-select event. 278 select: function( li, event ) { 279 var liHeight, elHeight, liTop, elTop; 280 281 if ( li.hasClass('unselectable') || li == this.selected ) 282 return; 283 284 this.deselect(); 285 this.selected = li.addClass('selected'); 286 // Make sure the element is visible 287 liHeight = li.outerHeight(); 288 elHeight = this.element.height(); 289 liTop = li.position().top; 290 elTop = this.element.scrollTop(); 291 292 if ( liTop < 0 ) // Make first visible element 293 this.element.scrollTop( elTop + liTop ); 294 else if ( liTop + liHeight > elHeight ) // Make last visible element 295 this.element.scrollTop( elTop + liTop - elHeight + liHeight ); 296 297 // Trigger the river-select event 298 this.element.trigger('river-select', [ li, event, this ]); 299 }, 300 deselect: function() { 301 if ( this.selected ) 302 this.selected.removeClass('selected'); 303 this.selected = false; 304 }, 305 prev: function() { 306 if ( ! this.visible ) 307 return; 308 309 var to; 310 if ( this.selected ) { 311 to = this.selected.prev('li'); 312 if ( to.length ) 313 this.select( to ); 314 } 315 }, 316 next: function() { 317 if ( ! this.visible ) 318 return; 319 320 var to = this.selected ? this.selected.next('li') : $('li:not(.unselectable):first', this.element); 321 if ( to.length ) 322 this.select( to ); 323 }, 213 324 ajax: function( callback ) { 214 325 var self = this, 215 326 delay = this.query.page == 1 ? 0 : wpLink.minRiverAJAXDuration, -
wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js
9 9 * @param {string} url Absolute URL to where the plugin is located. 10 10 */ 11 11 init : function(ed, url) { 12 var disabled = true; 13 12 14 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); 13 15 ed.addCommand('WP_Link', function() { 16 if ( disabled ) 17 return; 14 18 ed.windowManager.open({ 15 19 id : 'wp-link', 16 20 width : 480, … … 29 33 }); 30 34 31 35 ed.addShortcut('alt+shift+a', ed.getLang('advanced.link_desc'), 'WP_Link'); 32 33 // Add a node change handler, selects the button in the UI when a link is selected 34 ed.onNodeChange.add(function(ed, cm, n) { 35 cm.setActive('wplink', n.nodeName == 'A'); 36 37 ed.onNodeChange.add(function(ed, cm, n, co) { 38 disabled = co && n.nodeName != 'A'; 36 39 }); 37 40 }, 38 41 /** -
wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.js
1 (function(b){var a=function(c){return function(){if(this.features.wpDialog){return c.apply(this,arguments)}else{return this.parent.apply(this,arguments)}}};tinymce.create("tinymce.plugins.WPDialogs",{init:function(c,d){c.onBeforeRenderUI.add(function(){c.windowManager=new tinymce.WPWindowManager(c)})},getInfo:function(){return{longname:"WPDialogs",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"0.1"}}}); tinymce.create("tinymce.WPWindowManager:tinymce.InlineWindowManager",{WPWindowManager:function(c){this.parent(c)},open:function(e,g){var d=this,c;if(!e.wpDialog){return this.parent(e,g)}else{if(!e.id){return}}c=b("#"+e.id);if(!c.length){return}d.features=e;d.params=g;d.onOpen.dispatch(d,e,g);d.element=d.windows[e.id]=c;d.bookmark=d.editor.selection.getBookmark();if(tinyMCEPopup){tinyMCEPopup.init()}c.dialog({title:e.title,width:e.width,height:e.height,modal:true,dialogClass:"wp-dialog",zIndex:300000})},close:a(function(){this.element.dialog("close")})});tinymce.PluginManager.add("wpdialogs",tinymce.plugins.WPDialogs)})(jQuery);2 No newline at end of file 1 (function(b){var a=function(c){return function(){if(this.features.wpDialog){return c.apply(this,arguments)}else{return this.parent.apply(this,arguments)}}};tinymce.create("tinymce.plugins.WPDialogs",{init:function(c,d){c.onBeforeRenderUI.add(function(){c.windowManager=new tinymce.WPWindowManager(c)})},getInfo:function(){return{longname:"WPDialogs",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"0.1"}}});b(document).ready(function(){b.widget("wp.wpdialog",b.ui.dialog,{open:function(){if(tinyMCEPopup){tinyMCEPopup.init()}b.ui.dialog.prototype.open.apply(this,arguments);this.element.focus();this._trigger("refresh")}})});tinymce.create("tinymce.WPWindowManager:tinymce.InlineWindowManager",{WPWindowManager:function(c){this.parent(c)},open:function(e,g){var d=this,c;if(!e.wpDialog){return this.parent(e,g)}else{if(!e.id){return}}c=b("#"+e.id);if(!c.length){return}d.features=e;d.params=g;d.onOpen.dispatch(d,e,g);d.element=d.windows[e.id]=c;d.bookmark=d.editor.selection.getBookmark(1);c.wpdialog({title:e.title,width:e.width,height:e.height,modal:true,dialogClass:"wp-dialog",zIndex:300000})},close:a(function(){this.element.wpdialog("close")})});tinymce.PluginManager.add("wpdialogs",tinymce.plugins.WPDialogs)})(jQuery); 2 No newline at end of file -
wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js
36 36 }; 37 37 } 38 38 }); 39 40 $(document).ready(function() { 41 $.widget("wp.wpdialog", $.ui.dialog, { 42 open: function() { 43 // Initialize tinyMCEPopup if it exists. 44 if ( tinyMCEPopup ) 45 tinyMCEPopup.init(); 46 // Open the dialog. 47 $.ui.dialog.prototype.open.apply( this, arguments ); 48 // WebKit leaves focus in the TinyMCE editor unless we shift focus. 49 this.element.focus(); 50 this._trigger('refresh'); 51 } 52 }); 53 }); 39 54 40 55 tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', { 41 56 WPWindowManager : function(ed) { … … 60 75 t.element = t.windows[ f.id ] = element; 61 76 62 77 // Store selection 63 t.bookmark = t.editor.selection.getBookmark( );78 t.bookmark = t.editor.selection.getBookmark(1); 64 79 65 if ( tinyMCEPopup ) 66 tinyMCEPopup.init(); 67 68 element.dialog({ 80 element.wpdialog({ 69 81 title: f.title, 70 82 width: f.width, 71 83 height: f.height, … … 75 87 }); 76 88 }, 77 89 close : wpDialogFn(function() { 78 this.element. dialog('close');90 this.element.wpdialog('close'); 79 91 }) 80 92 }); 81 93 -
wp-includes/script-loader.php
Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
270 270 'l10n_print_after' => 'try{convertEntities(adminBarL10n);}catch(e){};', 271 271 ) ); 272 272 273 $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '2010112 0' );273 $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20101123' ); 274 274 $scripts->localize( 'wplink', 'wpLinkL10n', array( 275 275 'update' => __('Update'), 276 276 'save' => __('Save Link'), … … 518 518 $styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100907' ); 519 519 $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101117' ); 520 520 $styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101119' ); 521 $styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '201011 19' );521 $styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101123' ); 522 522 523 523 foreach ( $rtl_styles as $rtl_style ) { 524 524 $styles->add_data( $rtl_style, 'rtl', true ); -
wp-admin/includes/internal-linking.php
70 70 */ 71 71 function wp_link_dialog() { 72 72 ?> 73 < div id="wp-link">73 <form id="wp-link" tabindex="-1"> 74 74 <div id="link-selector"> 75 75 <div id="link-options"> 76 76 <p class="howto"><?php _e( 'Enter the destination URL:' ); ?></p> 77 77 <div> 78 <label><span><?php _e( 'URL' ); ?></span><input id="url-field" type="text" /></label>78 <label><span><?php _e( 'URL' ); ?></span><input id="url-field" type="text" tabindex="10" autocomplete="off" /></label> 79 79 </div> 80 80 <div> 81 <label><span><?php _e( 'Title' ); ?></span><input id="link-title-field" type="text" /></label>81 <label><span><?php _e( 'Title' ); ?></span><input id="link-title-field" type="text" tabindex="20" autocomplete="off" /></label> 82 82 </div> 83 83 <div class="link-target"> 84 <label><input type="checkbox" id="link-target-checkbox" /> <?php _e( 'Open link in a new window/tab' ); ?></label>84 <label><input type="checkbox" id="link-target-checkbox" tabindex="30" /> <?php _e( 'Open link in a new window/tab' ); ?></label> 85 85 </div> 86 86 </div> 87 87 <div id="search-panel"> … … 89 89 <p class="howto"><?php _e( 'Or, link to existing site content:' ); ?></p> 90 90 <label for="search-field"> 91 91 <span><?php _e( 'Search' ); ?></span> 92 <input type="text" id="search-field" class="link-search-field" />92 <input type="text" id="search-field" class="link-search-field" tabindex="60" autocomplete="off" /> 93 93 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> 94 94 </label> 95 95 </div> … … 113 113 <a class="submitdelete deletion" href="#"><?php _e( 'Cancel' ); ?></a> 114 114 </div> 115 115 <div id="wp-link-update"> 116 < a class="button-primary" href="#"></a>116 <?php submit_button( __('Update'), 'primary', 'wp-link-submit', false, array('tabindex' => 100)); ?> 117 117 </div> 118 118 </div> 119 </ div>119 </form> 120 120 <?php 121 121 } 122 122 ?> 123 No newline at end of file