Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow linking to folders #2162

Closed
rotdrop opened this issue Feb 6, 2022 · 0 comments · Fixed by #2665
Closed

Allow linking to folders #2162

rotdrop opened this issue Feb 6, 2022 · 0 comments · Fixed by #2665
Labels
enhancement New feature or request

Comments

@rotdrop
Copy link

rotdrop commented Feb 6, 2022

Is your feature request related to a problem? Please describe.
Currently one can only link to files. It would be really nice if it would also be possible to link to folders.

Describe the solution you'd like
The file-picker which opens when I select a text and then use "link file" should also allow to select directories, and those directories should be linked correctly in the resulting mark-down.

Describe alternatives you've considered
You can manually insert a hyperlink copied from the files-app opened in another window. But this is a little bit inconvenient.

Additional context
This would probably need changes in MenuBubble.vue and helpers.js

selectFile(command) {
const currentUser = getCurrentUser()
if (!currentUser) {
return
}
const startPath = this.filePath.split('/').slice(0, -1).join('/')
OC.dialogs.filepicker(t('text', 'Select file to link to'), (file) => {
const client = OC.Files.getClient()
client.getFileInfo(file).then((_status, fileInfo) => {
const path = optimalPath(this.filePath, `${fileInfo.path}/${fileInfo.name}`)
const encodedPath = path.split('/').map(encodeURIComponent).join('/')
command({ href: `${encodedPath}?fileId=${fileInfo.id}` })
this.hideLinkMenu()
})
}, false, [], true, undefined, startPath)
},

const domHref = function(node) {
const ref = node.attrs.href
if (!ref) {
return ref
}
if (ref.match(/^[a-zA-Z]*:/)) {
return ref
}
const match = ref.match(/^([^?]*)\?fileId=(\d+)/)
if (match) {
const [, relPath, id] = match
const currentDir = basedir(OCA.Viewer.file)
const dir = absolutePath(currentDir, basedir(relPath))
return generateUrl(`/apps/files/?dir=${dir}&openfile=${id}#relPath=${relPath}`)
}
}

@rotdrop rotdrop added the enhancement New feature or request label Feb 6, 2022
susnux added a commit that referenced this issue Jul 4, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Jul 5, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Jul 5, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Jul 6, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Jul 6, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Jul 21, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Jul 21, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Jul 30, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Aug 26, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Sep 5, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Sep 6, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Oct 5, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Oct 5, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Oct 5, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Oct 18, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Oct 19, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Oct 20, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Oct 20, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Oct 20, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
susnux added a commit that referenced this issue Oct 21, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
mejo- pushed a commit that referenced this issue Oct 24, 2022
This replaces the popover MenuBubble used for inserting
links with a menu entry in the menu bar, fixing #2392.
This also allows to add links also to directories,
previously only files were allowed as link targets, fixing #2162.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants