diff --git a/css/layout-builder-lock.css b/css/layout-builder-lock.css index a3cb608f924aac203f15bbc1b9c2b3435d252357..b7ebb78259ccf7cee27c5aa5ee5d8f9c941f8a7e 100644 --- a/css/layout-builder-lock.css +++ b/css/layout-builder-lock.css @@ -1,4 +1,6 @@ -.layout-builder-block-locked { +/* Using :not(b) is slightly more specific (0 1 1) than a single class selector but less + specific than 2 class selectors (0 2 0). The element is not likely to be a <b>. */ +.layout-builder-block-locked:not(b) { padding: 1.5em; cursor: default; } diff --git a/src/LayoutBuilderLock.php b/src/LayoutBuilderLock.php index dde898cc46d3f57eed7c3ab44a34c5dd8a52c3a5..6ea9f84a071505efe6d31faf5d660e99757a6f3c 100644 --- a/src/LayoutBuilderLock.php +++ b/src/LayoutBuilderLock.php @@ -216,14 +216,12 @@ class LayoutBuilderLock implements TrustedCallbackInterface { } // If moving is not allowed, remove the default layout builder - // classes on this block and add our own so we can reset the + // js class on this block and add our own so we can reset the // pointer and padding. if (!$allow_moving) { - foreach (['layout-builder-block', 'js-layout-builder-block'] as $class) { - if (isset($element['layout_builder'][$section_number][$name][$region_key][$item_key]['#attributes']['class']) && is_array($element['layout_builder'][$section_number][$name][$region_key][$item_key]['#attributes']['class'])) { - $key = array_search($class, $element['layout_builder'][$section_number][$name][$region_key][$item_key]['#attributes']['class']); - unset($element['layout_builder'][$section_number][$name][$region_key][$item_key]['#attributes']['class'][$key]); - } + if (isset($element['layout_builder'][$section_number][$name][$region_key][$item_key]['#attributes']['class']) && is_array($element['layout_builder'][$section_number][$name][$region_key][$item_key]['#attributes']['class'])) { + $key = array_search('js-layout-builder-block', $element['layout_builder'][$section_number][$name][$region_key][$item_key]['#attributes']['class']); + unset($element['layout_builder'][$section_number][$name][$region_key][$item_key]['#attributes']['class'][$key]); } $element['layout_builder'][$section_number][$name][$region_key][$item_key]['#attributes']['class'][] = 'layout-builder-block-locked'; }