From 8c23b1ab7b74c02006deb5190d589b60cdf55d07 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 01f9bea3857..25c4251685b 100644 --- a/src/components/Suggestion/LinkPicker/suggestions.js +++ b/src/components/Suggestion/LinkPicker/suggestions.js @@ -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