Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2020-04-06 11:54:07 +0300
committerAzul <azul@riseup.net>2020-04-09 17:41:09 +0300
commit43f0d2a3b5bc76ed72693695451398b4b7b78411 (patch)
tree1c726eeaef75cd34e46aee64449737f826c4999d /apps/files_sharing/js
parentd2728cbdc13e89f11dc2b8c48b6148d6e89d0c83 (diff)
Allow opening files for editing in new tabs
In a file list files with a default action have an href that will trigger the action. This way ctrl-click and middle button click open the default action in a new tab. In order to achieve this a new param `openfile` was introduced to the files app. It will make the files app trigger the default action for the file in question. This also allows linking to file content rather than just the details display. Introduce fileList.getDefaultActionUrl() to create a link with that param set. It's overwritten in the trashbin fileList so that anchors continue to have `#` as a href. Fix the link generation for subfolders of public shares: 58a87d0 was the last commit that touched the linkTo function in public.js. It included the params as arguments to the generateUrl function. Turns out this completely ignores the dir parameter now. The inclusion was reverted in other places so revert it here as well. Also change `dir` to `path` in the param as that is respected when following the link. Add Test for the new link url for files with default action. Remove test for multiple selects with ctrl-click as that is not what we are doing anymore. Signed-off-by: Azul <azul@riseup.net>
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r--apps/files_sharing/js/public.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index aba7bbc029e..982f32dbdd9 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -113,9 +113,9 @@ OCA.Sharing.PublicApp = {
// Show file preview if previewer is available, images are already handled by the template
if (mimetype.substr(0, mimetype.indexOf('/')) !== 'image' && $('.publicpreview').length === 0) {
// Trigger default action if not download TODO
- var action = FileActions.getDefaultFileAction(mimetype, 'file', OC.PERMISSION_READ);
- if (action && action.action) {
- action($('#filename').val());
+ var spec = FileActions.getDefaultFileAction(mimetype, 'file', OC.PERMISSION_READ);
+ if (spec && spec.action) {
+ spec.action($('#filename').val());
}
}
}
@@ -248,7 +248,7 @@ OCA.Sharing.PublicApp = {
};
this.fileList.linkTo = function (dir) {
- return OC.generateUrl('/s/' + token + '', {dir: dir});
+ return OC.generateUrl('/s/' + token + '') + '?' + OC.buildQueryString({path: dir});
};
this.fileList.generatePreviewUrl = function (urlSpec) {