From b35e69273d43af51a8a5dff1bc70a52b6bcfa714 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 1 May 2016 16:17:34 +0200 Subject: tweak dl bbcode in expanded autocomplete a bit more --- view/js/autocomplete.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'view') diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 01d77e22f..33d825b55 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -143,10 +143,11 @@ function listNewLineAutocomplete(id) { if (word != null) { var textBefore = text.value.substring(0, caretPos); var textAfter = text.value.substring(caretPos, text.length); - var textInsert = (word.indexOf('[/dl]') > 0) ? '\r\n[*= ' : '\r\n[*] '; + var textInsert = (word.indexOf('[/dl]') > 0) ? '\r\n[*=] ' : '\r\n[*] '; + var caretPositionDiff = (word.indexOf('[/dl]') > 0) ? 3 : 1; $('#' + id).val(textBefore + textInsert + textAfter); - setCaretPosition(text, caretPos + (textInsert.length - 1)); + setCaretPosition(text, caretPos + (textInsert.length - caretPositionDiff)); return true; } else { @@ -301,7 +302,7 @@ function string2bb(element) { if(element === 'list' || element === 'ol' || element === 'ul') { return ['\[' + element + '\]' + '\n\[*\] ', '\n\[/' + element + '\]']; } else if (element === 'dl') { - return ['\[' + element + '\]' + '\n\[*= Item name\] ', '\n\[/' + element + '\]']; + return ['\[' + element + '\]' + '\n\[*=Item name\] ', '\n\[/' + element + '\]']; } else if(element === 'table') { return ['\[' + element + '\]' + '\n\[tr\]', '\[/tr\]\n\[/' + element + '\]']; } -- cgit v1.2.3