fix(editor): custom image width parsing, fix image paste, add AI submenu features

This commit is contained in:
2026-05-03 00:08:28 +02:00
parent d0387cd9a0
commit 54b7b4fcf1
19 changed files with 3890 additions and 3490 deletions

View File

@@ -452,6 +452,7 @@ export function NoteInput({
// Paste handler: upload clipboard images
useEffect(() => {
const handlePaste = async (e: ClipboardEvent) => {
if (type === 'richtext' && (e.target as HTMLElement)?.closest('.notion-editor')) return;
const items = e.clipboardData?.items
if (!items) return
for (const item of Array.from(items)) {
@@ -468,8 +469,8 @@ export function NoteInput({
}
}
}
document.addEventListener('paste', handlePaste)
return () => document.removeEventListener('paste', handlePaste)
document.addEventListener('paste', handlePaste, { capture: true })
return () => document.removeEventListener('paste', handlePaste, { capture: true } as any)
}, [t])
// AI title from images
@@ -774,6 +775,7 @@ export function NoteInput({
content={content}
onChange={setContent}
className="min-h-[120px]"
onImageUpload={uploadImageFile}
/>
) : type === 'text' || type === 'markdown' ? (
<>
@@ -1101,3 +1103,4 @@ export function NoteInput({
</div>
)
}