diff --git a/includes/template-previews.html b/includes/template-previews.html index e880d51..42b7ac7 100644 --- a/includes/template-previews.html +++ b/includes/template-previews.html @@ -54,8 +54,8 @@
- -
- + +
+
\ No newline at end of file diff --git a/layouts/main.html b/layouts/main.html index 223cfcc..d8cf17d 100644 --- a/layouts/main.html +++ b/layouts/main.html @@ -172,21 +172,33 @@ templateDropdownShow: false, iframeReady: false, activeTemplate: null, - url: 'about:blank', - changeURL: function(url){ - this.iframeReady=false; - this.url = url; - }, + templateURL: 'about:blank', + iframeURL: 'about:blank', changeTheme: function(slug, url){ + this.ifreamReady=false; window.dispatchEvent(new CustomEvent('change-template', { detail : { slug: slug }})); - this.url = 'about:blank'; + this.iframeURL = 'about:blank'; let that = this; setTimeout(function(){ that.changeURL(url); + that.iframeReady=true; console.log('change'); console.log(slug); }, 100); }, + showTemplatePreview: function(templateURL){ + this.iframeURL = 'about:blank'; + if(window.innerWidth < 768){ + window.open(url, '_blank'); + }else{ + this.templatePreview=true; + let that = this; + setTimeout(function(){ + that.iframeReady=true; + that.iframeURL=templateURL; + }, 10); + } + }, templateInstallCommand(){ if(this.activeTemplate != null){ if(this.activeTemplate.slug == 'starter'){ @@ -246,9 +258,14 @@ if(value){ window.dispatchEvent(new CustomEvent('close-mobile-menu', {})); } + }); + $watch('templatePreview', function(value){ + if(!value){ + url = 'about:blank'; + } }) " - @show-template-preview.window="url=event.detail.url; if(window.innerWidth < 768){ window.open(url, '_blank'); }else{ templatePreview=true }" + @show-template-preview.window="showTemplatePreview(event.detail.url);" @set-active-template.window="setActiveTemplate(event.detail.slug);" @close-left-sidebar.window="leftSidebar = false" x-init="route=window.location.pathname"