Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-161101 load sidekick button css faster if already open #3095

Merged
merged 5 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libs/utils/sidekick-decorate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import userCanPublishPage from '../tools/utils/publish.js';
const PUBLISH_BTN = '.publish.plugin button';
const PROFILE = '.profile-email';
const CONFIRM_MESSAGE = 'Are you sure? This will publish to production.';
let stylePublishCalled = false;

export default function stylePublish(sk) {
if (stylePublishCalled) return;
stylePublishCalled = true;
const setupPublishBtn = async (page, btn) => {
const { canPublish, message } = await userCanPublishPage(page, false);
if (canPublish) {
Expand Down
2 changes: 2 additions & 0 deletions libs/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,8 @@ async function checkForPageMods() {

async function loadPostLCP(config) {
await decoratePlaceholders(document.body.querySelector('header'), config);
const sk = document.querySelector('helix-sidekick');
if (sk) import('./sidekick-decorate.js').then((mod) => { mod.default(sk); });
if (config.mep?.targetEnabled === 'postlcp') {
/* c8 ignore next 2 */
const { init } = await import('../features/personalization/personalization.js');
Expand Down
Loading