mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 19:58:09 +00:00
template name as subject (#2892)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
febbb0cd08
commit
95568ef948
@ -165,6 +165,9 @@
|
||||
const editorHandler: TextEditorHandler = {
|
||||
insertText: (text) => {
|
||||
textEditor.insertText(text)
|
||||
},
|
||||
insertTemplate: (name, text) => {
|
||||
textEditor.insertText(text)
|
||||
}
|
||||
}
|
||||
function handleAction (a: RefAction, evt?: Event): void {
|
||||
|
@ -217,6 +217,10 @@
|
||||
const editorHandler: TextEditorHandler = {
|
||||
insertText: (text) => {
|
||||
textEditor.insertText(text)
|
||||
},
|
||||
insertTemplate: (name, text) => {
|
||||
textEditor.insertText(text)
|
||||
dispatch('template', name)
|
||||
}
|
||||
}
|
||||
function handleAction (a: RefAction, evt?: Event): void {
|
||||
|
@ -7,6 +7,7 @@ import type { AnySvelteComponent } from '@hcengineering/ui'
|
||||
*/
|
||||
export interface TextEditorHandler {
|
||||
insertText: (html: string) => void
|
||||
insertTemplate: (name: string, html: string) => void
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
|
@ -148,6 +148,14 @@
|
||||
},
|
||||
(res) => (attachments = res)
|
||||
)
|
||||
|
||||
function onTemplate (e: CustomEvent<string>): void {
|
||||
if (e.detail !== undefined) {
|
||||
if (obj.subject.trim() === '') {
|
||||
obj.subject = e.detail
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<input
|
||||
@ -215,7 +223,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
<div class="input mt-4 clear-mins">
|
||||
<StyledTextEditor full bind:content={obj.content} maxHeight="panel" />
|
||||
<StyledTextEditor full bind:content={obj.content} maxHeight="panel" on:template={onTemplate} />
|
||||
</div>
|
||||
</div>
|
||||
</Scroller>
|
||||
|
@ -212,6 +212,14 @@
|
||||
integrations = res.filter((p) => p.createdBy === me || p.shared?.includes(me))
|
||||
selectedIntegration = integrations.find((p) => p.createdBy === me) ?? integrations[0]
|
||||
})
|
||||
|
||||
function onTemplate (e: CustomEvent<string>): void {
|
||||
if (e.detail !== undefined) {
|
||||
if (subject.trim() === '') {
|
||||
subject = e.detail
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<Panel
|
||||
@ -325,7 +333,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
<div class="input mt-4 clear-mins">
|
||||
<StyledTextEditor full bind:content />
|
||||
<StyledTextEditor full bind:content on:template={onTemplate} />
|
||||
</div>
|
||||
</div>
|
||||
</Scroller>
|
||||
|
@ -49,7 +49,7 @@
|
||||
const provider = getTemplateDataProvider()
|
||||
async function dispatchItem (item: MessageTemplate): Promise<void> {
|
||||
const message = await provider.fillTemplate(item.message)
|
||||
editor.insertText(message)
|
||||
editor.insertTemplate(item.title, message)
|
||||
closePopup()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user