Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/components/Menu/ActionInsertLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,25 @@
.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')

Check warning on line 133 in src/components/Menu/ActionInsertLink.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Menu/ActionInsertLink.vue#L129-L133

Added lines #L129 - L133 were not covered by tests

if (nodes.length === 1 && !isRoot) {
label = t('text', 'Choose {file}', { file: node })
}

Check warning on line 137 in src/components/Menu/ActionInsertLink.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Menu/ActionInsertLink.vue#L135-L137

Added lines #L135 - L137 were not covered by tests

buttons.push({
callback: () => {},
type: 'primary',
label,
disabled: isRoot,
})

Check warning on line 144 in src/components/Menu/ActionInsertLink.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Menu/ActionInsertLink.vue#L139-L144

Added lines #L139 - L144 were not covered by tests

return buttons
})

Check warning on line 147 in src/components/Menu/ActionInsertLink.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Menu/ActionInsertLink.vue#L146-L147

Added lines #L146 - L147 were not covered by tests
.setType(FilePickerType.Choose)
.build()

Expand Down
Loading