Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AKarmanov committed Nov 4, 2024
1 parent 35e0d6b commit adaeab8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export const MainActionBar = () => {
<>
{ !isFolder && (
<ButtonGroup size="big" variant="default" color="accent" className={styles.item}>
<DisplayAction isMediumLabel actionKey="openInPreview" path={path} isDisabled={isDisabled} render={ButtonRendererShortLabel} buttonProps={{variant: 'outlined', size: 'big', className: styles.item}}/>
<DisplayAction menuUseElementAnchor actionKey="openInPreviewMenu" path={path} isDisabled={isDisabled} render={ButtonRendererNoLabel} buttonProps={{variant: 'outlined', size: 'big', color: 'accent', icon: <ChevronDown/>}}/>
<DisplayAction isMediumLabel actionKey="openInPreview" path={path} isDisabled={isDisabled} render={ButtonRendererShortLabel} buttonProps={{variant: 'ghost', size: 'big', className: styles.item}}/>
<DisplayAction menuUseElementAnchor actionKey="openInPreviewMenu" path={path} isDisabled={isDisabled} render={ButtonRendererNoLabel} buttonProps={{variant: 'ghost', size: 'big', color: 'accent', icon: <ChevronDown/>}}/>
</ButtonGroup>)}
<DisplayAction actionKey="openInLive" path={path} isDisabled={isDisabled} render={ButtonRenderer} buttonProps={{variant: 'outlined', size: 'big', color: 'accent', className: styles.item}}/>
</>
Expand Down
10 changes: 2 additions & 8 deletions src/javascript/JContent/JContent.actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import {
Undelete,
Unlock,
Upload,
Visibility,
SwapHoriz
Visibility
} from '@jahia/moonstone';
import {
ClearAllLocksActionComponent,
Expand Down Expand Up @@ -423,10 +422,7 @@ export const jContentActions = registry => {
buttonLabel: 'jcontent:label.contentManager.contentPreview.preview',
menuTarget: 'openInPreviewMenu',
showOnNodeTypes: ['jnt:page'],
isMenuPreload: true,
menuItemProps: {
isShowIcons: true
}
isMenuPreload: true
});

registry.add('action', 'openInPreview', {
Expand All @@ -437,14 +433,12 @@ export const jContentActions = registry => {
});

registry.add('action', 'customizedPreview', {
buttonIcon: <Visibility/>,
buttonLabel: 'jcontent:label.contentManager.actions.customizedPreview',
targets: ['openInPreviewMenu:1'],
component: OpenInPreviewActionComponent
});

registry.add('action', 'compareStagingToLive', {
buttonIcon: <SwapHoriz/>,
buttonLabel: 'jcontent:label.contentManager.actions.compareStagingToLive',
targets: ['openInPreviewMenu:2'],
component: CompareHtmlActionComponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@ export const CompareHtmlActionComponent = ({path, render: Render, loading: Loadi
const res = useNodeChecks(
{path},
{
showOnNodeTypes: ['jnt:page'],
getAggregatedPublicationInfo: {subNodes: true}
hideOnNodeTypes: ['jnt:folder', 'jnt:contentFolder']
}
);

if (res.loading) {
return (Loading && <Loading {...others}/>) || false;
}

const isVisible = res.checksResult && (res?.node?.aggregatedPublicationInfo.publicationStatus === 'PUBLISHED' ||
res?.node?.aggregatedPublicationInfo.publicationStatus === 'MODIFIED');

return (
<Render
{...others}
isVisible={isVisible}
onClick={() => {
window.open(`${window.location.href}#${createEncodedHashString(path)}`, '_blank');
}}
Expand Down

0 comments on commit adaeab8

Please sign in to comment.