Add basic swap template functionality

[MAILPOET-6336]
This commit is contained in:
Rostislav Wolny
2024-12-04 13:25:03 +01:00
committed by Rostislav Wolný
parent 9f273a3ff2
commit 1fdda485d3
2 changed files with 21 additions and 2 deletions

View File

@ -17,7 +17,10 @@ import { storeName, TemplatePreview } from '../../store';
const BLANK_TEMPLATE = 'email-general';
export function SelectTemplateModal( { onSelectCallback } ) {
export function SelectTemplateModal( {
onSelectCallback,
closeCallback = null,
} ) {
const [ templates ] = usePreviewTemplates();
const hasTemplates = templates?.length > 0;
@ -46,7 +49,9 @@ export function SelectTemplateModal( { onSelectCallback } ) {
return (
<Modal
title="Select a template"
onRequestClose={ () => handleCloseWithoutSelection() }
onRequestClose={ () =>
closeCallback ? closeCallback() : handleCloseWithoutSelection()
}
isFullScreen
>
<div className="block-editor-block-patterns-explorer">