From aae992b1caa49ef2fcd39ffc156b50e5a95095b6 Mon Sep 17 00:00:00 2001 From: valiantgamingpoint-prog Date: Sat, 27 Jun 2026 21:33:18 +0530 Subject: [PATCH 1/2] Fixed Mobile Keyboard Input --- ui/components/CodeEditor.gd | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/ui/components/CodeEditor.gd b/ui/components/CodeEditor.gd index 5165c598..53d578e3 100644 --- a/ui/components/CodeEditor.gd +++ b/ui/components/CodeEditor.gd @@ -77,6 +77,15 @@ func _ready() -> void: slice_editor.grab_focus() + # --- MOBILE KEYBOARD PATCH START --- + # Connect Godot 4 JavaScript Interface to catch browser input events + if not Engine.is_editor_hint() and OS.has_feature("web"): + var key_callback = JavaScriptBridge.create_callback(_on_mobile_key_received) + var window = JavaScriptBridge.get_interface("window") + if window: + window.godotMobileCallback = key_callback + # --- MOBILE KEYBOARD PATCH END --- + if not Engine.is_editor_hint(): for button: BaseButton in _buttons_with_shortcuts: assert( @@ -93,6 +102,30 @@ func _gui_input(event: InputEvent) -> void: accept_event() +# --- MOBILE KEYBOARD CALLBACK FUNCTION START --- +func _on_mobile_key_received(args: Array) -> void: + if not slice_editor: + return + + var typed_char = args[0] # The string passed from JavaScript + + if typed_char == "Enter": + slice_editor.insert_text_at_caret("\n") + elif typed_char == "Backspace": + # Safely trigger a backspace operation on Godot 4's editor node + var column = slice_editor.get_caret_column() + var line = slice_editor.get_caret_line() + if column > 0: + slice_editor.select(line, column - 1, line, column) + slice_editor.delete_selection() + else: + slice_editor.insert_text_at_caret(typed_char) + + # Alert the app container that text has changed to update validation + _on_text_changed() +# --- MOBILE KEYBOARD CALLBACK FUNCTION END --- + + func update_cursor_position(line: int, column: int) -> void: # Fix for lines with TAB indent column = column - 1 From 02fe11980a90b9990bcd15780cd644cd0d864977 Mon Sep 17 00:00:00 2001 From: valiantgamingpoint-prog Date: Sat, 27 Jun 2026 21:36:03 +0530 Subject: [PATCH 2/2] Fixed Mobile Keyboard Input --- html_export/index_template.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/html_export/index_template.html b/html_export/index_template.html index 6fb39ec4..2343b17e 100644 --- a/html_export/index_template.html +++ b/html_export/index_template.html @@ -59,5 +59,31 @@ const GDQUEST_ENVIRONMENT = {}; + + + + + +