From a69bd1d80caa52eeabee0031d112ad736ed08a9b Mon Sep 17 00:00:00 2001 From: Boshnik Date: Fri, 29 Mar 2024 16:08:38 +0200 Subject: [PATCH 1/2] added preview image --- .../clientconfig/css/mgr/clientconfig.css | 3 ++ .../clientconfig/js/mgr/sections/home.js | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/assets/components/clientconfig/css/mgr/clientconfig.css b/assets/components/clientconfig/css/mgr/clientconfig.css index 50b3b8e..afb1791 100644 --- a/assets/components/clientconfig/css/mgr/clientconfig.css +++ b/assets/components/clientconfig/css/mgr/clientconfig.css @@ -1,3 +1,6 @@ .x-color-palette { height: auto; } +.modx-tv-image-preview { + margin-top: 7px; +} \ No newline at end of file diff --git a/assets/components/clientconfig/js/mgr/sections/home.js b/assets/components/clientconfig/js/mgr/sections/home.js index c57d801..c75cd24 100755 --- a/assets/components/clientconfig/js/mgr/sections/home.js +++ b/assets/components/clientconfig/js/mgr/sections/home.js @@ -155,6 +155,27 @@ Ext.extend(ClientConfig.page.Home,MODx.Component,{ }); } } + if (field.xtype === 'modx-panel-tv-image') { + field.listeners.afterrender = function(data) { + setTimeout(() => { + const el = Ext.getCmp(field.id + '-preview'); + if (Ext.isEmpty(data.value)) { + el.update(''); + } else { + el.update(''); + + } + },0); + }; + field.listeners.select = function(data) { + const el = Ext.getCmp(field.id + '-preview'); + if (Ext.isEmpty(data.url)) { + el.update(''); + } else { + el.update(''); + } + }; + } } } @@ -207,6 +228,15 @@ Ext.extend(ClientConfig.page.Home,MODx.Component,{ fields.push(field); + if (field.xtype === 'modx-panel-tv-image') { + fields.push({ + anchor: '100%', + html: '', + bodyCssClass: 'modx-tv-image-preview', + id: field.id + '-preview', + }); + } + if (value.description && value.description.length > 0) { var fieldDescription = { xtype: 'label', From 9e8328712bffd77622bfdd15b2d1100ff74a1192 Mon Sep 17 00:00:00 2001 From: Boshnik Date: Sat, 14 Sep 2024 10:51:41 +0300 Subject: [PATCH 2/2] fix media source --- assets/components/clientconfig/js/mgr/sections/home.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/components/clientconfig/js/mgr/sections/home.js b/assets/components/clientconfig/js/mgr/sections/home.js index c75cd24..eb9ab69 100755 --- a/assets/components/clientconfig/js/mgr/sections/home.js +++ b/assets/components/clientconfig/js/mgr/sections/home.js @@ -162,7 +162,7 @@ Ext.extend(ClientConfig.page.Home,MODx.Component,{ if (Ext.isEmpty(data.value)) { el.update(''); } else { - el.update(''); + el.update(''); } },0); @@ -172,7 +172,7 @@ Ext.extend(ClientConfig.page.Home,MODx.Component,{ if (Ext.isEmpty(data.url)) { el.update(''); } else { - el.update(''); + el.update(''); } }; }