fix: Web Share Target text field merge (#1572)

Co-authored-by: userquin <userquin@gmail.com>
This commit is contained in:
Horváth Bálint 2023-02-03 15:20:32 +01:00 committed by GitHub
parent 6eedaa98bc
commit faa96c7705
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 12 deletions

View file

@ -111,10 +111,16 @@ useWebShareTarget(async ({ data: { data, action } }: any) => {
editor.value?.commands.focus('end')
if (data.text !== undefined)
editor.value?.commands.insertContent(data.text)
for (const text of data.textParts) {
for (const line of text.split('\n')) {
editor.value?.commands.insertContent({
type: 'paragraph',
content: [{ type: 'text', text: line }],
})
}
}
if (data.files !== undefined)
if (data.files.length !== 0)
await uploadAttachments(data.files)
})