Skip to content

Commit a7531e9

Browse files
committed
fix: submit button on file picker dialog
Manual backport of #7180 Signed-off-by: Jonas <jonas@freesources.org>
1 parent 8e05d5e commit a7531e9

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/components/Menu/ActionInsertLink.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,25 @@ export default {
126126
.startAt(this.startPath)
127127
.allowDirectories(true)
128128
.setMultiSelect(false)
129+
.setButtonFactory((nodes, path) => {
130+
const buttons = []
131+
const node = nodes?.[0]?.attributes?.displayName || nodes?.[0]?.basename
132+
const isRoot = nodes?.[0]?.root === nodes?.[0]?.attributes?.filename
133+
let label = t('text', 'Choose')
134+
135+
if (nodes.length === 1 && !isRoot) {
136+
label = t('text', 'Choose {file}', { file: node })
137+
}
138+
139+
buttons.push({
140+
callback: () => {},
141+
type: 'primary',
142+
label,
143+
disabled: isRoot,
144+
})
145+
146+
return buttons
147+
})
129148
.setType(FilePickerType.Choose)
130149
.build()
131150

0 commit comments

Comments
 (0)