Widgets:
- Fix dragging to the bottom of the screen on the Widgets and Dashboard screens. - Fix hiding of the dragged widget when dragging over a closed sidebar. - Fix the admin menu position and scrolling when all widget containers are folded. Fixes #32094 for 4.2. Built from https://develop.svn.wordpress.org/branches/4.2@33313 git-svn-id: http://core.svn.wordpress.org/branches/4.2@33285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
72a321196e
commit
020f33ba74
|
@ -350,6 +350,10 @@ div#widgets-right .closed .widgets-sortables {
|
|||
display: none;
|
||||
}
|
||||
|
||||
.js .widgets-holder-wrap.closed .widget.ui-sortable-helper {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Hide Widget Settings by Default */
|
||||
.widget-inside,
|
||||
.widget-description {
|
||||
|
@ -506,6 +510,10 @@ div#widgets-right .widget-top:hover,
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
#available-widgets .widget.ui-draggable-dragging .widget-top {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
/* =Media Queries
|
||||
-------------------------------------------------------------- */
|
||||
|
||||
|
|
|
@ -350,6 +350,10 @@ div#widgets-right .closed .widgets-sortables {
|
|||
display: none;
|
||||
}
|
||||
|
||||
.js .widgets-holder-wrap.closed .widget.ui-sortable-helper {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Hide Widget Settings by Default */
|
||||
.widget-inside,
|
||||
.widget-description {
|
||||
|
@ -506,6 +510,10 @@ div#widgets-right .widget-top:hover,
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
#available-widgets .widget.ui-draggable-dragging .widget-top {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
/* =Media Queries
|
||||
-------------------------------------------------------------- */
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -860,7 +860,7 @@ $(document).ready( function() {
|
|||
window.wpResponsive.init();
|
||||
setPinMenu();
|
||||
|
||||
$document.on( 'wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu', setPinMenu );
|
||||
$document.on( 'wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu', setPinMenu );
|
||||
});
|
||||
|
||||
// Fire a custom jQuery event at the end of window resize
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -124,7 +124,7 @@ jQuery(document).ready( function($) {
|
|||
};
|
||||
quickPressLoad();
|
||||
|
||||
$( '.meta-box-sortables' ).sortable( 'option', 'containment', 'document' );
|
||||
$( '.meta-box-sortables' ).sortable( 'option', 'containment', '#wpwrap' );
|
||||
|
||||
function autoResizeTextarea() {
|
||||
if ( document.documentMode && document.documentMode < 9 ) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){function b(){if(!(document.documentMode&&document.documentMode<9)){a("body").append('<div class="quick-draft-textarea-clone" style="display: none;"></div>');var b=a(".quick-draft-textarea-clone"),c=a("#content"),d=c.height(),e=a(window).height()-100;b.css({"font-family":c.css("font-family"),"font-size":c.css("font-size"),"line-height":c.css("line-height"),"padding-bottom":c.css("paddingBottom"),"padding-left":c.css("paddingLeft"),"padding-right":c.css("paddingRight"),"padding-top":c.css("paddingTop"),"white-space":"pre-wrap","word-wrap":"break-word",display:"none"}),c.on("focus input propertychange",function(){var f=a(this),g=f.val()+" ",h=b.css("width",f.css("width")).text(g).outerHeight()+2;c.css("overflow-y","auto"),h===d||h>=e&&d>=e||(d=h>e?e:h,c.css("overflow","hidden"),f.css("height",d+"px"))})}}var c,d=a("#welcome-panel"),e=a("#wp_welcome_panel-hide");c=function(b){a.post(ajaxurl,{action:"update-welcome-panel",visible:b,welcomepanelnonce:a("#welcomepanelnonce").val()})},d.hasClass("hidden")&&e.prop("checked")&&d.removeClass("hidden"),a(".welcome-panel-close, .welcome-panel-dismiss a",d).click(function(b){b.preventDefault(),d.addClass("hidden"),c(0),a("#wp_welcome_panel-hide").prop("checked",!1)}),e.click(function(){d.toggleClass("hidden",!this.checked),c(this.checked?1:0)}),ajaxWidgets=["dashboard_primary"],ajaxPopulateWidgets=function(b){function c(b,c){var d,e=a("#"+c+" div.inside:visible").find(".widget-loading");e.length&&(d=e.parent(),setTimeout(function(){d.load(ajaxurl+"?action=dashboard-widgets&widget="+c+"&pagenow="+pagenow,"",function(){d.hide().slideDown("normal",function(){a(this).css("display","")})})},500*b))}b?(b=b.toString(),-1!==a.inArray(b,ajaxWidgets)&&c(0,b)):a.each(ajaxWidgets,c)},ajaxPopulateWidgets(),postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets}),quickPressLoad=function(){var c,d=a("#quickpost-action");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!1),c=a("#quick-press").submit(function(){function b(){var b=a(".drafts ul li").first();b.css("background","#fffbe5"),setTimeout(function(){b.css("background","none")},1e3)}return a("#dashboard_quick_press #publishing-action .spinner").show(),a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!0),a.post(c.attr("action"),c.serializeArray(),function(c){a("#dashboard_quick_press .inside").html(c),a("#quick-press").removeClass("initial-form"),quickPressLoad(),b(),a("#title").focus()}),!1}),a("#publish").click(function(){d.val("post-quickpress-publish")}),a("#title, #tags-input, #content").each(function(){var b=a(this),c=a("#"+this.id+"-prompt-text");""===this.value&&c.removeClass("screen-reader-text"),c.click(function(){a(this).addClass("screen-reader-text"),b.focus()}),b.blur(function(){""===this.value&&c.removeClass("screen-reader-text")}),b.focus(function(){c.addClass("screen-reader-text")})}),a("#quick-press").on("click focusin",function(){wpActiveEditor="content"}),b()},quickPressLoad(),a(".meta-box-sortables").sortable("option","containment","document")});
|
||||
var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){function b(){if(!(document.documentMode&&document.documentMode<9)){a("body").append('<div class="quick-draft-textarea-clone" style="display: none;"></div>');var b=a(".quick-draft-textarea-clone"),c=a("#content"),d=c.height(),e=a(window).height()-100;b.css({"font-family":c.css("font-family"),"font-size":c.css("font-size"),"line-height":c.css("line-height"),"padding-bottom":c.css("paddingBottom"),"padding-left":c.css("paddingLeft"),"padding-right":c.css("paddingRight"),"padding-top":c.css("paddingTop"),"white-space":"pre-wrap","word-wrap":"break-word",display:"none"}),c.on("focus input propertychange",function(){var f=a(this),g=f.val()+" ",h=b.css("width",f.css("width")).text(g).outerHeight()+2;c.css("overflow-y","auto"),h===d||h>=e&&d>=e||(d=h>e?e:h,c.css("overflow","hidden"),f.css("height",d+"px"))})}}var c,d=a("#welcome-panel"),e=a("#wp_welcome_panel-hide");c=function(b){a.post(ajaxurl,{action:"update-welcome-panel",visible:b,welcomepanelnonce:a("#welcomepanelnonce").val()})},d.hasClass("hidden")&&e.prop("checked")&&d.removeClass("hidden"),a(".welcome-panel-close, .welcome-panel-dismiss a",d).click(function(b){b.preventDefault(),d.addClass("hidden"),c(0),a("#wp_welcome_panel-hide").prop("checked",!1)}),e.click(function(){d.toggleClass("hidden",!this.checked),c(this.checked?1:0)}),ajaxWidgets=["dashboard_primary"],ajaxPopulateWidgets=function(b){function c(b,c){var d,e=a("#"+c+" div.inside:visible").find(".widget-loading");e.length&&(d=e.parent(),setTimeout(function(){d.load(ajaxurl+"?action=dashboard-widgets&widget="+c+"&pagenow="+pagenow,"",function(){d.hide().slideDown("normal",function(){a(this).css("display","")})})},500*b))}b?(b=b.toString(),-1!==a.inArray(b,ajaxWidgets)&&c(0,b)):a.each(ajaxWidgets,c)},ajaxPopulateWidgets(),postboxes.add_postbox_toggles(pagenow,{pbshow:ajaxPopulateWidgets}),quickPressLoad=function(){var c,d=a("#quickpost-action");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!1),c=a("#quick-press").submit(function(){function b(){var b=a(".drafts ul li").first();b.css("background","#fffbe5"),setTimeout(function(){b.css("background","none")},1e3)}return a("#dashboard_quick_press #publishing-action .spinner").show(),a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').prop("disabled",!0),a.post(c.attr("action"),c.serializeArray(),function(c){a("#dashboard_quick_press .inside").html(c),a("#quick-press").removeClass("initial-form"),quickPressLoad(),b(),a("#title").focus()}),!1}),a("#publish").click(function(){d.val("post-quickpress-publish")}),a("#title, #tags-input, #content").each(function(){var b=a(this),c=a("#"+this.id+"-prompt-text");""===this.value&&c.removeClass("screen-reader-text"),c.click(function(){a(this).addClass("screen-reader-text"),b.focus()}),b.blur(function(){""===this.value&&c.removeClass("screen-reader-text")}),b.focus(function(){c.addClass("screen-reader-text")})}),a("#quick-press").on("click focusin",function(){wpActiveEditor="content"}),b()},quickPressLoad(),a(".meta-box-sortables").sortable("option","containment","#wpwrap")});
|
|
@ -1,6 +1,7 @@
|
|||
/*global ajaxurl, isRtl */
|
||||
var wpWidgets;
|
||||
(function($) {
|
||||
var $document = $( document );
|
||||
|
||||
wpWidgets = {
|
||||
|
||||
|
@ -22,10 +23,13 @@ wpWidgets = {
|
|||
} else {
|
||||
$wrap.addClass('closed');
|
||||
}
|
||||
|
||||
$document.triggerHandler( 'wp-pin-menu' );
|
||||
});
|
||||
|
||||
$('#widgets-left .sidebar-name').click( function() {
|
||||
$(this).closest('.widgets-holder-wrap').toggleClass('closed');
|
||||
$document.triggerHandler( 'wp-pin-menu' );
|
||||
});
|
||||
|
||||
$(document.body).bind('click.widgets-toggle', function(e) {
|
||||
|
@ -89,7 +93,7 @@ wpWidgets = {
|
|||
distance: 2,
|
||||
helper: 'clone',
|
||||
zIndex: 100,
|
||||
containment: 'document',
|
||||
containment: '#wpwrap',
|
||||
start: function( event, ui ) {
|
||||
var chooser = $(this).find('.widgets-chooser');
|
||||
|
||||
|
@ -119,7 +123,7 @@ wpWidgets = {
|
|||
handle: '> .widget-top > .widget-title',
|
||||
cursor: 'move',
|
||||
distance: 2,
|
||||
containment: 'document',
|
||||
containment: '#wpwrap',
|
||||
start: function( event, ui ) {
|
||||
var height, $this = $(this),
|
||||
$wrap = $this.parent(),
|
||||
|
@ -174,7 +178,7 @@ wpWidgets = {
|
|||
|
||||
wpWidgets.save( $widget, 0, 0, 1 );
|
||||
$widget.find('input.add_new').val('');
|
||||
$( document ).trigger( 'widget-added', [ $widget ] );
|
||||
$document.trigger( 'widget-added', [ $widget ] );
|
||||
}
|
||||
|
||||
$sidebar = $widget.parent();
|
||||
|
@ -381,7 +385,7 @@ wpWidgets = {
|
|||
if ( r && r.length > 2 ) {
|
||||
$( 'div.widget-content', widget ).html( r );
|
||||
wpWidgets.appendTitle( widget );
|
||||
$( document ).trigger( 'widget-updated', [ widget ] );
|
||||
$document.trigger( 'widget-updated', [ widget ] );
|
||||
}
|
||||
}
|
||||
if ( order ) {
|
||||
|
@ -446,7 +450,7 @@ wpWidgets = {
|
|||
// No longer "new" widget
|
||||
widget.find( 'input.add_new' ).val('');
|
||||
|
||||
$( document ).trigger( 'widget-added', [ widget ] );
|
||||
$document.trigger( 'widget-added', [ widget ] );
|
||||
|
||||
/*
|
||||
* Check if any part of the sidebar is visible in the viewport. If it is, don't scroll.
|
||||
|
@ -489,6 +493,6 @@ wpWidgets = {
|
|||
}
|
||||
};
|
||||
|
||||
$(document).ready( function(){ wpWidgets.init(); } );
|
||||
$document.ready( function(){ wpWidgets.init(); } );
|
||||
|
||||
})(jQuery);
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue