Update to Drupal 8.2.6. For more information, see https://www.drupal.org/project/drupal/releases/8.2.6
This commit is contained in:
parent
db56c09587
commit
f1e72395cb
588 changed files with 26857 additions and 2777 deletions
|
|
@ -11,6 +11,10 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
// The minimum width to use body displace needs to match the width at which
|
||||
// the tray will be %100 width. @see outside_in.module.css
|
||||
var minDisplaceWidth = 768;
|
||||
|
||||
/**
|
||||
* The edge of the screen that the dialog should appear on.
|
||||
*
|
||||
|
|
@ -18,7 +22,7 @@
|
|||
*/
|
||||
var edge = document.documentElement.dir === 'rtl' ? 'left' : 'right';
|
||||
|
||||
var $mainCanvasWrapper = $('#main-canvas-wrapper');
|
||||
var $mainCanvasWrapper = $('[data-offcanvas-main-canvas]');
|
||||
|
||||
/**
|
||||
* Resets the size of the dialog.
|
||||
|
|
@ -47,7 +51,7 @@
|
|||
|
||||
$element
|
||||
.dialog('option', adjustedOptions)
|
||||
.trigger('dialogContentResize.outsidein');
|
||||
.trigger('dialogContentResize.offcanvas');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -81,6 +85,9 @@
|
|||
* The event triggered.
|
||||
*/
|
||||
function bodyPadding(event) {
|
||||
if ($('body').outerWidth() < minDisplaceWidth) {
|
||||
return;
|
||||
}
|
||||
var $element = event.data.$element;
|
||||
var $widget = $element.dialog('widget');
|
||||
|
||||
|
|
@ -100,26 +107,28 @@
|
|||
$('.ui-dialog-offcanvas, .ui-dialog-offcanvas .ui-dialog-titlebar').toggleClass('ui-dialog-empty-title', !settings.title);
|
||||
|
||||
$element
|
||||
.on('dialogresize.outsidein', eventData, debounce(bodyPadding, 100))
|
||||
.on('dialogContentResize.outsidein', eventData, handleDialogResize)
|
||||
.trigger('dialogresize.outsidein');
|
||||
.on('dialogresize.offcanvas', eventData, debounce(bodyPadding, 100))
|
||||
.on('dialogContentResize.offcanvas', eventData, handleDialogResize)
|
||||
.on('dialogContentResize.offcanvas', eventData, debounce(bodyPadding, 100))
|
||||
.trigger('dialogresize.offcanvas');
|
||||
|
||||
$element.dialog('widget').attr('data-offset-' + edge, '');
|
||||
|
||||
$(window)
|
||||
.on('resize.outsidein scroll.outsidein', eventData, debounce(resetSize, 100))
|
||||
.trigger('resize.outsidein');
|
||||
.on('resize.offcanvas scroll.offcanvas', eventData, debounce(resetSize, 100))
|
||||
.trigger('resize.offcanvas');
|
||||
}
|
||||
},
|
||||
'dialog:beforecreate': function (event, dialog, $element, settings) {
|
||||
if ($element.is('#drupal-offcanvas')) {
|
||||
$('body').addClass('js-tray-open');
|
||||
// @see http://api.jqueryui.com/position/
|
||||
settings.position = {
|
||||
my: 'left top',
|
||||
at: edge + ' top',
|
||||
of: window
|
||||
};
|
||||
settings.dialogClass = 'ui-dialog-offcanvas';
|
||||
settings.dialogClass += ' ui-dialog-offcanvas';
|
||||
// Applies initial height to dialog based on window height.
|
||||
// See http://api.jqueryui.com/dialog for all dialog options.
|
||||
settings.height = $(window).height();
|
||||
|
|
@ -127,8 +136,9 @@
|
|||
},
|
||||
'dialog:beforeclose': function (event, dialog, $element) {
|
||||
if ($element.is('#drupal-offcanvas')) {
|
||||
$(document).off('.outsidein');
|
||||
$(window).off('.outsidein');
|
||||
$('body').removeClass('js-tray-open');
|
||||
$(document).off('.offcanvas');
|
||||
$(window).off('.offcanvas');
|
||||
$mainCanvasWrapper.css('padding-' + edge, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@
|
|||
|
||||
var blockConfigureSelector = '[data-outside-in-edit]';
|
||||
var toggleEditSelector = '[data-drupal-outsidein="toggle"]';
|
||||
var itemsToToggleSelector = '#main-canvas, #toolbar-bar, [data-drupal-outsidein="editable"] a, [data-drupal-outsidein="editable"] button';
|
||||
var itemsToToggleSelector = '[data-offcanvas-main-canvas], #toolbar-bar, [data-drupal-outsidein="editable"] a, [data-drupal-outsidein="editable"] button';
|
||||
var contextualItemsSelector = '[data-contextual-id] a, [data-contextual-id] button';
|
||||
var quickEditItemSelector = '[data-quickedit-entity-id]';
|
||||
|
||||
/**
|
||||
* Reacts to contextual links being added.
|
||||
|
|
@ -36,9 +37,20 @@
|
|||
if (!isInEditMode()) {
|
||||
$(toggleEditSelector).trigger('click.outsidein');
|
||||
}
|
||||
// Always disable QuickEdit regardless of whether "EditMode" was just enabled.
|
||||
disableQuickEdit();
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('keyup.outsidein', function (e) {
|
||||
if (isInEditMode() && e.keyCode === 27) {
|
||||
Drupal.announce(
|
||||
Drupal.t('Exited edit mode.')
|
||||
);
|
||||
toggleEditMode();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets all items that should be toggled with class during edit mode.
|
||||
*
|
||||
|
|
@ -88,11 +100,21 @@
|
|||
* Close any active toolbar tray before entering edit mode.
|
||||
*/
|
||||
function closeToolbarTrays() {
|
||||
$('#toolbar-bar')
|
||||
.find('.toolbar-tab')
|
||||
.not('.contextual-toolbar-tab')
|
||||
.has('.toolbar-tray.is-active')
|
||||
.find('.toolbar-item').click();
|
||||
$(Drupal.toolbar.models.toolbarModel.get('activeTab')).trigger('click');
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the QuickEdit module editor if open.
|
||||
*/
|
||||
function disableQuickEdit() {
|
||||
$('.quickedit-toolbar button.action-cancel').trigger('click');
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes/removes offcanvas.
|
||||
*/
|
||||
function closeOffCanvas() {
|
||||
$('.ui-dialog-offcanvas .ui-dialog-titlebar-close').trigger('click');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -113,7 +135,7 @@
|
|||
$editables = $('[data-drupal-outsidein="editable"]').once('outsidein');
|
||||
if ($editables.length) {
|
||||
// Use event capture to prevent clicks on links.
|
||||
document.querySelector('#main-canvas').addEventListener('click', preventClick, true);
|
||||
document.querySelector('[data-offcanvas-main-canvas]').addEventListener('click', preventClick, true);
|
||||
|
||||
// When a click occurs try and find the outside-in edit link
|
||||
// and click it.
|
||||
|
|
@ -124,8 +146,21 @@
|
|||
if ($(e.target).closest('.contextual').length || !localStorage.getItem('Drupal.contextualToolbar.isViewing')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(e.currentTarget).find(blockConfigureSelector).trigger('click');
|
||||
disableQuickEdit();
|
||||
});
|
||||
$(quickEditItemSelector)
|
||||
.not(contextualItemsSelector)
|
||||
.on('click.outsidein', function (e) {
|
||||
// For all non-contextual links or the contextual QuickEdit link close the off-canvas tray.
|
||||
if (!$(e.target).parent().hasClass('contextual') || $(e.target).parent().hasClass('quickedit')) {
|
||||
closeOffCanvas();
|
||||
}
|
||||
// Do not trigger if target is quick edit link to avoid loop.
|
||||
if ($(e.target).parent().hasClass('contextual') || $(e.target).parent().hasClass('quickedit')) {
|
||||
return;
|
||||
}
|
||||
$(e.currentTarget).find('li.quickedit a').trigger('click');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -133,13 +168,14 @@
|
|||
else {
|
||||
$editables = $('[data-drupal-outsidein="editable"]').removeOnce('outsidein');
|
||||
if ($editables.length) {
|
||||
document.querySelector('#main-canvas').removeEventListener('click', preventClick, true);
|
||||
document.querySelector('[data-offcanvas-main-canvas]').removeEventListener('click', preventClick, true);
|
||||
$editables.off('.outsidein');
|
||||
$(quickEditItemSelector).off('.outsidein');
|
||||
}
|
||||
|
||||
$editButton.text(Drupal.t('Edit'));
|
||||
// Close/remove offcanvas.
|
||||
$('.ui-dialog-offcanvas .ui-dialog-titlebar-close').trigger('click');
|
||||
closeOffCanvas();
|
||||
disableQuickEdit();
|
||||
}
|
||||
getItemsToToggle().toggleClass('js-outside-in-edit-mode', editMode);
|
||||
$('.edit-mode-inactive').toggleClass('visually-hidden', editMode);
|
||||
|
|
@ -177,7 +213,7 @@
|
|||
|
||||
var search = Drupal.ajax.WRAPPER_FORMAT + '=drupal_dialog';
|
||||
var replace = Drupal.ajax.WRAPPER_FORMAT + '=drupal_dialog_offcanvas';
|
||||
// Loop through all Ajax links and change the format to offcanvas when
|
||||
// Loop through all Ajax links and change the format to dialog-offcanvas when
|
||||
// needed.
|
||||
Drupal.ajax.instances
|
||||
.filter(function (instance) {
|
||||
|
|
@ -210,8 +246,9 @@
|
|||
if ($element.is('#drupal-offcanvas')) {
|
||||
$('body .outside-in-active-editable').removeClass('outside-in-active-editable');
|
||||
var $activeElement = $('#' + settings.outsideInActiveEditableId);
|
||||
if ($activeElement) {
|
||||
if ($activeElement.length) {
|
||||
$activeElement.addClass('outside-in-active-editable');
|
||||
settings.dialogClass += ' ui-dialog-outside-in';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Reference in a new issue