mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
[web] Conditionally show items in insert figure toolbar (#33721)
Removes the options for inserting an image from another project or by downloading an external URL if the features are disabled. GitOrigin-RevId: ffa64e5929e254d8a236c8e9aca4eb8210f444c9
This commit is contained in:
@@ -36,6 +36,11 @@ export const useToolbarMenuBarEditorCommands = () => {
|
||||
)
|
||||
}, [])
|
||||
|
||||
const {
|
||||
hasLinkedProjectFileFeature,
|
||||
hasLinkedProjectOutputFileFeature,
|
||||
hasLinkUrlFeature,
|
||||
} = getMeta('ol-ExposedSettings')
|
||||
useCommandProvider(() => {
|
||||
if (!editorIsVisible) {
|
||||
return
|
||||
@@ -124,6 +129,20 @@ export const useToolbarMenuBarEditorCommands = () => {
|
||||
openFigureModal(FigureModalSource.FILE_TREE)
|
||||
},
|
||||
},
|
||||
]
|
||||
}, [view, t, editorIsVisible, openFigureModal, trackedWrite, isTeXFile])
|
||||
|
||||
useCommandProvider(() => {
|
||||
if (!editorIsVisible) {
|
||||
return
|
||||
}
|
||||
if (!isTeXFile || !trackedWrite) {
|
||||
return
|
||||
}
|
||||
if (!hasLinkedProjectFileFeature || !hasLinkedProjectOutputFileFeature) {
|
||||
return
|
||||
}
|
||||
return [
|
||||
{
|
||||
label: t('from_another_project'),
|
||||
id: 'insert-figure-from-another-project',
|
||||
@@ -131,6 +150,28 @@ export const useToolbarMenuBarEditorCommands = () => {
|
||||
openFigureModal(FigureModalSource.OTHER_PROJECT)
|
||||
},
|
||||
},
|
||||
]
|
||||
}, [
|
||||
t,
|
||||
editorIsVisible,
|
||||
openFigureModal,
|
||||
trackedWrite,
|
||||
isTeXFile,
|
||||
hasLinkedProjectFileFeature,
|
||||
hasLinkedProjectOutputFileFeature,
|
||||
])
|
||||
|
||||
useCommandProvider(() => {
|
||||
if (!editorIsVisible) {
|
||||
return
|
||||
}
|
||||
if (!isTeXFile || !trackedWrite) {
|
||||
return
|
||||
}
|
||||
if (!hasLinkUrlFeature) {
|
||||
return
|
||||
}
|
||||
return [
|
||||
{
|
||||
label: t('from_url'),
|
||||
id: 'insert-figure-from-url',
|
||||
@@ -138,6 +179,25 @@ export const useToolbarMenuBarEditorCommands = () => {
|
||||
openFigureModal(FigureModalSource.FROM_URL)
|
||||
},
|
||||
},
|
||||
]
|
||||
}, [
|
||||
t,
|
||||
editorIsVisible,
|
||||
openFigureModal,
|
||||
trackedWrite,
|
||||
isTeXFile,
|
||||
hasLinkUrlFeature,
|
||||
])
|
||||
|
||||
useCommandProvider(() => {
|
||||
if (!editorIsVisible) {
|
||||
return
|
||||
}
|
||||
if (!isTeXFile || !trackedWrite) {
|
||||
return
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
id: 'insert-table',
|
||||
label: t('table'),
|
||||
@@ -278,16 +338,7 @@ export const useToolbarMenuBarEditorCommands = () => {
|
||||
},
|
||||
},
|
||||
]
|
||||
}, [
|
||||
view,
|
||||
t,
|
||||
editorIsVisible,
|
||||
openFigureModal,
|
||||
trackedWrite,
|
||||
isTeXFile,
|
||||
canComment,
|
||||
comment,
|
||||
])
|
||||
}, [view, t, editorIsVisible, trackedWrite, isTeXFile, canComment, comment])
|
||||
|
||||
const { toggleSymbolPalette } = useEditorPropertiesContext()
|
||||
const symbolPaletteAvailable = getMeta('ol-symbolPaletteAvailable')
|
||||
|
||||
Reference in New Issue
Block a user