mirror of
https://github.com/fiatjaf/nak.git
synced 2024-10-30 00:59:07 -04:00
do not act on input blank.
This commit is contained in:
parent
c2a826e854
commit
b94219512f
|
@ -85,7 +85,7 @@ object Main extends IOWebApp {
|
||||||
cls := "w-full max-h-96 p-3 rounded",
|
cls := "w-full max-h-96 p-3 rounded",
|
||||||
styleAttr := "min-height: 280px; font-family: monospace",
|
styleAttr := "min-height: 280px; font-family: monospace",
|
||||||
spellCheck := false,
|
spellCheck := false,
|
||||||
placeholder := "paste something nostric",
|
placeholder := "paste something nostric (event JSON, nprofile, npub, nevent etc or hex key or id)",
|
||||||
onInput --> (_.foreach(_ =>
|
onInput --> (_.foreach(_ =>
|
||||||
self.value.get.flatMap(store.input.set)
|
self.value.get.flatMap(store.input.set)
|
||||||
)),
|
)),
|
||||||
|
|
|
@ -12,7 +12,8 @@ type Result = Either[
|
||||||
]
|
]
|
||||||
|
|
||||||
object Parser {
|
object Parser {
|
||||||
def parseInput(input: String): Result =
|
def parseInput(input: String): Result = if input == "" then Left("")
|
||||||
|
else
|
||||||
ByteVector
|
ByteVector
|
||||||
.fromHex(input)
|
.fromHex(input)
|
||||||
.flatMap(b => Try(Right(ByteVector32(b))).toOption)
|
.flatMap(b => Try(Right(ByteVector32(b))).toOption)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user