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 <[email protected]>
  • Loading branch information
mejo- authored and backportbot[bot] committed Jun 24, 2024
1 parent 7e6463d commit db9a879
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 db9a879

Please sign in to comment.