Client: disabled the section context menu in index editing mode

This commit is contained in:
Dmitry Sychugov 2024-06-26 15:17:05 +05:00
parent 643b92a49f
commit ce8aebc6a4
4 changed files with 11 additions and 1 deletions

View File

@ -115,6 +115,7 @@ const PureHome = (props) => {
isPrivacyFolder, isPrivacyFolder,
isRecycleBinFolder, isRecycleBinFolder,
isErrorRoomNotAvailable, isErrorRoomNotAvailable,
isIndexEditingMode,
primaryProgressDataPercent, primaryProgressDataPercent,
primaryProgressDataIcon, primaryProgressDataIcon,
@ -351,6 +352,7 @@ const PureHome = (props) => {
sectionProps.secondaryProgressBarIcon = secondaryProgressDataStoreIcon; sectionProps.secondaryProgressBarIcon = secondaryProgressDataStoreIcon;
sectionProps.showSecondaryButtonAlert = secondaryProgressDataStoreAlert; sectionProps.showSecondaryButtonAlert = secondaryProgressDataStoreAlert;
sectionProps.getContextModel = getContextModel; sectionProps.getContextModel = getContextModel;
sectionProps.isIndexEditingMode = isIndexEditingMode;
return ( return (
<> <>
@ -439,6 +441,7 @@ export default inject(
currentTariffStatusStore, currentTariffStatusStore,
settingsStore, settingsStore,
contextOptionsStore, contextOptionsStore,
indexingStore,
}) => { }) => {
const { setSelectedFolder, security: folderSecurity } = selectedFolderStore; const { setSelectedFolder, security: folderSecurity } = selectedFolderStore;
const { const {
@ -605,6 +608,7 @@ export default inject(
isErrorRoomNotAvailable, isErrorRoomNotAvailable,
isRoomsFolder, isRoomsFolder,
isArchiveFolder, isArchiveFolder,
isIndexEditingMode: indexingStore.isIndexEditingMode,
disableDrag, disableDrag,

View File

@ -66,6 +66,7 @@ export interface SectionBodyProps {
settingsStudio: boolean; settingsStudio: boolean;
isFormGallery?: boolean; isFormGallery?: boolean;
isDesktop?: boolean; isDesktop?: boolean;
isIndexEditingMode?: boolean;
currentDeviceType?: DeviceType; currentDeviceType?: DeviceType;
getContextModel?: () => ContextMenuModel[]; getContextModel?: () => ContextMenuModel[];
} }
@ -144,4 +145,5 @@ export interface SectionProps {
anotherDialogOpen?: boolean; anotherDialogOpen?: boolean;
isDesktop?: boolean; isDesktop?: boolean;
getContextModel?: () => ContextMenuModel[]; getContextModel?: () => ContextMenuModel[];
isIndexEditingMode?: boolean;
} }

View File

@ -117,6 +117,7 @@ const Section = (props: SectionProps) => {
canDisplay, canDisplay,
anotherDialogOpen, anotherDialogOpen,
getContextModel, getContextModel,
isIndexEditingMode,
} = props; } = props;
const [sectionSize, setSectionSize] = React.useState<{ const [sectionSize, setSectionSize] = React.useState<{
@ -243,6 +244,7 @@ const Section = (props: SectionProps) => {
isFormGallery={isFormGallery} isFormGallery={isFormGallery}
currentDeviceType={currentDeviceType} currentDeviceType={currentDeviceType}
getContextModel={getContextModel} getContextModel={getContextModel}
isIndexEditingMode={isIndexEditingMode}
> >
{isSectionHeaderAvailable && {isSectionHeaderAvailable &&
currentDeviceType === DeviceType.mobile && ( currentDeviceType === DeviceType.mobile && (

View File

@ -51,6 +51,7 @@ const SectionBody = React.memo(
isDesktop, isDesktop,
settingsStudio = false, settingsStudio = false,
getContextModel, getContextModel,
isIndexEditingMode,
}: SectionBodyProps) => { }: SectionBodyProps) => {
const focusRef = React.useRef<HTMLDivElement | null>(null); const focusRef = React.useRef<HTMLDivElement | null>(null);
const cmRef = React.useRef<null | { const cmRef = React.useRef<null | {
@ -65,6 +66,7 @@ const SectionBody = React.memo(
const onContextMenu = React.useCallback( const onContextMenu = React.useCallback(
(e: MouseEvent | React.MouseEvent<Element, MouseEvent>) => { (e: MouseEvent | React.MouseEvent<Element, MouseEvent>) => {
if (isIndexEditingMode) return;
const bodyElem = document.getElementsByClassName( const bodyElem = document.getElementsByClassName(
"section-body", "section-body",
)[0] as HTMLDivElement; )[0] as HTMLDivElement;
@ -89,7 +91,7 @@ const SectionBody = React.memo(
setIsOpen(!isOpen); setIsOpen(!isOpen);
} }
}, },
[getContextModel, isOpen], [getContextModel, isOpen, isIndexEditingMode],
); );
const onHide = () => { const onHide = () => {