Commit f686f4c6 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Markdown: Don't crash on files with html images, alt text, inside links

If we have code like <a><img></a><a><img></a> and the img has alt text

The old code did
  remove image
  insert alt text
but when we remove the image, the qtextdocument says
  "i don't need the <a> anymore since there's nothing inside"
and then everything breaks because the layout has changed and we're
iterating over "unexisting" text blocks

So instead we just insert the alt text and
since we have selected the image with the cursor it will
replace it correctly

BUGS: 444971
parent 33fa8b54
Pipeline #95597 passed with stage
in 15 minutes and 51 seconds
......@@ -206,7 +206,6 @@ void Converter::convertImages(const QTextBlock &parent, const QDir &dir, QTextDo
cursor.insertImage(format);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
} else if ((!textCharFormat.toImageFormat().property(QTextFormat::ImageAltText).toString().isEmpty())) {
cursor.removeSelectedText();
cursor.insertText(textCharFormat.toImageFormat().property(QTextFormat::ImageAltText).toString());
#endif
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment