Unverified Commit 9bd884d5 authored by alexpott's avatar alexpott
Browse files

Issue #3041375 by lauriii, johndevman, yogeshmpawar, bnjmnm: Convert...

Issue #3041375 by lauriii, johndevman, yogeshmpawar, bnjmnm: Convert behaviors.layoutBuilderBlockDrag to use js- prefixed classes for attaching behaviors
parent fc11a4f5
...@@ -111,10 +111,10 @@ ...@@ -111,10 +111,10 @@
behaviors.layoutBuilderBlockDrag = { behaviors.layoutBuilderBlockDrag = {
attach(context) { attach(context) {
$(context) $(context)
.find('.layout-builder__region') .find('.js-layout-builder-region')
.sortable({ .sortable({
items: '> .draggable', items: '> .js-layout-builder-block',
connectWith: '.layout-builder__region', connectWith: '.js-layout-builder-region',
placeholder: 'ui-state-drop', placeholder: 'ui-state-drop',
/** /**
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
*/ */
update(event, ui) { update(event, ui) {
// Check if the region from the event and region for the item match. // Check if the region from the event and region for the item match.
const itemRegion = ui.item.closest('.layout-builder__region'); const itemRegion = ui.item.closest('.js-layout-builder-region');
if (event.target === itemRegion[0]) { if (event.target === itemRegion[0]) {
// Find the destination delta. // Find the destination delta.
const deltaTo = ui.item const deltaTo = ui.item
......
...@@ -55,13 +55,13 @@ ...@@ -55,13 +55,13 @@
behaviors.layoutBuilderBlockDrag = { behaviors.layoutBuilderBlockDrag = {
attach: function attach(context) { attach: function attach(context) {
$(context).find('.layout-builder__region').sortable({ $(context).find('.js-layout-builder-region').sortable({
items: '> .draggable', items: '> .js-layout-builder-block',
connectWith: '.layout-builder__region', connectWith: '.js-layout-builder-region',
placeholder: 'ui-state-drop', placeholder: 'ui-state-drop',
update: function update(event, ui) { update: function update(event, ui) {
var itemRegion = ui.item.closest('.layout-builder__region'); var itemRegion = ui.item.closest('.js-layout-builder-region');
if (event.target === itemRegion[0]) { if (event.target === itemRegion[0]) {
var deltaTo = ui.item.closest('[data-layout-delta]').data('layout-delta'); var deltaTo = ui.item.closest('[data-layout-delta]').data('layout-delta');
......
...@@ -246,7 +246,7 @@ protected function buildAdministrativeSection(SectionStorageInterface $section_s ...@@ -246,7 +246,7 @@ protected function buildAdministrativeSection(SectionStorageInterface $section_s
foreach ($layout_definition->getRegions() as $region => $info) { foreach ($layout_definition->getRegions() as $region => $info) {
if (!empty($build[$region])) { if (!empty($build[$region])) {
foreach (Element::children($build[$region]) as $uuid) { foreach (Element::children($build[$region]) as $uuid) {
$build[$region][$uuid]['#attributes']['class'][] = 'draggable'; $build[$region][$uuid]['#attributes']['class'][] = 'js-layout-builder-block';
$build[$region][$uuid]['#attributes']['class'][] = 'layout-builder-block'; $build[$region][$uuid]['#attributes']['class'][] = 'layout-builder-block';
$build[$region][$uuid]['#attributes']['data-layout-block-uuid'] = $uuid; $build[$region][$uuid]['#attributes']['data-layout-block-uuid'] = $uuid;
$build[$region][$uuid]['#attributes']['data-layout-builder-highlight-id'] = $this->blockUpdateHighlightId($uuid); $build[$region][$uuid]['#attributes']['data-layout-builder-highlight-id'] = $this->blockUpdateHighlightId($uuid);
...@@ -303,6 +303,7 @@ protected function buildAdministrativeSection(SectionStorageInterface $section_s ...@@ -303,6 +303,7 @@ protected function buildAdministrativeSection(SectionStorageInterface $section_s
$build[$region]['layout_builder_add_block']['#weight'] = 1000; $build[$region]['layout_builder_add_block']['#weight'] = 1000;
$build[$region]['#attributes']['data-region'] = $region; $build[$region]['#attributes']['data-region'] = $region;
$build[$region]['#attributes']['class'][] = 'layout-builder__region'; $build[$region]['#attributes']['class'][] = 'layout-builder__region';
$build[$region]['#attributes']['class'][] = 'js-layout-builder-region';
$build[$region]['#attributes']['role'] = 'group'; $build[$region]['#attributes']['role'] = 'group';
$build[$region]['#attributes']['aria-label'] = $this->t('@region region in section @section', [ $build[$region]['#attributes']['aria-label'] = $this->t('@region region in section @section', [
'@region' => $info['label'], '@region' => $info['label'],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment