Skip to content

Commit

Permalink
fix(LinkPicker): Fix inserting markdown (e.g. from text_templates app)
Browse files Browse the repository at this point in the history
Follow-up for #5846

Signed-off-by: Jonas <jonas@freesources.org>
  • Loading branch information
mejo- committed Jun 19, 2024
1 parent 821d2df commit 8c23b1a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/components/Suggestion/LinkPicker/suggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,15 @@ export default () => createSuggestions({
}
getLinkWithPicker(props.providerId, true)
.then(link => {
let content = link

if (hasMarkdownSyntax(content) && isValidMarkdown(content)) {
content = markdownit.render(content)
if (hasMarkdownSyntax(link) && isValidMarkdown(link)) {
// Insert markdown content (e.g. from `text_templates` app)
const content = markdownit.render(link)
editor
.chain()
.focus()
.insertContentAt(range, content + ' ')
.run()
return
}

editor
Expand Down

0 comments on commit 8c23b1a

Please sign in to comment.