From 46d12cc8298a1cac48dbbaed426f78e13baaf44d Mon Sep 17 00:00:00 2001 From: Twest2 Date: Sat, 13 Jun 2026 20:47:16 -0500 Subject: [PATCH] Insert markdown-style [text](url) links from the Link toolbar button Previously this wrapped the selection in a real tag via createLink. Now it inserts literal [text](url) markdown syntax, using the selection as the link text or prompting for it if nothing is selected. --- app/renderer/editor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/renderer/editor.js b/app/renderer/editor.js index b688d7b..36e1c52 100644 --- a/app/renderer/editor.js +++ b/app/renderer/editor.js @@ -1825,8 +1825,12 @@ class GuideEditor { document.execCommand('formatBlock', false, block || 'blockquote'); break; case 'createLink': { + const selectedText = window.getSelection().toString(); + const text = selectedText || window.prompt('Link text'); + if (!text) break; const url = window.prompt('Link URL'); - if (url) document.execCommand('createLink', false, url); + if (!url) break; + document.execCommand('insertText', false, `[${text}](${url})`); break; } case 'removeFormat':