diff --git a/susconecta/app/paciente/page.tsx b/susconecta/app/paciente/page.tsx
index 4ac5828..f76067b 100644
--- a/susconecta/app/paciente/page.tsx
+++ b/susconecta/app/paciente/page.tsx
@@ -528,6 +528,11 @@ export default function PacientePage() {
Portal do Paciente
+
diff --git a/susconecta/app/profissional/page.tsx b/susconecta/app/profissional/page.tsx
index 7976db9..a2bbc4e 100644
--- a/susconecta/app/profissional/page.tsx
+++ b/susconecta/app/profissional/page.tsx
@@ -2033,14 +2033,40 @@ Nevo melanocítico benigno. Seguimento clínico recomendado.
}
}, [laudo, isNewLaudo]);
- const formatText = (type: string) => {
+ // Histórico para desfazer/refazer
+ const [history, setHistory] = useState
([]);
+ const [historyIndex, setHistoryIndex] = useState(-1);
+
+ // Atualiza histórico ao digitar
+ useEffect(() => {
+ if (history[historyIndex] !== content) {
+ const newHistory = history.slice(0, historyIndex + 1);
+ setHistory([...newHistory, content]);
+ setHistoryIndex(newHistory.length);
+ }
+ // eslint-disable-next-line
+ }, [content]);
+
+ const handleUndo = () => {
+ if (historyIndex > 0) {
+ setContent(history[historyIndex - 1]);
+ setHistoryIndex(historyIndex - 1);
+ }
+ };
+ const handleRedo = () => {
+ if (historyIndex < history.length - 1) {
+ setContent(history[historyIndex + 1]);
+ setHistoryIndex(historyIndex + 1);
+ }
+ };
+
+ // Formatação avançada
+ const formatText = (type: string, value?: any) => {
const textarea = document.querySelector('textarea') as HTMLTextAreaElement;
if (!textarea) return;
-
const start = textarea.selectionStart;
const end = textarea.selectionEnd;
const selectedText = textarea.value.substring(start, end);
-
let formattedText = "";
switch(type) {
case "bold":
@@ -2050,13 +2076,44 @@ Nevo melanocítico benigno. Seguimento clínico recomendado.
formattedText = selectedText ? `*${selectedText}*` : "*texto em itálico*";
break;
case "underline":
- formattedText = selectedText ? `${selectedText}` : "texto sublinhado";
+ formattedText = selectedText ? `__${selectedText}__` : "__texto sublinhado__";
break;
- case "list":
- formattedText = selectedText ? `• ${selectedText}` : "• item da lista";
+ case "list-ul":
+ formattedText = selectedText ? selectedText.split('\n').map(l => `• ${l}`).join('\n') : "• item da lista";
break;
+ case "list-ol":
+ formattedText = selectedText ? selectedText.split('\n').map((l,i) => `${i+1}. ${l}`).join('\n') : "1. item da lista";
+ break;
+ case "indent":
+ formattedText = selectedText ? selectedText.split('\n').map(l => ` ${l}`).join('\n') : " ";
+ break;
+ case "outdent":
+ formattedText = selectedText ? selectedText.split('\n').map(l => l.replace(/^\s{1,4}/, "")).join('\n') : "";
+ break;
+ case "align-left":
+ formattedText = selectedText ? `[left]${selectedText}[/left]` : "[left]Texto à esquerda[/left]";
+ break;
+ case "align-center":
+ formattedText = selectedText ? `[center]${selectedText}[/center]` : "[center]Texto centralizado[/center]";
+ break;
+ case "align-right":
+ formattedText = selectedText ? `[right]${selectedText}[/right]` : "[right]Texto à direita[/right]";
+ break;
+ case "align-justify":
+ formattedText = selectedText ? `[justify]${selectedText}[/justify]` : "[justify]Texto justificado[/justify]";
+ break;
+ case "font-size":
+ formattedText = selectedText ? `[size=${value}]${selectedText}[/size]` : `[size=${value}]Texto tamanho ${value}[/size]`;
+ break;
+ case "font-family":
+ formattedText = selectedText ? `[font=${value}]${selectedText}[/font]` : `[font=${value}]${value}[/font]`;
+ break;
+ case "font-color":
+ formattedText = selectedText ? `[color=${value}]${selectedText}[/color]` : `[color=${value}]${value}[/color]`;
+ break;
+ default:
+ return;
}
-
const newText = textarea.value.substring(0, start) + formattedText + textarea.value.substring(end);
setContent(newText);
};
@@ -2085,7 +2142,14 @@ Nevo melanocítico benigno. Seguimento clínico recomendado.
return content
.replace(/\*\*(.*?)\*\*/g, '$1')
.replace(/\*(.*?)\*/g, '$1')
- .replace(/(.*?)<\/u>/g, '$1')
+ .replace(/__(.*?)__/g, '$1')
+ .replace(/\[left\](.*?)\[\/left\]/gs, '$1
')
+ .replace(/\[center\](.*?)\[\/center\]/gs, '$1
')
+ .replace(/\[right\](.*?)\[\/right\]/gs, '$1
')
+ .replace(/\[justify\](.*?)\[\/justify\]/gs, '$1
')
+ .replace(/\[size=(\d+)\](.*?)\[\/size\]/gs, '$2')
+ .replace(/\[font=([^\]]+)\](.*?)\[\/font\]/gs, '$2')
+ .replace(/\[color=([^\]]+)\](.*?)\[\/color\]/gs, '$2')
.replace(/{{sexo_paciente}}/g, pacienteSelecionado?.sexo || laudo?.paciente?.sexo || '[SEXO]')
.replace(/{{diagnostico}}/g, campos.diagnostico || '[DIAGNÓSTICO]')
.replace(/{{conclusao}}/g, campos.conclusao || '[CONCLUSÃO]')
@@ -2384,44 +2448,60 @@ Nevo melanocítico benigno. Seguimento clínico recomendado.