Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/block-editor/src/components/block-lock/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ export default function BlockLockModal( { clientId, onClose } ) {
const isAllChecked = Object.values( lock ).every( Boolean );
const isMixed = Object.values( lock ).some( Boolean ) && ! isAllChecked;

const isDirty =
lock.move !== isMoveLocked ||
lock.remove !== isRemoveLocked ||
( allowsEditLocking && lock.edit !== isEditLocked ) ||
( hasTemplateLock && applyTemplateLock !== !! templateLock );

return (
<Modal
title={ sprintf(
Expand All @@ -90,6 +96,9 @@ export default function BlockLockModal( { clientId, onClose } ) {
<form
onSubmit={ ( event ) => {
event.preventDefault();
if ( ! isDirty ) {
return;
}
updateBlockAttributes( [ clientId ], {
lock,
templateLock: applyTemplateLock
Expand Down Expand Up @@ -224,6 +233,8 @@ export default function BlockLockModal( { clientId, onClose } ) {
<Button
variant="primary"
type="submit"
disabled={ ! isDirty }
accessibleWhenDisabled
__next40pxDefaultSize
>
{ __( 'Apply' ) }
Expand Down
Loading