From 5f11075af279e1da2bea616b91e6fcde9597c8f5 Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 19 Jun 2024 10:54:07 +0200 Subject: [PATCH] fix(LinkPicker): Fix inserting markdown (e.g. from `text_templates` app) Follow-up for #5846 Signed-off-by: Jonas --- src/components/Suggestion/LinkPicker/suggestions.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/Suggestion/LinkPicker/suggestions.js b/src/components/Suggestion/LinkPicker/suggestions.js index 2f1f9b7055f..de5a5da9162 100644 --- a/src/components/Suggestion/LinkPicker/suggestions.js +++ b/src/components/Suggestion/LinkPicker/suggestions.js @@ -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