Skip to content

Commit 9410ecf

Browse files
committed
Update for 11.2.0 popup dialog changes
1 parent a15e4d8 commit 9410ecf

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

TalentTreeViewer_TWW/mixins/TalentViewerUIMixin.lua

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -937,20 +937,24 @@ do
937937
StaticPopupDialogs['TalentViewerExportDialog'] = {
938938
text = L['CTRL-C to copy'],
939939
button1 = CLOSE,
940+
--- @param dialog StaticPopupTemplate
941+
--- @param data string
940942
OnShow = function(dialog, data)
941943
local function HidePopup()
942944
dialog:Hide();
943945
end
944-
dialog.editBox:SetScript('OnEscapePressed', HidePopup);
945-
dialog.editBox:SetScript('OnEnterPressed', HidePopup);
946-
dialog.editBox:SetScript('OnKeyUp', function(_, key)
947-
if IsControlKeyDown() and key == 'C' then
946+
--- @type StaticPopupTemplate_EditBox
947+
local editBox = dialog:GetEditBox();
948+
editBox:SetScript('OnEscapePressed', HidePopup);
949+
editBox:SetScript('OnEnterPressed', HidePopup);
950+
editBox:SetScript('OnKeyUp', function(_, key)
951+
if IsControlKeyDown() and (key == 'C' or key == 'X') then
948952
HidePopup();
949953
end
950954
end);
951-
dialog.editBox:SetMaxLetters(0);
952-
dialog.editBox:SetText(data);
953-
dialog.editBox:HighlightText();
955+
editBox:SetMaxLetters(0);
956+
editBox:SetText(data);
957+
editBox:HighlightText();
954958
end,
955959
hasEditBox = true,
956960
editBoxWidth = 240,
@@ -963,19 +967,25 @@ do
963967
text = HUD_CLASS_TALENTS_IMPORT_DIALOG_TITLE .. '\n' .. L['Icy-veins calculator links are also supported!'],
964968
button1 = OKAY,
965969
button2 = CLOSE,
970+
--- @param dialog StaticPopupTemplate
966971
OnAccept = function(dialog)
967-
TalentViewer:ImportLoadout(dialog.editBox:GetText());
972+
--- @type StaticPopupTemplate_EditBox
973+
local editBox = dialog:GetEditBox();
974+
TalentViewer:ImportLoadout(editBox:GetText());
968975
dialog:Hide();
969976
end,
977+
--- @param dialog StaticPopupTemplate
970978
OnShow = function(dialog)
971979
local function HidePopup()
972980
dialog:Hide();
973981
end
974982
local function OnEnter()
975-
dialog.button1:Click();
983+
dialog:GetButtons()[1]:Click();
976984
end
977-
dialog.editBox:SetScript('OnEscapePressed', HidePopup);
978-
dialog.editBox:SetScript('OnEnterPressed', OnEnter);
985+
--- @type StaticPopupTemplate_EditBox
986+
local editBox = dialog:GetEditBox();
987+
editBox:SetScript('OnEscapePressed', HidePopup);
988+
editBox:SetScript('OnEnterPressed', OnEnter);
979989
end,
980990
hasEditBox = true,
981991
editBoxWidth = 240,

0 commit comments

Comments
 (0)