Compare commits

..

No commits in common. "main" and "develop" have entirely different histories.

View File

@ -236,20 +236,7 @@ export default function EditarLaudoPage() {
useEffect(() => {
if (content && editorRef.current && !loading) {
console.log('[EditarLaudoPage] Injecting content into editor, length:', content.length);
// Só injetar se o conteúdo do editor estiver vazio ou muito diferente
const currentContent = editorRef.current.innerHTML;
if (!currentContent || currentContent.length === 0) {
editorRef.current.innerHTML = content;
// Mover cursor para o final
const range = document.createRange();
const sel = window.getSelection();
if (editorRef.current.childNodes.length > 0) {
range.selectNodeContents(editorRef.current);
range.collapse(false); // false = colapsar no final
sel?.removeAllRanges();
sel?.addRange(range);
}
}
editorRef.current.innerHTML = content;
}
}, [content, loading]);
@ -597,10 +584,7 @@ export default function EditarLaudoPage() {
<div
ref={editorRef}
contentEditable
onInput={(e) => {
// Capturar conteúdo sem perder posição do cursor
setContent(e.currentTarget.innerHTML);
}}
onInput={(e) => setContent(e.currentTarget.innerHTML)}
onPaste={(e) => {
e.preventDefault();
const text = e.clipboardData.getData('text/plain');