Skip to content

Commit

Permalink
Merge pull request #5940 from nextcloud/backport/5926/stable29
Browse files Browse the repository at this point in the history
[stable29] fix(LinkPicker): Fix inserting markdown (e.g. from `text_templates` app)
  • Loading branch information
juliusknorr authored Jun 26, 2024
2 parents 4a9fb59 + 5f11075 commit 1136f27
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 1136f27

Please sign in to comment.