Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
Okular
Commits
3b8cbc33
Commit
3b8cbc33
authored
Sep 28, 2021
by
Albert Astals Cid
Browse files
markdown: Only remove text if we're going to add something
Otherwise things get confused
BUGS: 443057
parent
1c3e5b23
Pipeline
#83508
passed with stage
in 9 minutes and 43 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
generators/markdown/converter.cpp
View file @
3b8cbc33
...
...
@@ -194,10 +194,10 @@ void Converter::convertImages(const QTextBlock &parent, const QDir &dir, QTextDo
QTextCursor
cursor
(
textDocument
);
cursor
.
setPosition
(
textFragment
.
position
(),
QTextCursor
::
MoveAnchor
);
cursor
.
setPosition
(
textFragment
.
position
()
+
textFragment
.
length
(),
QTextCursor
::
KeepAnchor
);
cursor
.
removeSelectedText
();
const
QString
imageFilePath
=
QDir
::
cleanPath
(
dir
.
absoluteFilePath
(
textCharFormat
.
toImageFormat
().
name
()));
if
(
QFile
::
exists
(
imageFilePath
))
{
cursor
.
removeSelectedText
();
format
.
setName
(
imageFilePath
);
const
QImage
img
=
QImage
(
format
.
name
());
...
...
@@ -206,6 +206,7 @@ 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
}
...
...
Albert Astals Cid
@aacid
mentioned in commit
bbc77590
·
Sep 29, 2021
mentioned in commit
bbc77590
mentioned in commit bbc775909cb0e224d0a1ef38663add2bf9c91721
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment