mirror of https://github.com/nextcloud/bookmarks
Allow specifying default folder in bookmarklet URL
fixes #2017 Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
parent
d7ef99d5c0
commit
b9778b7a28
|
@ -73,6 +73,7 @@ import { generateUrl } from '@nextcloud/router'
|
|||
import { actions } from '../store/index.js'
|
||||
import { getRequestToken } from '@nextcloud/auth'
|
||||
import { getFilePickerBuilder } from '@nextcloud/dialogs'
|
||||
import { privateRoutes } from '../router.js'
|
||||
|
||||
export default {
|
||||
name: 'Settings',
|
||||
|
@ -103,7 +104,11 @@ export default {
|
|||
bookmarklet() {
|
||||
const bookmarkletUrl
|
||||
= window.location.origin + generateUrl('/apps/bookmarks/bookmarklet')
|
||||
return `javascript:(function(){var a=window,b=document,c=encodeURIComponent,e=c(document.title),d=a.open('${bookmarkletUrl}?url='+c(b.location)+'&title='+e,'bkmk_popup','left='+((a.screenX||a.screenLeft)+10)+',top='+((a.screenY||a.screenTop)+10)+',height=650px,width=550px,resizable=1,alwaysRaised=1');a.setTimeout(function(){d.focus()},300);})();`
|
||||
let queryStringExtension = ''
|
||||
if (this.$route.name === privateRoutes.FOLDER) {
|
||||
queryStringExtension = `+'&folderId=${this.$route.params.folder}'`
|
||||
}
|
||||
return `javascript:(function(){var a=window,b=document,c=encodeURIComponent,e=c(document.title),d=a.open('${bookmarkletUrl}?url='+c(b.location)+'&title='+e${queryStringExtension},'bkmk_popup','left='+((a.screenX||a.screenLeft)+10)+',top='+((a.screenY||a.screenTop)+10)+',height=650px,width=550px,resizable=1,alwaysRaised=1');a.setTimeout(function(){d.focus()},300);})();`
|
||||
},
|
||||
archivePath() {
|
||||
return this.$store.state.settings.archivePath
|
||||
|
|
|
@ -73,6 +73,10 @@ export default {
|
|||
type: String,
|
||||
default: '',
|
||||
},
|
||||
folderId: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -86,7 +90,7 @@ export default {
|
|||
exists: false,
|
||||
loading: true,
|
||||
showPicker: false,
|
||||
folder: -1,
|
||||
folder: parseInt(this.folderId || -1),
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
|
@ -103,7 +103,7 @@ export default new Router({
|
|||
path: '/bookmarklet',
|
||||
name: privateRoutes.BOOKMARKLET,
|
||||
component: ViewBookmarklet,
|
||||
props: (route) => ({ url: route.query.url, title: route.query.title }),
|
||||
props: (route) => ({ url: route.query.url, title: route.query.title, folderId: route.query.folderId }),
|
||||
},
|
||||
{
|
||||
path: '/public/:token',
|
||||
|
|
Loading…
Reference in New Issue