fix navigation with search

This commit is contained in:
Nordup 2023-06-27 00:58:30 +04:00
parent 985f252430
commit 2bd62d2564
2 changed files with 11 additions and 3 deletions

View file

@ -33,7 +33,7 @@ func on_go_back() -> void:
enable([go_forw])
if history.can_back():
gate_events.open_gate_emit(location)
open(location)
else:
disable([go_back, reload, home])
gate_events.exit_gate_emit()
@ -46,11 +46,11 @@ func on_go_forw() -> void:
if not history.can_forw():
disable([go_forw])
gate_events.open_gate_emit(location)
open(location)
func on_reload() -> void:
gate_events.open_gate_emit(history.get_current())
open(history.get_current())
func on_home() -> void:
@ -59,6 +59,13 @@ func on_home() -> void:
gate_events.exit_gate_emit()
func open(location: String) -> void:
if Url.is_valid(location):
gate_events.open_gate_emit(location)
else:
gate_events.search_emit(location)
func disable(buttons: Array[BaseButton]) -> void:
for button in buttons:
button.disabled = true

View file

@ -7,6 +7,7 @@ var url: String
func _ready() -> void:
gate_events.open_gate.connect(set_current_url)
gate_events.search.connect(set_current_url)
gate_events.exit_gate.connect(set_current_url.bind(""))