|
@@ -66,7 +66,7 @@ const Tags = (props: TagsProps): JSX.Element => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
type WideViewMenuItemProps = AdditionalMenuItemsRendererProps & {
|
|
type WideViewMenuItemProps = AdditionalMenuItemsRendererProps & {
|
|
|
- onClickMenuItem: (newValue: boolean) => void,
|
|
|
|
|
|
|
+ onClickMenuItem: () => void,
|
|
|
expandContentWidth?: boolean,
|
|
expandContentWidth?: boolean,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -77,24 +77,27 @@ const WideViewMenuItem = (props: WideViewMenuItemProps): JSX.Element => {
|
|
|
onClickMenuItem, expandContentWidth,
|
|
onClickMenuItem, expandContentWidth,
|
|
|
} = props;
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
+ const menuItemClickedHandler = useCallback((e: React.MouseEvent<HTMLInputElement>) => {
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
+ onClickMenuItem();
|
|
|
|
|
+ }, [onClickMenuItem]);
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
- <DropdownItem
|
|
|
|
|
- onClick={() => onClickMenuItem(!(expandContentWidth))}
|
|
|
|
|
- className="grw-page-control-dropdown-item"
|
|
|
|
|
|
|
+ <div
|
|
|
|
|
+ className="grw-page-control-dropdown-item dropdown-item"
|
|
|
|
|
+ onClick={menuItemClickedHandler}
|
|
|
>
|
|
>
|
|
|
<div className="form-check form-switch ms-1">
|
|
<div className="form-check form-switch ms-1">
|
|
|
<input
|
|
<input
|
|
|
- id="switchContentWidth"
|
|
|
|
|
className="form-check-input"
|
|
className="form-check-input"
|
|
|
type="checkbox"
|
|
type="checkbox"
|
|
|
checked={expandContentWidth}
|
|
checked={expandContentWidth}
|
|
|
- onChange={() => {}}
|
|
|
|
|
/>
|
|
/>
|
|
|
- <label className="form-label form-check-label" htmlFor="switchContentWidth">
|
|
|
|
|
|
|
+ <label className="form-label form-check-label">
|
|
|
{ t('wide_view') }
|
|
{ t('wide_view') }
|
|
|
</label>
|
|
</label>
|
|
|
</div>
|
|
</div>
|
|
|
- </DropdownItem>
|
|
|
|
|
|
|
+ </div>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -224,7 +227,9 @@ const PageControlsSubstance = (props: PageControlsSubstanceProps): JSX.Element =
|
|
|
onClickDeleteMenuItem(pageToDelete);
|
|
onClickDeleteMenuItem(pageToDelete);
|
|
|
}, [onClickDeleteMenuItem, pageId, pageInfo, path, revisionId]);
|
|
}, [onClickDeleteMenuItem, pageId, pageInfo, path, revisionId]);
|
|
|
|
|
|
|
|
- const switchContentWidthClickHandler = useCallback(async(newValue: boolean) => {
|
|
|
|
|
|
|
+ const switchContentWidthClickHandler = useCallback(() => {
|
|
|
|
|
+
|
|
|
|
|
+ const newValue = !expandContentWidth;
|
|
|
if (onClickSwitchContentWidth == null || (isGuestUser ?? true) || (isReadOnlyUser ?? true)) {
|
|
if (onClickSwitchContentWidth == null || (isGuestUser ?? true) || (isReadOnlyUser ?? true)) {
|
|
|
logger.warn('Could not switch content width', {
|
|
logger.warn('Could not switch content width', {
|
|
|
onClickSwitchContentWidth: onClickSwitchContentWidth == null ? 'null' : 'not null',
|
|
onClickSwitchContentWidth: onClickSwitchContentWidth == null ? 'null' : 'not null',
|
|
@@ -242,7 +247,7 @@ const PageControlsSubstance = (props: PageControlsSubstanceProps): JSX.Element =
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
toastError(err);
|
|
toastError(err);
|
|
|
}
|
|
}
|
|
|
- }, [isGuestUser, isReadOnlyUser, onClickSwitchContentWidth, pageId, pageInfo]);
|
|
|
|
|
|
|
+ }, [expandContentWidth, isGuestUser, isReadOnlyUser, onClickSwitchContentWidth, pageId, pageInfo]);
|
|
|
|
|
|
|
|
const additionalMenuItemOnTopRenderer = useMemo(() => {
|
|
const additionalMenuItemOnTopRenderer = useMemo(() => {
|
|
|
if (!isIPageInfoForEntity(pageInfo)) {
|
|
if (!isIPageInfoForEntity(pageInfo)) {
|