fix: wrap generated body from link in markdown quotes, close #694

This commit is contained in:
Xylight committed 2025-12-01 21:01:03 -08:00
1 parent 7b63f5a643
commit 09916d08d1
1 file changed
+25 -10
+25 -10
View File
@@ -72,17 +72,33 @@
let uploadImage = $state(false) let uploadImage = $state(false)
async function autofill( async function autofill(
url: URL, data: URL | { title?: string; body?: string },
): Promise<{ title?: string; body?: string }> { ): Promise<{ title?: string; body?: string }> {
const res = await autofillPost(url) if (data instanceof URL) {
const res = await autofillPost(data)
if (settings.forms.autosubmitAutofill) { if (settings.forms.autosubmitAutofill) {
form.title = res.title || form.title autofill({
form.body = res.body || form.body title: res.title,
history?.back?.() body: res.body,
})
history?.back?.()
}
return res
} else {
form.title = data.title || form.title
form.body =
data.body
?.split('\n')
.map((i) => `> ${i}`)
.join('\n') || form.body
return {
title: form.title,
body: form.body,
}
} }
return res
} }
</script> </script>
@@ -172,8 +188,7 @@
size="lg" size="lg"
color="primary" color="primary"
onclick={() => { onclick={() => {
form.title = url.title ?? form.title autofill({ title: url.title, body: url.body })
form.body = url.body ?? form.body
history.back() history.back()
}} }}
> >