diff options
author | git-marijus <mario@mariovavti.com> | 2016-05-01 15:50:11 +0200 |
---|---|---|
committer | git-marijus <mario@mariovavti.com> | 2016-05-01 15:50:11 +0200 |
commit | 4560298b98555a7452a63e3dabdb00e1b61e4807 (patch) | |
tree | ff8af1ce02b985c456d80f82c6d7c0a582de44e3 /view/js | |
parent | d892a47ac9b401298df3a3d10735cd923a6b0669 (diff) | |
parent | 02d836301976fefc6b5ef5bd6ee9b061fa368992 (diff) | |
download | volse-hubzilla-4560298b98555a7452a63e3dabdb00e1b61e4807.tar.gz volse-hubzilla-4560298b98555a7452a63e3dabdb00e1b61e4807.tar.bz2 volse-hubzilla-4560298b98555a7452a63e3dabdb00e1b61e4807.zip |
Merge pull request #363 from Treer/bbcode
tweak dl bbcode in expanded autocomplete
Diffstat (limited to 'view/js')
-rw-r--r-- | view/js/autocomplete.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 41077d427..01d77e22f 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -143,8 +143,10 @@ 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[*] '; + + $('#' + id).val(textBefore + textInsert + textAfter); + setCaretPosition(text, caretPos + (textInsert.length - 1)); return true; } else { @@ -296,10 +298,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 { |