From 1824884b7546e3bfea5221d595ea92394e4b0f9f Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 20 Aug 2018 13:34:25 +0000 Subject: [PATCH] Reorder `quicktags.js` a bit to account for the order of defining vars and functions after [43577]. See #44371. Built from https://develop.svn.wordpress.org/trunk@43579 git-svn-id: http://core.svn.wordpress.org/trunk@43408 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/quicktags.js | 78 ++++++++++++++++----------------- wp-includes/js/quicktags.min.js | 2 +- wp-includes/version.php | 2 +- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/wp-includes/js/quicktags.js b/wp-includes/js/quicktags.js index 5bfd6aa031..f7bc488691 100644 --- a/wp-includes/js/quicktags.js +++ b/wp-includes/js/quicktags.js @@ -35,47 +35,20 @@ window.edButtons = []; * * Define all former global functions so plugins that hack quicktags.js directly don't cause fatal errors. */ -window.edAddTag = function(){}, -window.edCheckOpenTags = function(){}, -window.edCloseAllTags = function(){}, -window.edInsertImage = function(){}, -window.edInsertLink = function(){}, -window.edInsertTag = function(){}, -window.edLink = function(){}, -window.edQuickLink = function(){}, -window.edRemoveTag = function(){}, -window.edShowButton = function(){}, -window.edShowLinks = function(){}, -window.edSpell = function(){}, +window.edAddTag = function(){}; +window.edCheckOpenTags = function(){}; +window.edCloseAllTags = function(){}; +window.edInsertImage = function(){}; +window.edInsertLink = function(){}; +window.edInsertTag = function(){}; +window.edLink = function(){}; +window.edQuickLink = function(){}; +window.edRemoveTag = function(){}; +window.edShowButton = function(){}; +window.edShowLinks = function(){}; +window.edSpell = function(){}; window.edToolbar = function(){}; -/** - * Initialize new instance of the Quicktags editor - */ -window.quicktags = function(settings) { - return new QTags(settings); -} - -/** - * Inserts content at the caret in the active editor (textarea) - * - * Added for back compatibility - * @see QTags.insertContent() - */ -window.edInsertContent = function(bah, txt) { - return QTags.insertContent(txt); -} - -/** - * Adds a button to all instances of the editor - * - * Added for back compatibility, use QTags.addButton() as it gives more flexibility like type of button, button placement, etc. - * @see QTags.addButton() - */ -window.edButton = function(id, display, tagStart, tagEnd, access) { - return QTags.addButton( id, display, tagStart, tagEnd, access, '', -1 ); -} - /* jshint ignore:end */ (function(){ @@ -747,3 +720,30 @@ window.edButton = function(id, display, tagStart, tagEnd, access) { edButtons[140] = new qt.CloseButton(); })(); + +/** + * Initialize new instance of the Quicktags editor + */ +window.quicktags = function(settings) { + return new window.QTags(settings); +}; + +/** + * Inserts content at the caret in the active editor (textarea) + * + * Added for back compatibility + * @see QTags.insertContent() + */ +window.edInsertContent = function(bah, txt) { + return window.QTags.insertContent(txt); +}; + +/** + * Adds a button to all instances of the editor + * + * Added for back compatibility, use QTags.addButton() as it gives more flexibility like type of button, button placement, etc. + * @see QTags.addButton() + */ +window.edButton = function(id, display, tagStart, tagEnd, access) { + return window.QTags.addButton( id, display, tagStart, tagEnd, access, '', -1 ); +}; diff --git a/wp-includes/js/quicktags.min.js b/wp-includes/js/quicktags.min.js index 0bd62f51fa..46e0b20f10 100644 --- a/wp-includes/js/quicktags.min.js +++ b/wp-includes/js/quicktags.min.js @@ -1 +1 @@ -window.edButtons=[],window.edAddTag=function(){},window.edCheckOpenTags=function(){},window.edCloseAllTags=function(){},window.edInsertImage=function(){},window.edInsertLink=function(){},window.edInsertTag=function(){},window.edLink=function(){},window.edQuickLink=function(){},window.edRemoveTag=function(){},window.edShowButton=function(){},window.edShowLinks=function(){},window.edSpell=function(){},window.edToolbar=function(){},window.quicktags=function(a){return new QTags(a)},window.edInsertContent=function(a,b){return QTags.insertContent(b)},window.edButton=function(a,b,c,d,e){return QTags.addButton(a,b,c,d,e,"",-1)}(function(){function a(a){return a=a||"",a=a.replace(/&([^#])(?![a-z1-4]{1,8};)/gi,"&$1"),a.replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}var b=function(a){var c,d,e,f;"undefined"!=typeof jQuery?jQuery(document).ready(a):(c=b,c.funcs=[],c.ready=function(){if(!c.isReady)for(c.isReady=!0,d=0;d0){for(;"undefined"!=typeof edButtons[h];)h++;edButtons[h]=k}else edButtons[edButtons.length]=k;this.buttonsInitDone&&this._buttonsInit()}},d.insertContent=function(a){var b,c,d,e,f,g,h=document.getElementById(wpActiveEditor);return!!h&&(document.selection?(h.focus(),b=document.selection.createRange(),b.text=a,h.focus()):h.selectionStart||0===h.selectionStart?(f=h.value,c=h.selectionStart,d=h.selectionEnd,e=h.scrollTop,h.value=f.substring(0,c)+a+f.substring(d,f.length),h.selectionStart=c+a.length,h.selectionEnd=c+a.length,h.scrollTop=e,h.focus()):(h.value+=a,h.focus()),document.createEvent?(g=document.createEvent("HTMLEvents"),g.initEvent("change",!1,!0),h.dispatchEvent(g)):h.fireEvent&&h.fireEvent("onchange"),!0)},d.Button=function(a,b,c,d,e,f){this.id=a,this.display=b,this.access="",this.title=d||"",this.instance=e||"",this.attr=f||{}},d.Button.prototype.html=function(b){var c,d,e,f=this.title?' title="'+a(this.title)+'"':"",g=this.attr&&this.attr.ariaLabel?' aria-label="'+a(this.attr.ariaLabel)+'"':"",h=this.display?' value="'+a(this.display)+'"':"",i=this.id?' id="'+a(b+this.id)+'"':"",j=(e=window.wp)&&e.editor&&e.editor.dfw;return"fullscreen"===this.id?'":"dfw"===this.id?(c=j&&j.isActive()?"":' disabled="disabled"',d=j&&j.isOn()?" active":"",'"):'"},d.Button.prototype.callback=function(){},d.TagButton=function(a,b,c,e,f,g,h,i){var j=this;d.Button.call(j,a,b,f,g,h,i),j.tagStart=c,j.tagEnd=e},d.TagButton.prototype=new d.Button,d.TagButton.prototype.openTag=function(a,b){b.openTags||(b.openTags=[]),this.tagEnd&&(b.openTags.push(this.id),a.value="/"+a.value,this.attr.ariaLabelClose&&a.setAttribute("aria-label",this.attr.ariaLabelClose))},d.TagButton.prototype.closeTag=function(a,b){var c=this.isOpen(b);c!==!1&&b.openTags.splice(c,1),a.value=this.display,this.attr.ariaLabel&&a.setAttribute("aria-label",this.attr.ariaLabel)},d.TagButton.prototype.isOpen=function(a){var b=this,c=0,d=!1;if(a.openTags)for(;d===!1&&c0?m.tagEnd?k.text=m.tagStart+k.text+o:k.text=k.text+m.tagStart:m.tagEnd?m.isOpen(c)===!1?(k.text=m.tagStart,m.openTag(a,c)):(k.text=o,m.closeTag(a,c)):k.text=m.tagStart,b.focus()):b.selectionStart||0===b.selectionStart?(d=b.selectionStart,e=b.selectionEnd,d0;)d=c.getButton(f[f.length-1]),e=document.getElementById(c.name+"_"+d.id),a?d.callback.call(d,e,b,c):d.closeTag(e,c)},d.CloseButton.prototype.callback=d._close,d.closeAllTags=function(a){var b=this.getInstance(a);b&&d._close("",b.canvas,b)},d.LinkButton=function(){var a={ariaLabel:quicktagsL10n.link};d.TagButton.call(this,"link","link","","","","","",a)},d.LinkButton.prototype=new d.TagButton,d.LinkButton.prototype.callback=function(a,b,c,e){var f,g=this;return"undefined"!=typeof wpLink?void wpLink.open(c.id):(e||(e="http://"),void(g.isOpen(c)===!1?(f=prompt(quicktagsL10n.enterURL,e),f&&(g.tagStart='',d.TagButton.prototype.callback.call(g,a,b,c))):d.TagButton.prototype.callback.call(g,a,b,c)))},d.ImgButton=function(){var a={ariaLabel:quicktagsL10n.image};d.TagButton.call(this,"img","img","","","","","",a)},d.ImgButton.prototype=new d.TagButton,d.ImgButton.prototype.callback=function(a,b,c,e){e||(e="http://");var f,g=prompt(quicktagsL10n.enterImageURL,e);g&&(f=prompt(quicktagsL10n.enterImageDescription,""),this.tagStart=''+f+'',d.TagButton.prototype.callback.call(this,a,b,c))},d.DFWButton=function(){d.Button.call(this,"dfw","","f",quicktagsL10n.dfw)},d.DFWButton.prototype=new d.Button,d.DFWButton.prototype.callback=function(){var a;(a=window.wp)&&a.editor&&a.editor.dfw&&window.wp.editor.dfw.toggle()},d.TextDirectionButton=function(){d.Button.call(this,"textdirection",quicktagsL10n.textdirection,"",quicktagsL10n.toggleTextdirection)},d.TextDirectionButton.prototype=new d.Button,d.TextDirectionButton.prototype.callback=function(a,b){var c="rtl"===document.getElementsByTagName("html")[0].dir,d=b.style.direction;d||(d=c?"rtl":"ltr"),b.style.direction="rtl"===d?"ltr":"rtl",b.focus()},edButtons[10]=new d.TagButton("strong","b","","","","","",{ariaLabel:quicktagsL10n.strong,ariaLabelClose:quicktagsL10n.strongClose}),edButtons[20]=new d.TagButton("em","i","","","","","",{ariaLabel:quicktagsL10n.em,ariaLabelClose:quicktagsL10n.emClose}),edButtons[30]=new d.LinkButton,edButtons[40]=new d.TagButton("block","b-quote","\n\n
","
\n\n","","","",{ariaLabel:quicktagsL10n.blockquote,ariaLabelClose:quicktagsL10n.blockquoteClose}),edButtons[50]=new d.TagButton("del","del",'',"","","","",{ariaLabel:quicktagsL10n.del,ariaLabelClose:quicktagsL10n.delClose}),edButtons[60]=new d.TagButton("ins","ins",'',"","","","",{ariaLabel:quicktagsL10n.ins,ariaLabelClose:quicktagsL10n.insClose}),edButtons[70]=new d.ImgButton,edButtons[80]=new d.TagButton("ul","ul","
    \n","
\n\n","","","",{ariaLabel:quicktagsL10n.ul,ariaLabelClose:quicktagsL10n.ulClose}),edButtons[90]=new d.TagButton("ol","ol","
    \n","
\n\n","","","",{ariaLabel:quicktagsL10n.ol,ariaLabelClose:quicktagsL10n.olClose}),edButtons[100]=new d.TagButton("li","li","\t
  • ","
  • \n","","","",{ariaLabel:quicktagsL10n.li,ariaLabelClose:quicktagsL10n.liClose}),edButtons[110]=new d.TagButton("code","code","","","","","",{ariaLabel:quicktagsL10n.code,ariaLabelClose:quicktagsL10n.codeClose}),edButtons[120]=new d.TagButton("more","more","\n\n","","","","",{ariaLabel:quicktagsL10n.more}),edButtons[140]=new d.CloseButton})(); \ No newline at end of file +window.edButtons=[],window.edAddTag=function(){},window.edCheckOpenTags=function(){},window.edCloseAllTags=function(){},window.edInsertImage=function(){},window.edInsertLink=function(){},window.edInsertTag=function(){},window.edLink=function(){},window.edQuickLink=function(){},window.edRemoveTag=function(){},window.edShowButton=function(){},window.edShowLinks=function(){},window.edSpell=function(){},window.edToolbar=function(){},function(){function a(a){return a=a||"",a=a.replace(/&([^#])(?![a-z1-4]{1,8};)/gi,"&$1"),a.replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}var b=function(a){var c,d,e,f;"undefined"!=typeof jQuery?jQuery(document).ready(a):(c=b,c.funcs=[],c.ready=function(){if(!c.isReady)for(c.isReady=!0,d=0;d0){for(;"undefined"!=typeof edButtons[h];)h++;edButtons[h]=k}else edButtons[edButtons.length]=k;this.buttonsInitDone&&this._buttonsInit()}},d.insertContent=function(a){var b,c,d,e,f,g,h=document.getElementById(wpActiveEditor);return!!h&&(document.selection?(h.focus(),b=document.selection.createRange(),b.text=a,h.focus()):h.selectionStart||0===h.selectionStart?(f=h.value,c=h.selectionStart,d=h.selectionEnd,e=h.scrollTop,h.value=f.substring(0,c)+a+f.substring(d,f.length),h.selectionStart=c+a.length,h.selectionEnd=c+a.length,h.scrollTop=e,h.focus()):(h.value+=a,h.focus()),document.createEvent?(g=document.createEvent("HTMLEvents"),g.initEvent("change",!1,!0),h.dispatchEvent(g)):h.fireEvent&&h.fireEvent("onchange"),!0)},d.Button=function(a,b,c,d,e,f){this.id=a,this.display=b,this.access="",this.title=d||"",this.instance=e||"",this.attr=f||{}},d.Button.prototype.html=function(b){var c,d,e,f=this.title?' title="'+a(this.title)+'"':"",g=this.attr&&this.attr.ariaLabel?' aria-label="'+a(this.attr.ariaLabel)+'"':"",h=this.display?' value="'+a(this.display)+'"':"",i=this.id?' id="'+a(b+this.id)+'"':"",j=(e=window.wp)&&e.editor&&e.editor.dfw;return"fullscreen"===this.id?'":"dfw"===this.id?(c=j&&j.isActive()?"":' disabled="disabled"',d=j&&j.isOn()?" active":"",'"):'"},d.Button.prototype.callback=function(){},d.TagButton=function(a,b,c,e,f,g,h,i){var j=this;d.Button.call(j,a,b,f,g,h,i),j.tagStart=c,j.tagEnd=e},d.TagButton.prototype=new d.Button,d.TagButton.prototype.openTag=function(a,b){b.openTags||(b.openTags=[]),this.tagEnd&&(b.openTags.push(this.id),a.value="/"+a.value,this.attr.ariaLabelClose&&a.setAttribute("aria-label",this.attr.ariaLabelClose))},d.TagButton.prototype.closeTag=function(a,b){var c=this.isOpen(b);c!==!1&&b.openTags.splice(c,1),a.value=this.display,this.attr.ariaLabel&&a.setAttribute("aria-label",this.attr.ariaLabel)},d.TagButton.prototype.isOpen=function(a){var b=this,c=0,d=!1;if(a.openTags)for(;d===!1&&c0?m.tagEnd?k.text=m.tagStart+k.text+o:k.text=k.text+m.tagStart:m.tagEnd?m.isOpen(c)===!1?(k.text=m.tagStart,m.openTag(a,c)):(k.text=o,m.closeTag(a,c)):k.text=m.tagStart,b.focus()):b.selectionStart||0===b.selectionStart?(d=b.selectionStart,e=b.selectionEnd,d0;)d=c.getButton(f[f.length-1]),e=document.getElementById(c.name+"_"+d.id),a?d.callback.call(d,e,b,c):d.closeTag(e,c)},d.CloseButton.prototype.callback=d._close,d.closeAllTags=function(a){var b=this.getInstance(a);b&&d._close("",b.canvas,b)},d.LinkButton=function(){var a={ariaLabel:quicktagsL10n.link};d.TagButton.call(this,"link","link","","
    ","","","",a)},d.LinkButton.prototype=new d.TagButton,d.LinkButton.prototype.callback=function(a,b,c,e){var f,g=this;return"undefined"!=typeof wpLink?void wpLink.open(c.id):(e||(e="http://"),void(g.isOpen(c)===!1?(f=prompt(quicktagsL10n.enterURL,e),f&&(g.tagStart='',d.TagButton.prototype.callback.call(g,a,b,c))):d.TagButton.prototype.callback.call(g,a,b,c)))},d.ImgButton=function(){var a={ariaLabel:quicktagsL10n.image};d.TagButton.call(this,"img","img","","","","","",a)},d.ImgButton.prototype=new d.TagButton,d.ImgButton.prototype.callback=function(a,b,c,e){e||(e="http://");var f,g=prompt(quicktagsL10n.enterImageURL,e);g&&(f=prompt(quicktagsL10n.enterImageDescription,""),this.tagStart=''+f+'',d.TagButton.prototype.callback.call(this,a,b,c))},d.DFWButton=function(){d.Button.call(this,"dfw","","f",quicktagsL10n.dfw)},d.DFWButton.prototype=new d.Button,d.DFWButton.prototype.callback=function(){var a;(a=window.wp)&&a.editor&&a.editor.dfw&&window.wp.editor.dfw.toggle()},d.TextDirectionButton=function(){d.Button.call(this,"textdirection",quicktagsL10n.textdirection,"",quicktagsL10n.toggleTextdirection)},d.TextDirectionButton.prototype=new d.Button,d.TextDirectionButton.prototype.callback=function(a,b){var c="rtl"===document.getElementsByTagName("html")[0].dir,d=b.style.direction;d||(d=c?"rtl":"ltr"),b.style.direction="rtl"===d?"ltr":"rtl",b.focus()},edButtons[10]=new d.TagButton("strong","b","","","","","",{ariaLabel:quicktagsL10n.strong,ariaLabelClose:quicktagsL10n.strongClose}),edButtons[20]=new d.TagButton("em","i","","","","","",{ariaLabel:quicktagsL10n.em,ariaLabelClose:quicktagsL10n.emClose}),edButtons[30]=new d.LinkButton,edButtons[40]=new d.TagButton("block","b-quote","\n\n
    ","
    \n\n","","","",{ariaLabel:quicktagsL10n.blockquote,ariaLabelClose:quicktagsL10n.blockquoteClose}),edButtons[50]=new d.TagButton("del","del",'',"","","","",{ariaLabel:quicktagsL10n.del,ariaLabelClose:quicktagsL10n.delClose}),edButtons[60]=new d.TagButton("ins","ins",'',"","","","",{ariaLabel:quicktagsL10n.ins,ariaLabelClose:quicktagsL10n.insClose}),edButtons[70]=new d.ImgButton,edButtons[80]=new d.TagButton("ul","ul","
      \n","
    \n\n","","","",{ariaLabel:quicktagsL10n.ul,ariaLabelClose:quicktagsL10n.ulClose}),edButtons[90]=new d.TagButton("ol","ol","
      \n","
    \n\n","","","",{ariaLabel:quicktagsL10n.ol,ariaLabelClose:quicktagsL10n.olClose}),edButtons[100]=new d.TagButton("li","li","\t
  • ","
  • \n","","","",{ariaLabel:quicktagsL10n.li,ariaLabelClose:quicktagsL10n.liClose}),edButtons[110]=new d.TagButton("code","code","","","","","",{ariaLabel:quicktagsL10n.code,ariaLabelClose:quicktagsL10n.codeClose}),edButtons[120]=new d.TagButton("more","more","\n\n","","","","",{ariaLabel:quicktagsL10n.more}),edButtons[140]=new d.CloseButton}(),window.quicktags=function(a){return new window.QTags(a)},window.edInsertContent=function(a,b){return window.QTags.insertContent(b)},window.edButton=function(a,b,c,d,e){return window.QTags.addButton(a,b,c,d,e,"",-1)}; \ No newline at end of file diff --git a/wp-includes/version.php b/wp-includes/version.php index c535f88be9..75a5997ed7 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-43578'; +$wp_version = '5.0-alpha-43579'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.