From 93d3e3efb6789709d13accdb873070b31231abc3 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 3 Feb 2014 21:31:13 +0000 Subject: [PATCH] Minor cleanup (jshint) of wp-fullscreen.js and /wordpress/plugin.js, see #24067 Built from https://develop.svn.wordpress.org/trunk@27085 git-svn-id: http://core.svn.wordpress.org/trunk@26958 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/wp-fullscreen.js | 30 ++++++++-------- wp-admin/js/wp-fullscreen.min.js | 2 +- .../js/tinymce/plugins/wordpress/plugin.js | 34 +++++++++---------- 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/wp-admin/js/wp-fullscreen.js b/wp-admin/js/wp-fullscreen.js index 70cb353853..f1c69ca298 100644 --- a/wp-admin/js/wp-fullscreen.js +++ b/wp-admin/js/wp-fullscreen.js @@ -1,4 +1,4 @@ -/* global ajaxurl, deleteUserSetting, setUserSetting, switchEditors, tinymce, tinyMCEPreInit, wp_fullscreen_settings, wpActiveEditor:true, wpLink */ +/* global deleteUserSetting, setUserSetting, switchEditors, tinymce, tinyMCEPreInit */ /** * Distraction Free Writing * (wp-fullscreen) @@ -7,7 +7,6 @@ */ ( function( $, window ) { var api, ps, s, toggleUI, uiTimer, PubSub, - oldheight = 0, uiScrollTop = 0, transitionend = 'transitionend webkitTransitionEnd', $body = $( document.body ), @@ -86,7 +85,6 @@ function _hideUI() { $body.removeClass('wp-dfw-show-ui'); - uiShown = false; } /** @@ -136,7 +134,7 @@ * @param string mode Optional. Switch to the given mode before opening. */ api.on = function() { - var id, $dfwWrap, editor, titleId; + var id, $dfwWrap, titleId; if ( s.visible ) { return; @@ -264,7 +262,7 @@ var $hidden = $('#hiddenaction'), oldVal = $hidden.val(), $spinner = $('#wp-fullscreen-save .spinner'), - $saveMessage = $('#wp-fullscreen-save .wp-fullscreen-saved-message') + $saveMessage = $('#wp-fullscreen-save .wp-fullscreen-saved-message'), $errorMessage = $('#wp-fullscreen-save .wp-fullscreen-error-message'); $spinner.show(); @@ -405,7 +403,7 @@ $( '#wp-fullscreen-title-placeholder' ).before( s.$dfwTitle.removeClass('wp-fullscreen-title').css( 'width', '' ) ).remove(); } - s.$dfwWrap.removeClass( 'wp-fullscreen-wrap' ) + s.$dfwWrap.removeClass( 'wp-fullscreen-wrap' ); s.$editorContainer.css( 'width', '' ); s.$dfwTextarea.add( '#' + s.id + '_ifr' ).height( s.origHeight ); @@ -455,7 +453,7 @@ */ api.ui = { init: function() { - var toolbar, last = 0; + var toolbar; s.toolbar = toolbar = $('#fullscreen-topbar'); s.$fullscreenFader = $('#fullscreen-fader'); @@ -465,29 +463,29 @@ $('#wp-fullscreen-mode-bar').hide(); $document.keyup( function(e) { - var c = e.keyCode || e.charCode, a, data; + var c = e.keyCode || e.charCode, modKey; if ( ! s.visible ) { return; } if ( navigator.platform && navigator.platform.indexOf('Mac') !== -1 ) { - a = e.ctrlKey; // Ctrl key for Mac + modKey = e.ctrlKey; // Ctrl key for Mac } else { - a = e.altKey; // Alt key for Win & Linux + modKey = e.altKey; // Alt key for Win & Linux } - if ( a && (61 == c || 107 == c || 187 == c) ) { // + + if ( modKey && ( 61 === c || 107 === c || 187 === c ) ) { // + api.dfwWidth( 25 ); e.preventDefault(); } - if ( a && (45 == c || 109 == c || 189 == c) ) { // - + if ( modKey && ( 45 === c || 109 === c || 189 === c ) ) { // - api.dfwWidth( -25 ); e.preventDefault(); } - if ( a && 48 == c ) { // 0 + if ( modKey && 48 === c ) { // 0 api.dfwWidth( 0 ); e.preventDefault(); } @@ -664,12 +662,12 @@ * Automatically updates textarea height. */ api.bind_resize = function() { - s.$dfwTextarea.on( 'keydown.wp-dfw-resize click.wp-dfw-resize paste.wp-dfw-resize', function(e) { - api.resizeTextarea(e); + s.$dfwTextarea.on( 'keydown.wp-dfw-resize click.wp-dfw-resize paste.wp-dfw-resize', function() { + api.resizeTextarea(); }); }; - api.resizeTextarea = function( event ) { + api.resizeTextarea = function() { var node = s.$dfwTextarea[0]; if ( node.scrollHeight > node.clientHeight ) { diff --git a/wp-admin/js/wp-fullscreen.min.js b/wp-admin/js/wp-fullscreen.min.js index 7f4eaf8370..13e33c96b6 100644 --- a/wp-admin/js/wp-fullscreen.min.js +++ b/wp-admin/js/wp-fullscreen.min.js @@ -1 +1 @@ -!function(a,b){function c(){m.removeClass("wp-dfw-show-ui"),uiShown=!1}function d(b){g.$dfwWrap.parents().each(function(c,d){var e,f=a(d);return b?(d.style.position&&f.data("wp-dfw-css-position",d.style.position),f.css("position","static")):(e=f.data("wp-dfw-css-position"),e=e||"",f.css("position",e)),"BODY"===d.nodeName?!1:void 0})}var e,f,g,h,i,j,k=0,l="transitionend webkitTransitionEnd",m=a(document.body),n=a(document);j=function(){this.topics={},this.subscribe=function(a,b){return this.topics[a]||(this.topics[a]=[]),this.topics[a].push(b),b},this.unsubscribe=function(a,b){var c,d,e=this.topics[a];if(!e)return b||[];if(b){for(c=0,d=e.length;d>c;c++)b==e[c]&&e.splice(c,1);return b}return this.topics[a]=[],e},this.publish=function(a,b){var c,d,e,f=this.topics[a];if(f){for(b=b||[],c=0,d=f.length;d>c;c++)e=f[c].apply(null,b)===!1||e;return!e}}},e={},f=e.pubsub=new j,g=e.settings={visible:!1,mode:"tinymce",id:"",title_id:"",timer:0,toolbar_shown:!1},h=e.toggleUI=function(a){clearTimeout(i),m.hasClass("wp-dfw-show-ui")||m.addClass("wp-dfw-show-ui"),"hide"===a&&(i=setTimeout(c,2e3))},e.on=function(){var c,d,f;if(!g.visible){if(g.$fullscreenFader||e.ui.init(),"object"==typeof b.wp_fullscreen_settings&&a.extend(g,b.wp_fullscreen_settings),c=g.id||b.wpActiveEditor,!c){if(!g.hasTinymce)return;c=tinymce.activeEditor.id}g.id=c,d=g.$dfwWrap=a("#wp-"+c+"-wrap"),d.length&&(g.$dfwTextarea=a("#"+c),g.$editorContainer=d.find(".wp-editor-container"),k=n.scrollTop(),g.hasTinymce&&(g.editor=tinymce.get(c)),g.editor&&!g.editor.isHidden()?(g.origHeight=a("#"+c+"_ifr").height(),g.mode="tinymce"):(g.origHeight=g.$dfwTextarea.height(),g.mode="html"),f="undefined"==typeof b.adminpage||"post-php"!==b.adminpage&&"post-new-php"!==b.adminpage?c+"-title":"title",g.$dfwTitle=a("#"+f),g.$dfwTitle.length||(g.$dfwTitle=null),e.ui.fade("show","showing","shown"))}},e.off=function(){g.visible&&e.ui.fade("hide","hiding","hidden")},e.switchmode=function(a){var b=g.mode;return a&&g.visible&&g.hasTinymce&&"undefined"!=typeof switchEditors?b==a?b:("tinymce"!==a||g.editor||(g.editor=tinymce.get(g.id),!g.editor&&"undefined"!=typeof tinyMCEPreInit&&tinyMCEPreInit.mceInit&&tinyMCEPreInit.mceInit[g.id]&&(tinyMCEPreInit.mceInit[g.id].wp_fullscreen=!0)),g.mode=a,switchEditors.go(g.id,a),e.refreshButtons(!0),"html"===a&&setTimeout(e.resizeTextarea,200),a):b},e.save=function(){var c=a("#hiddenaction"),d=c.val(),e=a("#wp-fullscreen-save .spinner"),f=a("#wp-fullscreen-save .wp-fullscreen-saved-message");$errorMessage=a("#wp-fullscreen-save .wp-fullscreen-error-message"),e.show(),$errorMessage.hide(),c.val("wp-fullscreen-save-post"),g.editor&&!g.editor.isHidden()&&g.editor.save(),a.ajax({url:b.ajaxurl,type:"post",data:a("form#post").serialize(),dataType:"json"}).done(function(b){e.hide(),b&&b.success?(f.show(),setTimeout(function(){f.fadeOut(300)},3e3),b.data&&b.data.last_edited&&a("#wp-fullscreen-save input").attr("title",b.data.last_edited)):$errorMessage.show()}).fail(function(){e.hide(),$errorMessage.show()}),c.val(d)},e.dfwWidth=function(b,c){var d;return b?(c?d=b:(d=g.$editorContainer.width(),d+=b),void(200>d||d>1200||(g.$editorContainer.width(d),g.$dfwTitle&&g.$dfwTitle.width(d-16),setUserSetting("dfw_width",d)))):(d=a("#wp-fullscreen-body").data("theme-width")||800,g.$editorContainer.width(d),g.$dfwTitle&&g.$dfwTitle.width(d-16),void deleteUserSetting("dfw_width"))},f.subscribe("show",function(){var b=a("#last-edit").text();b&&a("#wp-fullscreen-save input").attr("title",b)}),f.subscribe("showing",function(){m.addClass("wp-fullscreen-active"),g.$dfwWrap.addClass("wp-fullscreen-wrap"),g.$editorContainer.append(a("#wp-fullscreen-status")),g.$dfwTitle&&(g.$dfwTitle.after(''),g.$dfwWrap.prepend(g.$dfwTitle.addClass("wp-fullscreen-title"))),e.refreshButtons(),d(!0),a("#wpadminbar").hide(),h("hide"),e.bind_resize(),g.editor&&g.editor.execCommand("wpFullScreenOn"),e.dfwWidth(a("#wp-fullscreen-body").data("dfw-width")||800,!0),scrollTo(0,0)}),f.subscribe("shown",function(){g.visible=!0,g.editor&&!g.editor.isHidden()?g.editor.execCommand("wpAutoResize"):e.resizeTextarea("force")}),f.subscribe("hide",function(){n.unbind(".fullscreen"),g.$dfwTextarea.unbind(".wp-dfw-resize")}),f.subscribe("hiding",function(){m.removeClass("wp-fullscreen-active"),a("#wp-fullscreen-body").append(a("#wp-fullscreen-status")),g.$dfwTitle&&a("#wp-fullscreen-title-placeholder").before(g.$dfwTitle.removeClass("wp-fullscreen-title").css("width","")).remove(),g.$dfwWrap.removeClass("wp-fullscreen-wrap"),g.$editorContainer.css("width",""),g.$dfwTextarea.add("#"+g.id+"_ifr").height(g.origHeight),g.editor&&g.editor.execCommand("wpFullScreenOff"),d(!1),b.scrollTo(0,k),a("#wpadminbar").show()}),f.subscribe("hidden",function(){g.visible=!1}),e.refreshButtons=function(b){"html"===g.mode?(a("#wp-fullscreen-mode-bar").removeClass("wp-tmce-mode").addClass("wp-html-mode"),b?a("#wp-fullscreen-button-bar").fadeOut(150,function(){a(this).addClass("wp-html-mode").fadeIn(150)}):a("#wp-fullscreen-button-bar").addClass("wp-html-mode")):"tinymce"===g.mode&&(a("#wp-fullscreen-mode-bar").removeClass("wp-html-mode").addClass("wp-tmce-mode"),b?a("#wp-fullscreen-button-bar").fadeOut(150,function(){a(this).removeClass("wp-html-mode").fadeIn(150)}):a("#wp-fullscreen-button-bar").removeClass("wp-html-mode"))},e.ui={init:function(){var c;g.toolbar=c=a("#fullscreen-topbar"),g.$fullscreenFader=a("#fullscreen-fader"),g.hasTinymce="undefined"!=typeof tinymce,g.hasTinymce||a("#wp-fullscreen-mode-bar").hide(),n.keyup(function(a){var b,c=a.keyCode||a.charCode;g.visible&&(b=navigator.platform&&-1!==navigator.platform.indexOf("Mac")?a.ctrlKey:a.altKey,!b||61!=c&&107!=c&&187!=c||(e.dfwWidth(25),a.preventDefault()),!b||45!=c&&109!=c&&189!=c||(e.dfwWidth(-25),a.preventDefault()),b&&48==c&&(e.dfwWidth(0),a.preventDefault()))}),n.on("keydown.wp-fullscreen",function(a){27===a.which&&g.visible&&(e.off(),a.stopImmediatePropagation())}),c.on("mouseenter",function(){h("show")}).on("mouseleave",function(){h("hide")}),a("#wp-fullscreen-buttons").on("click.wp-fullscreen","button",function(a){var c=a.currentTarget.id?a.currentTarget.id.substr(6):null;if(g.editor&&"tinymce"===g.mode)switch(c){case"bold":g.editor.execCommand("Bold");break;case"italic":g.editor.execCommand("Italic");break;case"bullist":g.editor.execCommand("InsertUnorderedList");break;case"numlist":g.editor.execCommand("InsertOrderedList");break;case"link":g.editor.execCommand("WP_Link");break;case"unlink":g.editor.execCommand("unlink");break;case"image":g.editor.execCommand("mceImage");break;case"help":g.editor.execCommand("WP_Help");break;case"blockquote":g.editor.execCommand("mceBlockQuote")}else"link"===c&&b.wpLink&&b.wpLink.open();"wp-media-library"===c&&"undefined"!=typeof wp&&wp.media&&wp.media.editor&&wp.media.editor.open(g.id)})},fade:function(a,b,c){g.$fullscreenFader||e.ui.init(),(!a||f.publish(a))&&e.fade.In(g.$fullscreenFader,200,function(){b&&f.publish(b),e.fade.Out(g.$fullscreenFader,200,function(){c&&f.publish(c)})})}},e.fade={sensitivity:100,In:function(b,c,d,f){if(d=d||a.noop,c=c||400,f=f||!1,e.fade.transitions){if(b.is(":visible"))return b.addClass("fade-trigger"),b;b.show(),b.first().one(l,function(){d()}),setTimeout(function(){b.addClass("fade-trigger")},this.sensitivity)}else f&&b.stop(),b.css("opacity",1),b.first().fadeIn(c,d),b.length>1&&b.not(":first").fadeIn(c);return b},Out:function(b,c,d,f){return d=d||a.noop,c=c||400,f=f||!1,b.is(":visible")?(e.fade.transitions?(b.first().one(l,function(){b.hasClass("fade-trigger")||(b.hide(),d())}),setTimeout(function(){b.removeClass("fade-trigger")},this.sensitivity)):(f&&b.stop(),b.first().fadeOut(c,d),b.length>1&&b.not(":first").fadeOut(c)),b):b},transitions:function(){var a=document.documentElement.style;return"string"==typeof a.WebkitTransition||"string"==typeof a.MozTransition||"string"==typeof a.OTransition||"string"==typeof a.transition}()},e.bind_resize=function(){g.$dfwTextarea.on("keydown.wp-dfw-resize click.wp-dfw-resize paste.wp-dfw-resize",function(a){e.resizeTextarea(a)})},e.resizeTextarea=function(){var a=g.$dfwTextarea[0];a.scrollHeight>a.clientHeight&&(a.style.height=a.scrollHeight+50+"px")},b.wp=b.wp||{},b.wp.editor=b.wp.editor||{},b.wp.editor.fullscreen=e}(jQuery,window); \ No newline at end of file +!function(a,b){function c(){m.removeClass("wp-dfw-show-ui")}function d(b){g.$dfwWrap.parents().each(function(c,d){var e,f=a(d);return b?(d.style.position&&f.data("wp-dfw-css-position",d.style.position),f.css("position","static")):(e=f.data("wp-dfw-css-position"),e=e||"",f.css("position",e)),"BODY"===d.nodeName?!1:void 0})}var e,f,g,h,i,j,k=0,l="transitionend webkitTransitionEnd",m=a(document.body),n=a(document);j=function(){this.topics={},this.subscribe=function(a,b){return this.topics[a]||(this.topics[a]=[]),this.topics[a].push(b),b},this.unsubscribe=function(a,b){var c,d,e=this.topics[a];if(!e)return b||[];if(b){for(c=0,d=e.length;d>c;c++)b==e[c]&&e.splice(c,1);return b}return this.topics[a]=[],e},this.publish=function(a,b){var c,d,e,f=this.topics[a];if(f){for(b=b||[],c=0,d=f.length;d>c;c++)e=f[c].apply(null,b)===!1||e;return!e}}},e={},f=e.pubsub=new j,g=e.settings={visible:!1,mode:"tinymce",id:"",title_id:"",timer:0,toolbar_shown:!1},h=e.toggleUI=function(a){clearTimeout(i),m.hasClass("wp-dfw-show-ui")||m.addClass("wp-dfw-show-ui"),"hide"===a&&(i=setTimeout(c,2e3))},e.on=function(){var c,d,f;if(!g.visible){if(g.$fullscreenFader||e.ui.init(),"object"==typeof b.wp_fullscreen_settings&&a.extend(g,b.wp_fullscreen_settings),c=g.id||b.wpActiveEditor,!c){if(!g.hasTinymce)return;c=tinymce.activeEditor.id}g.id=c,d=g.$dfwWrap=a("#wp-"+c+"-wrap"),d.length&&(g.$dfwTextarea=a("#"+c),g.$editorContainer=d.find(".wp-editor-container"),k=n.scrollTop(),g.hasTinymce&&(g.editor=tinymce.get(c)),g.editor&&!g.editor.isHidden()?(g.origHeight=a("#"+c+"_ifr").height(),g.mode="tinymce"):(g.origHeight=g.$dfwTextarea.height(),g.mode="html"),f="undefined"==typeof b.adminpage||"post-php"!==b.adminpage&&"post-new-php"!==b.adminpage?c+"-title":"title",g.$dfwTitle=a("#"+f),g.$dfwTitle.length||(g.$dfwTitle=null),e.ui.fade("show","showing","shown"))}},e.off=function(){g.visible&&e.ui.fade("hide","hiding","hidden")},e.switchmode=function(a){var b=g.mode;return a&&g.visible&&g.hasTinymce&&"undefined"!=typeof switchEditors?b==a?b:("tinymce"!==a||g.editor||(g.editor=tinymce.get(g.id),!g.editor&&"undefined"!=typeof tinyMCEPreInit&&tinyMCEPreInit.mceInit&&tinyMCEPreInit.mceInit[g.id]&&(tinyMCEPreInit.mceInit[g.id].wp_fullscreen=!0)),g.mode=a,switchEditors.go(g.id,a),e.refreshButtons(!0),"html"===a&&setTimeout(e.resizeTextarea,200),a):b},e.save=function(){var c=a("#hiddenaction"),d=c.val(),e=a("#wp-fullscreen-save .spinner"),f=a("#wp-fullscreen-save .wp-fullscreen-saved-message"),h=a("#wp-fullscreen-save .wp-fullscreen-error-message");e.show(),h.hide(),c.val("wp-fullscreen-save-post"),g.editor&&!g.editor.isHidden()&&g.editor.save(),a.ajax({url:b.ajaxurl,type:"post",data:a("form#post").serialize(),dataType:"json"}).done(function(b){e.hide(),b&&b.success?(f.show(),setTimeout(function(){f.fadeOut(300)},3e3),b.data&&b.data.last_edited&&a("#wp-fullscreen-save input").attr("title",b.data.last_edited)):h.show()}).fail(function(){e.hide(),h.show()}),c.val(d)},e.dfwWidth=function(b,c){var d;return b?(c?d=b:(d=g.$editorContainer.width(),d+=b),void(200>d||d>1200||(g.$editorContainer.width(d),g.$dfwTitle&&g.$dfwTitle.width(d-16),setUserSetting("dfw_width",d)))):(d=a("#wp-fullscreen-body").data("theme-width")||800,g.$editorContainer.width(d),g.$dfwTitle&&g.$dfwTitle.width(d-16),void deleteUserSetting("dfw_width"))},f.subscribe("show",function(){var b=a("#last-edit").text();b&&a("#wp-fullscreen-save input").attr("title",b)}),f.subscribe("showing",function(){m.addClass("wp-fullscreen-active"),g.$dfwWrap.addClass("wp-fullscreen-wrap"),g.$editorContainer.append(a("#wp-fullscreen-status")),g.$dfwTitle&&(g.$dfwTitle.after(''),g.$dfwWrap.prepend(g.$dfwTitle.addClass("wp-fullscreen-title"))),e.refreshButtons(),d(!0),a("#wpadminbar").hide(),h("hide"),e.bind_resize(),g.editor&&g.editor.execCommand("wpFullScreenOn"),e.dfwWidth(a("#wp-fullscreen-body").data("dfw-width")||800,!0),scrollTo(0,0)}),f.subscribe("shown",function(){g.visible=!0,g.editor&&!g.editor.isHidden()?g.editor.execCommand("wpAutoResize"):e.resizeTextarea("force")}),f.subscribe("hide",function(){n.unbind(".fullscreen"),g.$dfwTextarea.unbind(".wp-dfw-resize")}),f.subscribe("hiding",function(){m.removeClass("wp-fullscreen-active"),a("#wp-fullscreen-body").append(a("#wp-fullscreen-status")),g.$dfwTitle&&a("#wp-fullscreen-title-placeholder").before(g.$dfwTitle.removeClass("wp-fullscreen-title").css("width","")).remove(),g.$dfwWrap.removeClass("wp-fullscreen-wrap"),g.$editorContainer.css("width",""),g.$dfwTextarea.add("#"+g.id+"_ifr").height(g.origHeight),g.editor&&g.editor.execCommand("wpFullScreenOff"),d(!1),b.scrollTo(0,k),a("#wpadminbar").show()}),f.subscribe("hidden",function(){g.visible=!1}),e.refreshButtons=function(b){"html"===g.mode?(a("#wp-fullscreen-mode-bar").removeClass("wp-tmce-mode").addClass("wp-html-mode"),b?a("#wp-fullscreen-button-bar").fadeOut(150,function(){a(this).addClass("wp-html-mode").fadeIn(150)}):a("#wp-fullscreen-button-bar").addClass("wp-html-mode")):"tinymce"===g.mode&&(a("#wp-fullscreen-mode-bar").removeClass("wp-html-mode").addClass("wp-tmce-mode"),b?a("#wp-fullscreen-button-bar").fadeOut(150,function(){a(this).removeClass("wp-html-mode").fadeIn(150)}):a("#wp-fullscreen-button-bar").removeClass("wp-html-mode"))},e.ui={init:function(){var c;g.toolbar=c=a("#fullscreen-topbar"),g.$fullscreenFader=a("#fullscreen-fader"),g.hasTinymce="undefined"!=typeof tinymce,g.hasTinymce||a("#wp-fullscreen-mode-bar").hide(),n.keyup(function(a){var b,c=a.keyCode||a.charCode;g.visible&&(b=navigator.platform&&-1!==navigator.platform.indexOf("Mac")?a.ctrlKey:a.altKey,!b||61!==c&&107!==c&&187!==c||(e.dfwWidth(25),a.preventDefault()),!b||45!==c&&109!==c&&189!==c||(e.dfwWidth(-25),a.preventDefault()),b&&48===c&&(e.dfwWidth(0),a.preventDefault()))}),n.on("keydown.wp-fullscreen",function(a){27===a.which&&g.visible&&(e.off(),a.stopImmediatePropagation())}),c.on("mouseenter",function(){h("show")}).on("mouseleave",function(){h("hide")}),a("#wp-fullscreen-buttons").on("click.wp-fullscreen","button",function(a){var c=a.currentTarget.id?a.currentTarget.id.substr(6):null;if(g.editor&&"tinymce"===g.mode)switch(c){case"bold":g.editor.execCommand("Bold");break;case"italic":g.editor.execCommand("Italic");break;case"bullist":g.editor.execCommand("InsertUnorderedList");break;case"numlist":g.editor.execCommand("InsertOrderedList");break;case"link":g.editor.execCommand("WP_Link");break;case"unlink":g.editor.execCommand("unlink");break;case"image":g.editor.execCommand("mceImage");break;case"help":g.editor.execCommand("WP_Help");break;case"blockquote":g.editor.execCommand("mceBlockQuote")}else"link"===c&&b.wpLink&&b.wpLink.open();"wp-media-library"===c&&"undefined"!=typeof wp&&wp.media&&wp.media.editor&&wp.media.editor.open(g.id)})},fade:function(a,b,c){g.$fullscreenFader||e.ui.init(),(!a||f.publish(a))&&e.fade.In(g.$fullscreenFader,200,function(){b&&f.publish(b),e.fade.Out(g.$fullscreenFader,200,function(){c&&f.publish(c)})})}},e.fade={sensitivity:100,In:function(b,c,d,f){if(d=d||a.noop,c=c||400,f=f||!1,e.fade.transitions){if(b.is(":visible"))return b.addClass("fade-trigger"),b;b.show(),b.first().one(l,function(){d()}),setTimeout(function(){b.addClass("fade-trigger")},this.sensitivity)}else f&&b.stop(),b.css("opacity",1),b.first().fadeIn(c,d),b.length>1&&b.not(":first").fadeIn(c);return b},Out:function(b,c,d,f){return d=d||a.noop,c=c||400,f=f||!1,b.is(":visible")?(e.fade.transitions?(b.first().one(l,function(){b.hasClass("fade-trigger")||(b.hide(),d())}),setTimeout(function(){b.removeClass("fade-trigger")},this.sensitivity)):(f&&b.stop(),b.first().fadeOut(c,d),b.length>1&&b.not(":first").fadeOut(c)),b):b},transitions:function(){var a=document.documentElement.style;return"string"==typeof a.WebkitTransition||"string"==typeof a.MozTransition||"string"==typeof a.OTransition||"string"==typeof a.transition}()},e.bind_resize=function(){g.$dfwTextarea.on("keydown.wp-dfw-resize click.wp-dfw-resize paste.wp-dfw-resize",function(){e.resizeTextarea()})},e.resizeTextarea=function(){var a=g.$dfwTextarea[0];a.scrollHeight>a.clientHeight&&(a.style.height=a.scrollHeight+50+"px")},b.wp=b.wp||{},b.wp.editor=b.wp.editor||{},b.wp.editor.fullscreen=e}(jQuery,window); \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/wordpress/plugin.js b/wp-includes/js/tinymce/plugins/wordpress/plugin.js index 4eb4f7423b..743ad86c88 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/plugin.js +++ b/wp-includes/js/tinymce/plugins/wordpress/plugin.js @@ -1,4 +1,4 @@ -/* global tinymce, autosave, getUserSetting, setUserSetting, switchEditors */ +/* global tinymce, getUserSetting, setUserSetting, switchEditors */ tinymce.PluginManager.add( 'wordpress', function( editor ) { var DOM = tinymce.DOM, wpAdvButton, modKey, style, last = 0; @@ -127,25 +127,25 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { }); // Make sure the "more" tag is in a separate paragraph - editor.on( 'PreProcess', function( event ) { - var more; + editor.on( 'PreProcess', function( event ) { + var more; - if ( event.save ) { - more = editor.dom.select( 'img.wp-more-tag', event.node ); + if ( event.save ) { + more = editor.dom.select( 'img.wp-more-tag', event.node ); - if ( more.length ) { - tinymce.each( more, function( node ) { - var parent = node.parentNode, p; + if ( more.length ) { + tinymce.each( more, function( node ) { + var parent = node.parentNode, p; - if ( parent.nodeName === 'P' && parent.childNodes.length > 1 ) { - p = editor.dom.create('p'); - parent.parentNode.insertBefore( p, parent ); - p.appendChild( node ); - } - }); - } - } - }); + if ( parent.nodeName === 'P' && parent.childNodes.length > 1 ) { + p = editor.dom.create('p'); + parent.parentNode.insertBefore( p, parent ); + p.appendChild( node ); + } + }); + } + } + }); // Register commands editor.addCommand( 'WP_More', function( tag ) {