Fix Advanced Item Description error popup problems (#8311)

* show as warning, once per session

* move to keypress handling code
This commit is contained in:
Nighty
2024-09-27 00:56:07 +10:00
committed by GitHub
parent 8369b448f6
commit f6d095a527
2 changed files with 5 additions and 4 deletions

View File

@@ -298,10 +298,6 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
self.rawLines = { }
-- Find non-blank lines and trim whitespace
for line in raw:gmatch("%s*([^\n]*%S)") do
if line:match("^{ ") then
main:OpenMessagePopup("Error", "\"Advanced Item Description\" (Ctrl+Alt+c) is currently unsupported.\nPlease try again using Ctrl+c only.")
return
end
t_insert(self.rawLines, line)
end
local mode = rarity and "GAME" or "WIKI"

View File

@@ -1170,6 +1170,11 @@ function ItemsTabClass:Draw(viewPort, inputEvents)
if event.type == "KeyDown" then
if event.key == "v" and IsKeyDown("CTRL") then
local newItem = Paste()
if newItem:find("{ ", 0, true) then
main:OpenConfirmPopup("Warning", "\"Advanced Item Descriptions\" (Ctrl+Alt+c) are unsupported.\n\nAbort paste?", "OK", function()
self:SetDisplayItem()
end)
end
if newItem then
self:CreateDisplayItemFromRaw(newItem, true)
end