Skip to content

Commit 0638c11

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 485ae92 commit 0638c11

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

blocks/columns/columns.js

Lines changed: 3 additions & 3 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('3 bkgdColorAttr in columns row UE: ', ueBkgdColorAttr);
15+
console.log('4 bkgdColorAttr in columns row UE: ', ueBkgdColorAttr);
1616

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

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

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

0 commit comments

Comments
 (0)