Skip to content

Commit 5f11075

Browse files
committed
fix(LinkPicker): Fix inserting markdown (e.g. from text_templates app)
Follow-up for #5846 Signed-off-by: Jonas <jonas@freesources.org>
1 parent 4a9fb59 commit 5f11075

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/components/Suggestion/LinkPicker/suggestions.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,15 @@ export default () => createSuggestions({
9393
}
9494
getLinkWithPicker(props.providerId, true)
9595
.then(link => {
96-
let content = link
97-
98-
if (hasMarkdownSyntax(content) && isValidMarkdown(content)) {
99-
content = markdownit.render(content)
96+
if (hasMarkdownSyntax(link) && isValidMarkdown(link)) {
97+
// Insert markdown content (e.g. from `text_templates` app)
98+
const content = markdownit.render(link)
99+
editor
100+
.chain()
101+
.focus()
102+
.insertContentAt(range, content + ' ')
103+
.run()
104+
return
100105
}
101106

102107
editor

0 commit comments

Comments
 (0)