fix(markdown): address code review findings — updateItem, height measurement, CSS injection, paste fallback, resize sprite update

This commit is contained in:
Hiren Kangad
2026-03-13 11:21:28 +05:30
parent dfdfd07a1d
commit 04d499b755
5 changed files with 31 additions and 7 deletions
@@ -7,6 +7,7 @@ import React, { useCallback, useEffect, useRef } from 'react';
import { useCreateBlockNote } from '@blocknote/react';
import { BlockNoteViewRaw } from '@blocknote/react';
import '@blocknote/react/style.css';
import { MD_BLOCKNOTE_DARK_CSS } from '../canvas/markdownStyles';
interface MarkdownEditViewProps {
initialContent: string;
@@ -24,6 +25,17 @@ export default function MarkdownEditView(props: MarkdownEditViewProps) {
const { initialContent, accentColor, onSave, onCancel } = props;
const savedRef = useRef(false);
// Inject BlockNote dark theme CSS overrides (once)
useEffect(() => {
const id = 'bn-dark-theme-overrides';
if (!document.getElementById(id)) {
const style = document.createElement('style');
style.id = id;
style.textContent = MD_BLOCKNOTE_DARK_CSS;
document.head.appendChild(style);
}
}, []);
const editor = useCreateBlockNote({
domAttributes: {
editor: {