fix: report-edit
This commit is contained in:
parent
6c0a6f7367
commit
621817e963
@ -89,13 +89,6 @@ export default function EditarLaudoPage() {
|
||||
return () => clearTimeout(timeoutId);
|
||||
}, [content, campos, laudoId]);
|
||||
|
||||
// Sincronizar conteúdo com o editor
|
||||
useEffect(() => {
|
||||
if (editorRef.current && content) {
|
||||
editorRef.current.innerHTML = content;
|
||||
}
|
||||
}, [content]);
|
||||
|
||||
// Função para trocar de aba salvando conteúdo antes
|
||||
const handleTabChange = (newTab: string) => {
|
||||
// Salvar conteúdo do editor antes de trocar
|
||||
@ -103,16 +96,19 @@ export default function EditarLaudoPage() {
|
||||
const editorContent = editorRef.current.innerHTML;
|
||||
setContent(editorContent);
|
||||
}
|
||||
|
||||
// Se estiver voltando para o editor, restaurar conteúdo
|
||||
if (newTab === 'editor') {
|
||||
setTimeout(() => {
|
||||
if (editorRef.current && content) {
|
||||
editorRef.current.innerHTML = content;
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
setActiveTab(newTab);
|
||||
};
|
||||
|
||||
// Restaurar conteúdo quando volta para a aba editor
|
||||
useEffect(() => {
|
||||
if (activeTab === 'editor' && editorRef.current && content) {
|
||||
editorRef.current.innerHTML = content;
|
||||
}
|
||||
}, [activeTab]);
|
||||
|
||||
// Atualizar formatações ativas ao mudar seleção
|
||||
useEffect(() => {
|
||||
const updateFormats = () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user