diff --git a/components/PanelPages/BlogEditorSection.tsx b/components/PanelPages/BlogEditorSection.tsx index 2cadf06..7c094ac 100644 --- a/components/PanelPages/BlogEditorSection.tsx +++ b/components/PanelPages/BlogEditorSection.tsx @@ -13,6 +13,7 @@ const normalizeUrl = (u: string) => { const t = u.trim() if (/^(https?:|data:|blob:)/i.test(t)) return t if (t.startsWith('//')) return `https:${t}` + if (t.startsWith('/')) return t return `https://${t.replace(/^\/+/, '')}` } @@ -1486,11 +1487,11 @@ const RichTextEditor: React.FC<{ setImageUrl('') }} onFileUpload={async (file) => { - setImageModalOpen(false) const permanentUrl = await uploadBlogImage(file) if (permanentUrl) { insertPlaceholder('image', permanentUrl) } + setImageModalOpen(false) }} onCancel={() => { setImageModalOpen(false); setImageUrl('') }} /> @@ -1609,11 +1610,12 @@ const InsertImageModal: React.FC<{ type="file" accept="image/*" className="hidden" - onChange={(e) => { + onChange={async (e) => { const file = e.target.files?.[0] if (file) { setUploading(true) - onFileUpload(file) + await onFileUpload(file) + setUploading(false) } }} />