diff options
Diffstat (limited to 'view/js')
-rw-r--r-- | view/js/autocomplete.js | 7 |
1 files changed, 4 insertions, 3 deletions
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 + '\]']; } |