diff --git a/src/components/Menu/ActionInsertLink.vue b/src/components/Menu/ActionInsertLink.vue index 8a918c09dcb..83c9e14e642 100644 --- a/src/components/Menu/ActionInsertLink.vue +++ b/src/components/Menu/ActionInsertLink.vue @@ -126,6 +126,25 @@ export default { .startAt(this.startPath) .allowDirectories(true) .setMultiSelect(false) + .setButtonFactory((nodes, path) => { + const buttons = [] + const node = nodes?.[0]?.attributes?.displayName || nodes?.[0]?.basename + const isRoot = nodes?.[0]?.root === nodes?.[0]?.attributes?.filename + let label = t('text', 'Choose') + + if (nodes.length === 1 && !isRoot) { + label = t('text', 'Choose {file}', { file: node }) + } + + buttons.push({ + callback: () => {}, + type: 'primary', + label, + disabled: isRoot, + }) + + return buttons + }) .setType(FilePickerType.Choose) .build()