Improve: enhance real-time paste handling and add saving status feedback
This commit is contained in:
@@ -32,6 +32,7 @@ const PastePanel = ({ onSubmit, publicPastes, mode, pasteKey: propKey, onConnect
|
|||||||
syntax: "",
|
syntax: "",
|
||||||
burnAfter: false,
|
burnAfter: false,
|
||||||
isPrivate: false,
|
isPrivate: false,
|
||||||
|
isRt: false,
|
||||||
password: ""
|
password: ""
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -113,7 +114,8 @@ const PastePanel = ({ onSubmit, publicPastes, mode, pasteKey: propKey, onConnect
|
|||||||
const dataToSave = {
|
const dataToSave = {
|
||||||
...formData,
|
...formData,
|
||||||
pasteKey: activeKey,
|
pasteKey: activeKey,
|
||||||
title: mode === 'rt' ? `Sesión: ${activeKey?.substring(0, 8)}` : formData.title
|
isRt: true,
|
||||||
|
title: mode === 'rt' ? `Sesión: ${activeKey}` : formData.title
|
||||||
};
|
};
|
||||||
await onSubmit(dataToSave, true);
|
await onSubmit(dataToSave, true);
|
||||||
lastSavedContent.current = formData.content;
|
lastSavedContent.current = formData.content;
|
||||||
@@ -131,7 +133,7 @@ const PastePanel = ({ onSubmit, publicPastes, mode, pasteKey: propKey, onConnect
|
|||||||
}, [formData.content, mode, connected, activeKey]);
|
}, [formData.content, mode, connected, activeKey]);
|
||||||
|
|
||||||
const handleChange = (key, value) => {
|
const handleChange = (key, value) => {
|
||||||
const updatedData = { ...formData, [key]: value };
|
const updatedData = { ...formData, [key]: value, isRt: mode === 'rt' };
|
||||||
|
|
||||||
setFormData(updatedData);
|
setFormData(updatedData);
|
||||||
|
|
||||||
@@ -255,7 +257,7 @@ const PastePanel = ({ onSubmit, publicPastes, mode, pasteKey: propKey, onConnect
|
|||||||
<Form.Control
|
<Form.Control
|
||||||
disabled={isReadOnly}
|
disabled={isReadOnly}
|
||||||
type="text"
|
type="text"
|
||||||
value={mode === 'rt' ? `Sesión: ${activeKey?.substring(0, 8)}` : formData.title}
|
value={mode === 'rt' ? `Sesión: ${activeKey}` : formData.title}
|
||||||
onChange={(e) => handleChange("title", e.target.value)}
|
onChange={(e) => handleChange("title", e.target.value)}
|
||||||
isInvalid={!!fieldErrors.title}
|
isInvalid={!!fieldErrors.title}
|
||||||
/>
|
/>
|
||||||
@@ -308,6 +310,19 @@ const PastePanel = ({ onSubmit, publicPastes, mode, pasteKey: propKey, onConnect
|
|||||||
</Form.Select>
|
</Form.Select>
|
||||||
</FloatingLabel>
|
</FloatingLabel>
|
||||||
|
|
||||||
|
<div className="d-flex align-items-center ms-1">
|
||||||
|
{isSaving ? (
|
||||||
|
<span className="text-muted" style={{ fontSize: '0.8rem' }}>
|
||||||
|
<FontAwesomeIcon icon={faCircle} className="pulse-animation me-2" style={{ color: '#ffc107', fontSize: '8px' }} />
|
||||||
|
Guardando cambios...
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span className="text-success" style={{ fontSize: '0.8rem' }}>
|
||||||
|
Cambios guardados
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
<Form.Check
|
<Form.Check
|
||||||
type="switch"
|
type="switch"
|
||||||
disabled={isReadOnly}
|
disabled={isReadOnly}
|
||||||
|
|||||||
Reference in New Issue
Block a user