Skip to content

Commit 28b06e8

Browse files
refactor logic because UE saves after each field, and for some reason background-color gets called twice and returns null on second pass
1 parent f97b0ed commit 28b06e8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

blocks/columns/columns.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ export default function decorate(block) {
1212
// for UE as value needs to be saved in different element due to having to walk the DOM tree to set the values
1313
const columnsChild = block.querySelector('div');
1414
const ueBkgdColorAttr = columnsChild?.getAttribute('data-background-color');
15-
console.log('1bkgdColorAttr in columns row UE: ', ueBkgdColorAttr);
15+
console.log('2 bkgdColorAttr in columns row UE: ', ueBkgdColorAttr);
1616

1717
const ueTextColorAttr = columnsChild?.getAttribute('data-text-color');
18-
console.log('1textColorAttr in columns row UE: ', ueTextColorAttr);
18+
console.log('2 textColorAttr in columns row UE: ', ueTextColorAttr);
1919

20-
if (ueBkgdColorAttr && ueBkgdColorAttr != null && block.style.backgroundColor && (block.style.backgroundColor == null || block.style.backgroundColor == 'white')) block.style.backgroundColor = ueBkgdColorAttr;
21-
if (ueTextColorAttr && ueTextColorAttr != null && block.style.color && block.style.color == null) block.style.color = ueTextColorAttr;
20+
if (ueBkgdColorAttr && ueBkgdColorAttr != null && (block.style.backgroundColor == null || block.style.backgroundColor == 'white')) block.style.backgroundColor = ueBkgdColorAttr;
21+
if (ueTextColorAttr && ueTextColorAttr != null && block.style.color == null) block.style.color = ueTextColorAttr;
2222

2323
const cols = [...block.firstElementChild.children];
2424
block.classList.add(`columns-${cols.length}-cols`);

0 commit comments

Comments
 (0)