Skip to content

Commit

Permalink
Merge pull request #5926 from nextcloud/fix/smart_picker_md
Browse files Browse the repository at this point in the history
fix(LinkPicker): Fix inserting markdown (e.g. from `text_templates` app)
  • Loading branch information
mejo- committed Jun 24, 2024
2 parents 59f4b11 + 8c23b1a commit d4f85ca
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 d4f85ca

Please sign in to comment.