From b3dbd15609e07790cfdab3787d1880db4f0f61b6 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Wed, 19 Feb 2025 17:26:41 +0300 Subject: [PATCH 1/6] Rename on enter key --- .../designer/dashboard/DesignDashboard.vue | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/apps/showcase/components/layout/designer/dashboard/DesignDashboard.vue b/apps/showcase/components/layout/designer/dashboard/DesignDashboard.vue index 0f12e95b1..53df23f21 100644 --- a/apps/showcase/components/layout/designer/dashboard/DesignDashboard.vue +++ b/apps/showcase/components/layout/designer/dashboard/DesignDashboard.vue @@ -9,7 +9,7 @@
Theme Designer is the ultimate tool to customize and design your own themes featuring a visual editor, figma to code, cloud storage, and migration assistant. Discover more about the - Theme Designer by visiting the detailed documentationdocumentation. A license can be purchased from PrimeStore, if you do not have a license key, you are still able to experience the Designer in trial @@ -63,7 +63,14 @@
- +
{{ formatTimestamp(theme.t_last_updated) }} @@ -236,21 +243,26 @@ export default { } }, async renameTheme(theme) { - const { error } = await $fetch(this.designerApiUrl + '/theme/rename/' + theme.t_key, { - method: 'PATCH', - credentials: 'include', - headers: { - 'X-CSRF-Token': this.$appState.designer.csrfToken - }, - body: { - name: theme.t_name - } - }); + if (theme.t_name && theme.t_name.trim().length) { + const { error } = await $fetch(this.designerApiUrl + '/theme/rename/' + theme.t_key, { + method: 'PATCH', + credentials: 'include', + headers: { + 'X-CSRF-Token': this.$appState.designer.csrfToken + }, + body: { + name: theme.t_name + } + }); - if (error) { - this.$toast.add({ severity: 'error', summary: 'An Error Occurred', detail: error.message, life: 3000 }); + if (error) { + this.$toast.add({ severity: 'error', summary: 'An Error Occurred', detail: error.message, life: 3000 }); + } } }, + onThemeNameEnterKey(event) { + event.target.blur(); + }, async deleteTheme(theme) { const { error } = await $fetch(this.designerApiUrl + '/theme/delete/' + theme.t_key, { method: 'DELETE', From 416274eddb2f66fa4f4001ace22cd0663fbd7bfb Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Wed, 19 Feb 2025 17:39:19 +0300 Subject: [PATCH 2/6] Reenable scroll --- apps/showcase/components/layout/AppDesigner.vue | 2 +- .../components/layout/designer/editor/DesignTokenField.vue | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/showcase/components/layout/AppDesigner.vue b/apps/showcase/components/layout/AppDesigner.vue index 59cffc5f9..d38ce175a 100644 --- a/apps/showcase/components/layout/AppDesigner.vue +++ b/apps/showcase/components/layout/AppDesigner.vue @@ -1,5 +1,5 @@ @@ -89,6 +89,7 @@ import { usePreset } from '@primeuix/themes'; import Aura from '@primeuix/themes/aura'; export default { + scrollListener: null, setup() { const runtimeConfig = useRuntimeConfig(); @@ -97,6 +98,9 @@ export default { }; }, inject: ['designerService'], + beforeUnmount() { + this.unbindScrollListener(); + }, data() { return { licenseKey: null, @@ -311,6 +315,27 @@ export default { this.currentTheme = theme; this.$refs.themeMenu.toggle(event); }, + onMenuShow() { + this.bindScrollListener(); + }, + onMenuHide() { + this.unbindScrollListener(); + }, + bindScrollListener() { + if (!this.scrollListener) { + this.scrollListener = () => { + this.$refs.themeMenu.hide(); + }; + + window.addEventListener('scroll', this.scrollListener); + } + }, + unbindScrollListener() { + if (this.scrollListener) { + window.removeEventListener('scroll', this.scrollListener); + this.scrollListener = null; + } + }, abbrThemeName(theme) { return theme.t_name ? theme.t_name.substring(0, 2) : 'UT'; } From 207e0adc846646a4cd50311905a93e80e50674a0 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Wed, 19 Feb 2025 18:23:22 +0300 Subject: [PATCH 5/6] Escape key should close input --- .../components/layout/designer/dashboard/DesignDashboard.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/showcase/components/layout/designer/dashboard/DesignDashboard.vue b/apps/showcase/components/layout/designer/dashboard/DesignDashboard.vue index bfe5d9f86..5d4bd2db8 100644 --- a/apps/showcase/components/layout/designer/dashboard/DesignDashboard.vue +++ b/apps/showcase/components/layout/designer/dashboard/DesignDashboard.vue @@ -70,6 +70,7 @@ maxlength="100" @blur="renameTheme(theme)" @keydown.enter="onThemeNameEnterKey($event)" + @keydown.escape="onThemeNameEscape($event)" />
@@ -267,6 +268,10 @@ export default { onThemeNameEnterKey(event) { event.target.blur(); }, + onThemeNameEscape(event) { + event.target.blur(); + event.stopPropagation(); + }, async deleteTheme(theme) { const { error } = await $fetch(this.designerApiUrl + '/theme/delete/' + theme.t_key, { method: 'DELETE', From a161f2dcc09bf9265cf689002646f952a861279d Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Wed, 19 Feb 2025 18:34:27 +0300 Subject: [PATCH 6/6] Update text --- .../layout/designer/editor/custom/DesignCustomTokens.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/showcase/components/layout/designer/editor/custom/DesignCustomTokens.vue b/apps/showcase/components/layout/designer/editor/custom/DesignCustomTokens.vue index c51946d4d..fb73d5329 100644 --- a/apps/showcase/components/layout/designer/editor/custom/DesignCustomTokens.vue +++ b/apps/showcase/components/layout/designer/editor/custom/DesignCustomTokens.vue @@ -1,5 +1,7 @@