diff --git a/services/web/frontend/js/features/source-editor/components/figure-modal/figure-modal-source-picker.tsx b/services/web/frontend/js/features/source-editor/components/figure-modal/figure-modal-source-picker.tsx index e9ba17502c..5159fdd28a 100644 --- a/services/web/frontend/js/features/source-editor/components/figure-modal/figure-modal-source-picker.tsx +++ b/services/web/frontend/js/features/source-editor/components/figure-modal/figure-modal-source-picker.tsx @@ -9,6 +9,7 @@ import getMeta from '@/utils/meta' import MaterialIcon from '@/shared/components/material-icon' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' import { bsVersion } from '@/features/utils/bootstrap-5' +import { usePermissionsContext } from '@/features/ide-react/context/permissions-context' export const FigureModalSourcePicker: FC = () => { const { t } = useTranslation() @@ -17,26 +18,32 @@ export const FigureModalSourcePicker: FC = () => { hasLinkedProjectOutputFileFeature, hasLinkUrlFeature, } = getMeta('ol-ExposedSettings') + + const { write } = usePermissionsContext() + return (
- + {write && ( + + )} - {(hasLinkedProjectFileFeature || hasLinkedProjectOutputFileFeature) && ( - - )} - {hasLinkUrlFeature && ( + {write && + (hasLinkedProjectFileFeature || hasLinkedProjectOutputFileFeature) && ( + + )} + {write && hasLinkUrlFeature && ( { emitToolbarEvent(view, `toolbar-figure-modal-${sourceName}`) @@ -30,6 +33,20 @@ export const InsertFigureDropdown = memo(function InsertFigureDropdown() { hasLinkedProjectOutputFileFeature, hasLinkUrlFeature, } = getMeta('ol-ExposedSettings') + + if (!write) { + return ( + + openFigureModal(FigureModalSource.FILE_TREE, 'current-project') + } + icon="add_photo_alternate" + /> + ) + } + return (