mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
[516] Fix TGUI input text max_length (#90039)
## About The Pull Request Fixes default max_lenght on TGUI input text. Chromium ignores symbols in maxlength attribute, so instead of infinity it was... 1. Without setting attribute, it was literally infinite (close enough)  Closes #89331 ## Why It's Good For The Game  ## Changelog 🆑 fix: Fixed TGUI text inputs, that's allows only 1 symbol instead infinity /🆑
This commit is contained in:
@@ -10,12 +10,12 @@
|
||||
* * message - The content of the text input, shown in the body of the TGUI window.
|
||||
* * title - The title of the text input modal, shown on the top of the TGUI window.
|
||||
* * default - The default (or current) value, shown as a placeholder.
|
||||
* * max_length - Specifies a max length for input. MAX_MESSAGE_LEN is default (1024)
|
||||
* * max_length - Specifies a max length for input. By default is infinity.
|
||||
* * multiline - Bool that determines if the input box is much larger. Good for large messages, laws, etc.
|
||||
* * encode - Toggling this determines if input is filtered via html_encode. Setting this to FALSE gives raw input.
|
||||
* * timeout - The timeout of the textbox, after which the modal will close and qdel itself. Set to zero for no timeout.
|
||||
*/
|
||||
/proc/tgui_input_text(mob/user, message = "", title = "Text Input", default, max_length = INFINITY, multiline = FALSE, encode = TRUE, timeout = 0, ui_state = GLOB.always_state)
|
||||
/proc/tgui_input_text(mob/user, message = "", title = "Text Input", default, max_length, multiline = FALSE, encode = TRUE, timeout = 0, ui_state = GLOB.always_state)
|
||||
if (!user)
|
||||
user = usr
|
||||
if (!istype(user))
|
||||
@@ -162,4 +162,4 @@
|
||||
/datum/tgui_input_text/proc/set_entry(entry)
|
||||
if(!isnull(entry))
|
||||
var/converted_entry = encode ? html_encode(entry) : entry
|
||||
src.entry = trim(converted_entry, PREVENT_CHARACTER_TRIM_LOSS(max_length))
|
||||
src.entry = max_length ? trim(converted_entry, PREVENT_CHARACTER_TRIM_LOSS(max_length)) : converted_entry
|
||||
|
||||
Reference in New Issue
Block a user