forked from laysense/laysite
Prepare LaySite 1.5.0 canvas and publishing improvements
This commit is contained in:
+30
-1
@@ -36,6 +36,29 @@ jQuery(function ($) {
|
||||
.attr('href', id && this.value !== 'hidden' ? '/admin/pages/layout--' + kind + '-' + id : '/admin/new-page?type=' + kind);
|
||||
});
|
||||
});
|
||||
$('[data-palette-picker]').each(function () {
|
||||
const $picker = $(this);
|
||||
const $select = $picker.find('select');
|
||||
const $details = $picker.find('details');
|
||||
const $options = $picker.find('[data-palette-option]');
|
||||
function updatePalette() {
|
||||
const $selected = $options.filter((_, option) => option.dataset.paletteOption === $select.val());
|
||||
$options.attr('aria-pressed', 'false');
|
||||
$selected.attr('aria-pressed', 'true');
|
||||
$picker.find('[data-palette-current]').empty().append($selected.children().clone());
|
||||
}
|
||||
$select.on('change.palettePicker', updatePalette).prop('hidden', true);
|
||||
$details.prop('hidden', false).on('click', '[data-palette-option]', function () {
|
||||
$select.val(this.dataset.paletteOption).trigger('change');
|
||||
$details.prop('open', false).find('summary').trigger('focus');
|
||||
}).on('keydown', (event) => {
|
||||
if (event.key === 'Escape' && $details.prop('open')) {
|
||||
event.stopPropagation();
|
||||
$details.prop('open', false).find('summary').trigger('focus');
|
||||
}
|
||||
});
|
||||
updatePalette();
|
||||
});
|
||||
$('[data-new-page-type]').on('change', function () {
|
||||
const ordinary = this.value === 'page';
|
||||
$(this.form).find('[data-new-page-slug]').prop('hidden', !ordinary)
|
||||
@@ -89,7 +112,7 @@ jQuery(function ($) {
|
||||
};
|
||||
|
||||
function clearSavedStatus() {
|
||||
$('[data-save-confirmation]').prop('hidden', true);
|
||||
$('[data-save-confirmation], [data-page-save-feedback]').prop('hidden', true);
|
||||
}
|
||||
|
||||
if (document.querySelector('[data-save-confirmation]')) {
|
||||
@@ -181,6 +204,12 @@ jQuery(function ($) {
|
||||
contentType: multipart ? false : 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
dataType: 'json'
|
||||
}).done(function (response) {
|
||||
if ($form.is('[data-save-inline]') && response.saved === true) {
|
||||
$form.triggerHandler('studio:saved', [response, submitter]);
|
||||
finish();
|
||||
if (document.activeElement === document.body) submitter?.focus({preventScroll: true});
|
||||
return;
|
||||
}
|
||||
if (response.redirect) {
|
||||
$form.triggerHandler('studio:saved');
|
||||
window.location.assign(response.redirect);
|
||||
|
||||
Reference in New Issue
Block a user