From 0d7e47ded745f1249960a1077b93a75d7da53ca8 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 19 Feb 2014 14:47:00 -0500 Subject: [PATCH] closed #1057 --- public/src/modules/composer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/src/modules/composer.js b/public/src/modules/composer.js index d5ba7e8e73..79299e82e0 100644 --- a/public/src/modules/composer.js +++ b/public/src/modules/composer.js @@ -218,7 +218,12 @@ define(['taskbar'], function(taskbar) { case 'fa fa-link': if (selectionStart === selectionEnd) { // Nothing selected + var cursorPos = postContentEl[0].selectionStart; insertIntoInput(postContentEl, "[link text](link url)"); + + // Highlight "link url" + postContentEl[0].selectionStart = cursorPos + 12; + postContentEl[0].selectionEnd = cursorPos + 20; } else { // Text selected postContentEl.val(postContentEl.val().slice(0, selectionStart) + '[' + postContentEl.val().slice(selectionStart, selectionEnd) + '](link url)' + postContentEl.val().slice(selectionEnd));