From 2bafc0a14087bf4472128bdf96e39e8875a5cc6b Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 7 Feb 2021 13:21:22 +0500 Subject: [PATCH 1/2] Add ability to pass text component instead of text node name --- druid/extended/input.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/druid/extended/input.lua b/druid/extended/input.lua index c6b7adb..4179170 100644 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -108,11 +108,16 @@ end -- @tparam node click_node Button node to enabled input component --- @tparam node text_node Text node what will be changed on user input +-- @tparam node|druid.text text_node Text node what will be changed on user input. You can pass text component instead of text node name -- @tparam[opt] number keyboard_type Gui keyboard type for input field function Input.init(self, click_node, text_node, keyboard_type) self.druid = self:get_druid(self) - self.text = self.druid:new_text(text_node) + + if type(text_node) == const.TABLE then + self.text = text_node + else + self.text = self.druid:new_text(text_node) + end self.is_selected = false self.value = self.text.last_value From 87a5700587f0f763fcd14153e97c31a91554760f Mon Sep 17 00:00:00 2001 From: Insality Date: Thu, 1 Apr 2021 20:34:55 +0300 Subject: [PATCH 2/2] Add changelog for changes --- docs_md/changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs_md/changelog.md b/docs_md/changelog.md index d26860a..8f35d96 100644 --- a/docs_md/changelog.md +++ b/docs_md/changelog.md @@ -138,3 +138,4 @@ Desc - Input component: rename field _selected_ to _is_selected_ (according to the docs) - Add EmmyLua annotations. See how to use it FAQ +- **#116** You can pass Text component in Input component instead of text node \ No newline at end of file