diff options
author | redmatrix <git@macgirvin.com> | 2016-05-01 19:20:09 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-05-01 19:20:09 -0700 |
commit | 23bb4e8e1546a8f8b3319e39172cf2fd17cb4139 (patch) | |
tree | 15b7ba8f607da56f7f84ab4d1039c4768069095d /view/js/autocomplete.js | |
parent | cd518625bf561f1ed42db0b78030b74c32435136 (diff) | |
parent | b4bf71dd0642e58fab6151e1df3c071d05650492 (diff) | |
download | volse-hubzilla-23bb4e8e1546a8f8b3319e39172cf2fd17cb4139.tar.gz volse-hubzilla-23bb4e8e1546a8f8b3319e39172cf2fd17cb4139.tar.bz2 volse-hubzilla-23bb4e8e1546a8f8b3319e39172cf2fd17cb4139.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'view/js/autocomplete.js')
-rw-r--r-- | view/js/autocomplete.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 41077d427..33d825b55 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -143,8 +143,11 @@ function listNewLineAutocomplete(id) { if (word != null) { var textBefore = text.value.substring(0, caretPos); var textAfter = text.value.substring(caretPos, text.length); - $('#' + id).val(textBefore + '\r\n[*] ' + textAfter); - setCaretPosition(text, caretPos + 5); + 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 - caretPositionDiff)); return true; } else { @@ -296,10 +299,11 @@ function string2bb(element) { replace: function (element) { element = string2bb(element); if(open_elements.indexOf(element) < 0) { - if(element === 'list' || element === 'ol' || element === 'ul' || element === 'dl') { - return ['\[' + element + '\]' + '\n\[*\] ', '\n\[/' + element + '\]']; - } - else if(element === 'table') { + if(element === 'list' || element === 'ol' || element === 'ul') { + return ['\[' + element + '\]' + '\n\[*\] ', '\n\[/' + element + '\]']; + } else if (element === 'dl') { + return ['\[' + element + '\]' + '\n\[*=Item name\] ', '\n\[/' + element + '\]']; + } else if(element === 'table') { return ['\[' + element + '\]' + '\n\[tr\]', '\[/tr\]\n\[/' + element + '\]']; } else { |