Skip to content

Commit

Permalink
Resolve error with Site Design failing DOM operations. (#2610)
Browse files Browse the repository at this point in the history
adjust site-design logic around editor inline styles

Co-authored-by: aledesma-godaddy <aledesma@godaddy.com>
  • Loading branch information
AnthonyLedesma and aledesma-godaddy authored Apr 30, 2024
1 parent 898cd3e commit 3e76e75
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/extensions/site-design/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ export function SiteDesignStyles() {
// Here we move the style element so that we can continue to target and change on user action.
// Only move element if it is not yet under the desktop preview div.
if ( ! stylesElement.closest( 'div.is-desktop-preview' ) ) {
document.querySelectorAll( '.is-desktop-preview style:last-of-type' )?.[ 0 ]?.after?.( stylesElement );
const target =
document.querySelectorAll( '.is-desktop-preview style:last-of-type' )?.[ 0 ] ??
document.querySelectorAll( '.is-desktop-preview div' )?.[ 0 ];

if ( !! target ) {
target?.after?.( stylesElement );
}
}
}, [ isUpdating, designResp ] );

Expand Down

0 comments on commit 3e76e75

Please sign in to comment.