forked from RiseUP/riseup-squad20
fix: report-edit
This commit is contained in:
parent
6c0a6f7367
commit
621817e963
@ -89,13 +89,6 @@ export default function EditarLaudoPage() {
|
|||||||
return () => clearTimeout(timeoutId);
|
return () => clearTimeout(timeoutId);
|
||||||
}, [content, campos, laudoId]);
|
}, [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
|
// Função para trocar de aba salvando conteúdo antes
|
||||||
const handleTabChange = (newTab: string) => {
|
const handleTabChange = (newTab: string) => {
|
||||||
// Salvar conteúdo do editor antes de trocar
|
// Salvar conteúdo do editor antes de trocar
|
||||||
@ -103,16 +96,19 @@ export default function EditarLaudoPage() {
|
|||||||
const editorContent = editorRef.current.innerHTML;
|
const editorContent = editorRef.current.innerHTML;
|
||||||
setContent(editorContent);
|
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);
|
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
|
// Atualizar formatações ativas ao mudar seleção
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const updateFormats = () => {
|
const updateFormats = () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user