forked from Kieran/snort
fix: note creator fixes
This commit is contained in:
parent
7a6d5f53be
commit
6ce852e888
@ -27,10 +27,10 @@ export function NoteCreator(props) {
|
|||||||
console.debug("Sending note: ", ev);
|
console.debug("Sending note: ", ev);
|
||||||
publisher.broadcast(ev);
|
publisher.broadcast(ev);
|
||||||
setNote("");
|
setNote("");
|
||||||
setActive(false);
|
|
||||||
if (typeof onSend === "function") {
|
if (typeof onSend === "function") {
|
||||||
onSend();
|
onSend();
|
||||||
}
|
}
|
||||||
|
setActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function attachFile() {
|
async function attachFile() {
|
||||||
@ -58,20 +58,22 @@ export function NoteCreator(props) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onSubmit(ev) {
|
||||||
|
ev.stopPropagation();
|
||||||
|
sendNote()
|
||||||
|
}
|
||||||
|
|
||||||
if (!show) return false;
|
if (!show) return false;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div className={`flex note-creator ${replyTo ? 'note-reply' : ''}`}>
|
||||||
key={replyTo ? `note-reply-${replyTo.Id}` : `note-creator`}
|
|
||||||
className={`flex note-creator ${replyTo ? 'note-reply' : ''}`}
|
|
||||||
>
|
|
||||||
<div className="flex f-col mr10 f-grow">
|
<div className="flex f-col mr10 f-grow">
|
||||||
<Textarea
|
<Textarea
|
||||||
autoFocus={autoFocus}
|
autoFocus={autoFocus}
|
||||||
className={`textarea ${active ? "textarea--focused" : ""}`}
|
className={`textarea ${active ? "textarea--focused" : ""}`}
|
||||||
users={users}
|
users={users}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onBlur={() => setActive(false)}
|
value={note}
|
||||||
onFocus={() => setActive(true)}
|
onFocus={() => setActive(true)}
|
||||||
/>
|
/>
|
||||||
{active && note && (
|
{active && note && (
|
||||||
@ -80,7 +82,9 @@ export function NoteCreator(props) {
|
|||||||
{error.length > 0 ? <b className="error">{error}</b> : null}
|
{error.length > 0 ? <b className="error">{error}</b> : null}
|
||||||
<FontAwesomeIcon icon={faPaperclip} size="xl" onClick={(e) => attachFile()} />
|
<FontAwesomeIcon icon={faPaperclip} size="xl" onClick={(e) => attachFile()} />
|
||||||
</div>
|
</div>
|
||||||
<div className="btn" onClick={() => sendNote()}>Send</div>
|
<button type="button" className="btn" onClick={onSubmit}>
|
||||||
|
{replyTo ? 'Reply' : 'Send'}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user