File tree Expand file tree Collapse file tree
resources/js/processes/screen-templates Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -252,6 +252,12 @@ export default {
252252 this .loading = false ;
253253 });
254254 },
255+ mounted () {
256+ this .bindPreviewTabClose (" #nav-myTemplates-tab" );
257+ },
258+ beforeDestroy () {
259+ this .unbindPreviewTabClose ();
260+ },
255261 methods: {
256262 handleSelectTemplate (template ) {
257263 this .selectedTemplate = template;
Original file line number Diff line number Diff line change @@ -261,6 +261,12 @@ export default {
261261 this .apiNoResults = false ;
262262 });
263263 },
264+ mounted () {
265+ this .bindPreviewTabClose (" #nav-publicTemplates-tab" );
266+ },
267+ beforeDestroy () {
268+ this .unbindPreviewTabClose ();
269+ },
264270 methods: {
265271 handleSelectTemplate (template ) {
266272 this .selectedTemplate = template;
Original file line number Diff line number Diff line change @@ -92,6 +92,33 @@ const templatePreviewMixin = {
9292 this . showTemplatePreview = false ;
9393 this . selectedTemplate = null ;
9494 } ,
95+ closePreviewFrame ( ) {
96+ if ( this . $refs ?. preview ?. onClose ) {
97+ this . $refs . preview . onClose ( ) ;
98+ return ;
99+ }
100+ if ( typeof this . onClose === "function" ) {
101+ this . onClose ( ) ;
102+ }
103+ } ,
104+ bindPreviewTabClose ( tabSelector ) {
105+ if ( ! tabSelector || typeof $ === "undefined" ) {
106+ return ;
107+ }
108+ this . _previewTabSelector = tabSelector ;
109+ this . _previewTabHandler = ( ) => {
110+ this . closePreviewFrame ( ) ;
111+ } ;
112+ $ ( tabSelector ) . on ( "hide.bs.tab.templatePreview" , this . _previewTabHandler ) ;
113+ } ,
114+ unbindPreviewTabClose ( ) {
115+ if ( ! this . _previewTabSelector || typeof $ === "undefined" ) {
116+ return ;
117+ }
118+ $ ( this . _previewTabSelector ) . off ( "hide.bs.tab.templatePreview" , this . _previewTabHandler ) ;
119+ this . _previewTabSelector = null ;
120+ this . _previewTabHandler = null ;
121+ } ,
95122 onClose ( ) {
96123 this . $emit ( 'mark-selected-row' , 0 ) ;
97124 this . showPreview = false ;
You can’t perform that action at this time.
0 commit comments