fix: append new line after file upload placeholder in editor
This commit is contained in:
@@ -104,7 +104,7 @@ export default function PostContent({
|
|||||||
<div className="flex gap-2 items-center">
|
<div className="flex gap-2 items-center">
|
||||||
<Uploader
|
<Uploader
|
||||||
onUploadSuccess={({ url }) => {
|
onUploadSuccess={({ url }) => {
|
||||||
textareaRef.current?.appendText(url)
|
textareaRef.current?.appendText(url + '\n')
|
||||||
}}
|
}}
|
||||||
onUploadingChange={(uploading) =>
|
onUploadingChange={(uploading) =>
|
||||||
setUploadingFiles((prev) => (uploading ? prev + 1 : prev - 1))
|
setUploadingFiles((prev) => (uploading ? prev + 1 : prev - 1))
|
||||||
|
|||||||
@@ -99,10 +99,8 @@ async function uploadFile(view: EditorView, file: File, options: ClipboardAndDro
|
|||||||
options.onUploadStart?.(file)
|
options.onUploadStart?.(file)
|
||||||
|
|
||||||
const placeholder = `[Uploading "${name}"...]`
|
const placeholder = `[Uploading "${name}"...]`
|
||||||
const uploadingNode = view.state.schema.text(placeholder)
|
const uploadingNode = view.state.schema.text(placeholder + '\n')
|
||||||
const paragraph = view.state.schema.nodes.paragraph.create()
|
const tr = view.state.tr.replaceSelectionWith(uploadingNode)
|
||||||
let tr = view.state.tr.replaceSelectionWith(uploadingNode)
|
|
||||||
tr = tr.insert(tr.selection.to, paragraph)
|
|
||||||
view.dispatch(tr)
|
view.dispatch(tr)
|
||||||
|
|
||||||
mediaUpload
|
mediaUpload
|
||||||
|
|||||||
Reference in New Issue
Block a user