mirror of
https://github.com/livebook-dev/livebook.git
synced 2026-02-19 08:53:21 +08:00
Update :debounce default fallback for range input
This commit is contained in:
parent
e2abc760a4
commit
706eb42dc0
2 changed files with 8 additions and 2 deletions
|
|
@ -341,7 +341,7 @@ defprotocol Livebook.Runtime do
|
|||
type: :range,
|
||||
default: number(),
|
||||
label: String.t(),
|
||||
debounce: :blur | non_neg_integer(),
|
||||
debounce: non_neg_integer(),
|
||||
min: number(),
|
||||
max: number(),
|
||||
step: number()
|
||||
|
|
|
|||
|
|
@ -2892,7 +2892,13 @@ defmodule Livebook.Session do
|
|||
defp normalize_runtime_output(%{type: :input, attrs: attrs} = output)
|
||||
when attrs.type in [:text, :textarea, :password, :number, :url, :range, :color] and
|
||||
not is_map_key(attrs, :debounce) do
|
||||
put_in(output.attrs[:debounce], :blur)
|
||||
default =
|
||||
case attrs.type do
|
||||
:range -> 250
|
||||
_other -> :blur
|
||||
end
|
||||
|
||||
put_in(output.attrs[:debounce], default)
|
||||
|> normalize_runtime_output()
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue