Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

πŸ› Fixes opening method dropdown in edit menu (#1970)

Alicia Sykes07b5294cd65d
diff --git a/src/mixins/ItemMixin.js b/src/mixins/ItemMixin.js
index 08679870..809f8780 100644
--- a/src/mixins/ItemMixin.js
+++ b/src/mixins/ItemMixin.js
@@ -152,6 +152,10 @@ export default {
} else if (this.accumulatedTarget === 'clipboard') {
e.preventDefault();
this.copyToClipboard(url);
+ } else if (this.accumulatedTarget === 'newwindow') {
+ e.preventDefault();
+ const { width, height } = window.screen;
+ window.open(url, '_blank', `width=${width},height=${height},noopener,noreferrer`);
}
// Emit event to clear search field, etc
this.$emit('itemClicked');
@@ -172,6 +176,12 @@ export default {
case 'sametab':
window.open(url, '_self');
break;
+ case 'parent':
+ window.open(url, '_parent');
+ break;
+ case 'top':
+ window.open(url, '_top');
+ break;
case 'modal':
this.$emit('triggerModal', url);
break;
@@ -181,9 +191,11 @@ export default {
case 'clipboard':
this.copyToClipboard(url);
break;
- case 'newwindow':
- window.open(url, '_blank', 'noopener,noreferrer');
+ case 'newwindow': {
+ const { width, height } = window.screen;
+ window.open(url, '_blank', `width=${width},height=${height},noopener,noreferrer`);
break;
+ }
default: window.open(url, '_blank');
}
},
diff --git a/src/utils/ConfigHelpers.js b/src/utils/ConfigHelpers.js
index f970c8a9..4ea7ffda 100644
--- a/src/utils/ConfigHelpers.js
+++ b/src/utils/ConfigHelpers.js
@@ -109,7 +109,6 @@ export const getUsersLanguage = () => {
* @returns {Boolean} isValid
*/
export const targetValidator = (target) => {
- if (!target) return true;
const acceptedTargets = ConfigSchema.properties.sections.items
.properties.items.items.properties.target.enum;
const isTargetValid = acceptedTargets.indexOf(target) !== -1;
diff --git a/src/utils/ConfigSchema.json b/src/utils/ConfigSchema.json
index f795576b..5a593884 100644
--- a/src/utils/ConfigSchema.json
+++ b/src/utils/ConfigSchema.json
@@ -146,15 +146,13 @@
},
"target": {
"title": "Opening Method",
- "type": ["string", "null"],
+ "type": "string",
"enum": [
"newtab",
"sametab",
"parent",
"top",
- "newwindow",
- "",
- null
+ "newwindow"
],
"default": "newtab",
"description": "Where / how the item is opened when it's clicked"
@@ -207,7 +205,8 @@
"top",
"modal",
"workspace",
- "clipboard"
+ "clipboard",
+ "newwindow"
],
"default": "newtab",
"description": "The default opening method for items. Only used if no item.target is specified"
@@ -1067,7 +1066,7 @@
},
"target": {
"title": "Opening Method",
- "type": ["string", "null"],
+ "type": "string",
"enum": [
"newtab",
"sametab",
@@ -1076,9 +1075,7 @@
"modal",
"workspace",
"clipboard",
- "newwindow",
- "",
- null
+ "newwindow"
],
"default": "newtab",
"description": "Where / how the item is opened when it's clicked"
diff --git a/src/views/Workspace.vue b/src/views/Workspace.vue
index 6e5f0fae..bbeb4e6c 100644
--- a/src/views/Workspace.vue
+++ b/src/views/Workspace.vue
@@ -49,7 +49,8 @@ export default {
if (options.target === 'newtab') {
window.open(options.url, '_blank');
} else if (options.target === 'newwindow') {
- window.open(options.url, '_blank', 'noopener,noreferrer');
+ const { width, height } = window.screen;
+ window.open(options.url, '_blank', `width=${width},height=${height},noopener,noreferrer`);
} else if (options.target === 'clipboard') {
if (navigator.clipboard) {
navigator.clipboard.writeText(options.url);