fix(image): handle inline images at the same TS node, but that changed url. See #1203

This commit is contained in:
Folke Lemaitre 2025-02-15 22:50:15 +01:00
parent 74ce61b727
commit 86e3ddf2e4
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -234,7 +234,11 @@ function M.inline(buf)
return function()
local found = {} ---@type table<string, boolean>
for _, i in ipairs(M.find(buf)) do
local img = imgs[i.id]
local img = imgs[i.id] ---@type snacks.image.Placement?
if img and img.img.src ~= i.src then
img:close()
img = nil
end
if not img then
img = Snacks.image.placement.new(