mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 23:15:48 +01:00
closed #1057
This commit is contained in:
@@ -218,7 +218,12 @@ define(['taskbar'], function(taskbar) {
|
|||||||
case 'fa fa-link':
|
case 'fa fa-link':
|
||||||
if (selectionStart === selectionEnd) {
|
if (selectionStart === selectionEnd) {
|
||||||
// Nothing selected
|
// Nothing selected
|
||||||
|
var cursorPos = postContentEl[0].selectionStart;
|
||||||
insertIntoInput(postContentEl, "[link text](link url)");
|
insertIntoInput(postContentEl, "[link text](link url)");
|
||||||
|
|
||||||
|
// Highlight "link url"
|
||||||
|
postContentEl[0].selectionStart = cursorPos + 12;
|
||||||
|
postContentEl[0].selectionEnd = cursorPos + 20;
|
||||||
} else {
|
} else {
|
||||||
// Text selected
|
// Text selected
|
||||||
postContentEl.val(postContentEl.val().slice(0, selectionStart) + '[' + postContentEl.val().slice(selectionStart, selectionEnd) + '](link url)' + postContentEl.val().slice(selectionEnd));
|
postContentEl.val(postContentEl.val().slice(0, selectionStart) + '[' + postContentEl.val().slice(selectionStart, selectionEnd) + '](link url)' + postContentEl.val().slice(selectionEnd));
|
||||||
|
|||||||
Reference in New Issue
Block a user