|
937 | 937 | StaticPopupDialogs['TalentViewerExportDialog'] = { |
938 | 938 | text = L['CTRL-C to copy'], |
939 | 939 | button1 = CLOSE, |
| 940 | + --- @param dialog StaticPopupTemplate |
| 941 | + --- @param data string |
940 | 942 | OnShow = function(dialog, data) |
941 | 943 | local function HidePopup() |
942 | 944 | dialog:Hide(); |
943 | 945 | 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 |
948 | 952 | HidePopup(); |
949 | 953 | end |
950 | 954 | 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(); |
954 | 958 | end, |
955 | 959 | hasEditBox = true, |
956 | 960 | editBoxWidth = 240, |
|
963 | 967 | text = HUD_CLASS_TALENTS_IMPORT_DIALOG_TITLE .. '\n' .. L['Icy-veins calculator links are also supported!'], |
964 | 968 | button1 = OKAY, |
965 | 969 | button2 = CLOSE, |
| 970 | + --- @param dialog StaticPopupTemplate |
966 | 971 | OnAccept = function(dialog) |
967 | | - TalentViewer:ImportLoadout(dialog.editBox:GetText()); |
| 972 | + --- @type StaticPopupTemplate_EditBox |
| 973 | + local editBox = dialog:GetEditBox(); |
| 974 | + TalentViewer:ImportLoadout(editBox:GetText()); |
968 | 975 | dialog:Hide(); |
969 | 976 | end, |
| 977 | + --- @param dialog StaticPopupTemplate |
970 | 978 | OnShow = function(dialog) |
971 | 979 | local function HidePopup() |
972 | 980 | dialog:Hide(); |
973 | 981 | end |
974 | 982 | local function OnEnter() |
975 | | - dialog.button1:Click(); |
| 983 | + dialog:GetButtons()[1]:Click(); |
976 | 984 | 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); |
979 | 989 | end, |
980 | 990 | hasEditBox = true, |
981 | 991 | editBoxWidth = 240, |
|
0 commit comments