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 26, 2024
1 parent 4a9fb59 commit 5f11075
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 @@ -93,10 +93,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 5f11075

Please sign in to comment.