Skip to content

fix(ew-actions): when editor.hide publish is set, also hide publish for canvas - #666

Open
shsteimer wants to merge 11 commits into
mainfrom
hidepub
Open

fix(ew-actions): when editor.hide publish is set, also hide publish for canvas#666
shsteimer wants to merge 11 commits into
mainfrom
hidepub

Conversation

@shsteimer

@shsteimer shsteimer commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Mirrors da-live's da-title.js filterActions(): fetches org/site DA config docs on hash change, ORs any editor.hidePublish rows, and drops publish from the Send button's menu items when the current document's fullpath starts with a configured prefix.

Please always provide the GitHub issue(s) your PR is for, as well as test URLs where your change can be observed (before and after):

Fix #664

https://feature-ew-actions-hide-publish--da-nx--adobe.aem.live/

should merge with adobe/da-live#1245

shsteimer and others added 2 commits August 13, 2026 09:07
Mirrors da-live's da-title.js filterActions(): fetches org/site DA
config docs on hash change, ORs any editor.hidePublish rows, and
drops publish from the Send button's menu items when the current
document's fullpath starts with a configured prefix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
getFirstSheet grabs whichever sheet is positionally first, which
silently breaks if a config doc has multiple sheets and "data" isn't
first. Look up the "data" sheet by name and only fall back to
positional lookup if it doesn't exist.

Co-Authored-By: Claude <noreply@anthropic.com>
@aem-code-sync

aem-code-sync Bot commented Aug 13, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@shsteimer shsteimer changed the title Hidepub fix(ew-actions): when editor.hide publish is set, also hide publish for canvas Aug 13, 2026
@shsteimer
shsteimer marked this pull request as ready for review August 13, 2026 18:41
sharanyavinod
sharanyavinod previously approved these changes Aug 19, 2026
shsteimer and others added 3 commits September 1, 2026 05:51
…ublish

Reverts the getSheetByName fallback back to plain getFirstSheet; better
multi-sheet config lookup will be tackled separately. The
editor.hidePublish feature itself is unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Comment thread nx2/blocks/ew-actions/ew-actions.js Outdated

update(changed) {
super.update(changed);
if (changed.has('_hashState') && this._hashState) this._filterHidePublish();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_filterHidePublish is fired from update() without a catch, so a config fetch failure is an unhandled rejection. please wrap it and default _hidePublish to false on error

Comment thread nx2/blocks/ew-actions/ew-actions.js Outdated
const configs = await Promise.all(fetchDaConfigs({ org, site }));
const configTab = configs.flatMap((config) => getFirstSheet(config) || []);
const publishConfigs = configTab.filter((c) => c.key === 'editor.hidePublish');
this._hidePublish = publishConfigs.some((c) => fullpath.startsWith(c.value));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we guard against an empty editor.hidePublish value? right now a blank row hides publish everywhere via startsWith('').

Comment thread nx2/blocks/ew-actions/ew-actions.js Outdated
const configs = await Promise.all(fetchDaConfigs({ org, site }));
const configTab = configs.flatMap((config) => getFirstSheet(config) || []);
const publishConfigs = configTab.filter((c) => c.key === 'editor.hidePublish');
this._hidePublish = publishConfigs.some((c) => fullpath.startsWith(c.value));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: _shouldHidePublish reads truer to a boolean (it mirrors the config key, so up to you).

Wrap config fetch in try/catch, exclude empty editor.hidePublish
values, and extract a pure shouldHidePublish helper.

Co-Authored-By: Claude <noreply@anthropic.com>
@shsteimer

Copy link
Copy Markdown
Contributor Author

@anfibiacreativa appreciate the review.

Agree that changing name from filter->should is better, but I don't like _shouldHidePublish as a function with a side-effect. Obviously a matter of opinion, but I prefer should functions to return a boolean value and let the caller assign/handle as needed. At least to my mind that makes more sense. To that end, I extracted shouldHidePublish as a module level function that I'm now calling from inside of _updateHidePublish. Hope that works for you.

Other updates made to handle errors and empty values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ew] support editor.hidePublish

3 participants