Skip to content

Commit

Permalink
MWPW-160966 Fix next-gen sidekick preflight (#3126)
Browse files Browse the repository at this point in the history
  • Loading branch information
meganthecoder authored Nov 7, 2024
1 parent 948a940 commit 8b372b4
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions libs/blocks/preflight/panels/seo.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,19 @@ async function getResults() {
const icons = [h1, title, canon, desc, body, lorem, links];

const red = icons.find((icon) => icon === 'red');
if (red) {
const sk = document.querySelector('aem-sidekick, helix-sidekick');
if (sk) {
const publishBtn = sk.shadowRoot.querySelector('div.publish.plugin button');
publishBtn.addEventListener('click', () => {
sendResults();
});
}
}
if (!red) return;

const aemSk = document.querySelector('aem-sidekick');
const hlxSk = document.querySelector('helix-sidekick');
if (!aemSk && !hlxSk) return;

const publishBtn = aemSk
? aemSk.shadowRoot.querySelector('plugin-action-bar').shadowRoot.querySelector('sk-action-button.publish')
: hlxSk.shadowRoot.querySelector('div.publish.plugin button');

publishBtn.addEventListener('click', () => {
sendResults();
});
}

export default function Panel() {
Expand Down

0 comments on commit 8b372b4

Please sign in to comment.