diff options
author | Mario Vavti <mario@mariovavti.com> | 2016-05-01 16:17:34 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2016-05-01 16:17:34 +0200 |
commit | b35e69273d43af51a8a5dff1bc70a52b6bcfa714 (patch) | |
tree | 0dde9862acfbecc1c2f1d97f2217cbf5f722436d | |
parent | 4560298b98555a7452a63e3dabdb00e1b61e4807 (diff) | |
download | volse-hubzilla-b35e69273d43af51a8a5dff1bc70a52b6bcfa714.tar.gz volse-hubzilla-b35e69273d43af51a8a5dff1bc70a52b6bcfa714.tar.bz2 volse-hubzilla-b35e69273d43af51a8a5dff1bc70a52b6bcfa714.zip |
tweak dl bbcode in expanded autocomplete a bit more
-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 + '\]']; } |