fix: prepend signature instead of replacing email content
This commit is contained in:
parent
b634063f56
commit
c625206076
@ -479,22 +479,26 @@
|
||||
</div>
|
||||
<div class="flex gap-0.5">
|
||||
<Tooltip :text="__('Reply')">
|
||||
<Button
|
||||
variant="ghost"
|
||||
class="text-gray-700"
|
||||
@click="reply(activity.data)"
|
||||
>
|
||||
<ReplyIcon class="h-4 w-4" />
|
||||
</Button>
|
||||
<div>
|
||||
<Button
|
||||
variant="ghost"
|
||||
class="text-gray-700"
|
||||
@click="reply(activity.data)"
|
||||
>
|
||||
<ReplyIcon class="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</Tooltip>
|
||||
<Tooltip :text="__('Reply All')">
|
||||
<Button
|
||||
variant="ghost"
|
||||
class="text-gray-700"
|
||||
@click="reply(activity.data, true)"
|
||||
>
|
||||
<ReplyAllIcon class="h-4 w-4" />
|
||||
</Button>
|
||||
<div>
|
||||
<Button
|
||||
variant="ghost"
|
||||
class="text-gray-700"
|
||||
@click="reply(activity.data, true)"
|
||||
>
|
||||
<ReplyAllIcon class="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -144,16 +144,23 @@ const signature = createResource({
|
||||
auto: true,
|
||||
})
|
||||
|
||||
function setSignature(editor) {
|
||||
signature.data = signature.data.replace(/\n/g, '<br>')
|
||||
let emailContent = editor.getHTML()
|
||||
emailContent = emailContent.startsWith('<p></p>')
|
||||
? emailContent.slice(7)
|
||||
: emailContent
|
||||
editor.commands.setContent(signature.data + emailContent)
|
||||
editor.commands.focus('start')
|
||||
}
|
||||
|
||||
watch(
|
||||
() => showEmailBox.value,
|
||||
(value) => {
|
||||
if (value) {
|
||||
newEmailEditor.value.editor.commands.focus()
|
||||
|
||||
if (!newEmail.value && signature.data) {
|
||||
signature.data = signature.data.replace(/\n/g, '<br>')
|
||||
newEmail.value = signature.data
|
||||
}
|
||||
let editor = newEmailEditor.value.editor
|
||||
editor.commands.focus()
|
||||
setSignature(editor)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user