edit template HTML in modal
This commit is contained in:
parent
b415fb2089
commit
27498a4926
|
@ -4,6 +4,8 @@
|
||||||
Heading,
|
Heading,
|
||||||
Divider,
|
Divider,
|
||||||
Label,
|
Label,
|
||||||
|
Modal,
|
||||||
|
ModalContent,
|
||||||
notifications,
|
notifications,
|
||||||
Layout,
|
Layout,
|
||||||
Input,
|
Input,
|
||||||
|
@ -24,6 +26,7 @@
|
||||||
let templateIdx = 0
|
let templateIdx = 0
|
||||||
let templateDefinition
|
let templateDefinition
|
||||||
let templates = []
|
let templates = []
|
||||||
|
let htmlModal
|
||||||
|
|
||||||
$: templateTypes = templates.map((template, idx) => ({
|
$: templateTypes = templates.map((template, idx) => ({
|
||||||
label: template.purpose,
|
label: template.purpose,
|
||||||
|
@ -154,19 +157,19 @@
|
||||||
</Body>
|
</Body>
|
||||||
<div class="template-controls">
|
<div class="template-controls">
|
||||||
<Select bind:value={templateIdx} options={templateTypes} />
|
<Select bind:value={templateIdx} options={templateTypes} />
|
||||||
<Button cta on:click={saveTemplate}>Save</Button>
|
<Button primary on:click={htmlModal.show}>Edit HTML</Button>
|
||||||
</div>
|
</div>
|
||||||
{#if selectedTemplate}
|
|
||||||
{#key templateIdx}
|
|
||||||
<Editor
|
|
||||||
mode="handlebars"
|
|
||||||
on:change={e => {
|
|
||||||
selectedTemplate.contents = e.detail.value
|
|
||||||
}}
|
|
||||||
value={selectedTemplate.contents} />
|
|
||||||
{/key}
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
<Modal bind:this={htmlModal}>
|
||||||
|
<ModalContent title="Edit Template HTML" onConfirm={saveTemplate} size="XL">
|
||||||
|
<Editor
|
||||||
|
mode="handlebars"
|
||||||
|
on:change={e => {
|
||||||
|
selectedTemplate.contents = e.detail.value
|
||||||
|
}}
|
||||||
|
value={selectedTemplate.contents} />
|
||||||
|
</ModalContent>
|
||||||
|
</Modal>
|
||||||
{/if}
|
{/if}
|
||||||
</Page>
|
</Page>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue