aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2016-04-07 23:03:55 +0200
committerMario Vavti <mario@mariovavti.com>2016-04-07 23:03:55 +0200
commitcf84ff334444c09269fd77cf06dac44828bc9bae (patch)
tree74506f8a2a220a35a4a2afeece0f26408a6e5f45 /view/js
parente419b2c18c246eb79c3261ba4255761724efd477 (diff)
downloadvolse-hubzilla-cf84ff334444c09269fd77cf06dac44828bc9bae.tar.gz
volse-hubzilla-cf84ff334444c09269fd77cf06dac44828bc9bae.tar.bz2
volse-hubzilla-cf84ff334444c09269fd77cf06dac44828bc9bae.zip
translate the most common bbcodes to their *real name*. finally we should probably use an array for each bbcode containing the bbcode the real name and possibly a template for use as a peview in the dropdown
Diffstat (limited to 'view/js')
-rw-r--r--view/js/autocomplete.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index 91b779316..0ba291004 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -149,6 +149,16 @@ function listNewLineAutocomplete(id) {
}
}
+function string2bb(element) {
+ if(element == 'bold') return 'b';
+ else if(element == 'italic') return 'i';
+ else if(element == 'underline') return 'u';
+ else if(element == 'overline') return 'o';
+ else if(element == 'strike') return 's';
+ else if(element == 'superscript') return 'sup';
+ else if(element == 'subscript') return 'sub';
+ else return element;
+}
/**
* jQuery plugin 'editor_autocomplete'
@@ -252,7 +262,7 @@ function listNewLineAutocomplete(id) {
$.fn.bbco_autocomplete = function(type) {
if(type=='bbcode') {
- var open_close_elements = ['b', 'i', 'u', 's', 'quote', 'code', 'spoiler', 'map', 'nobb', 'list', 'ul', 'ol', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer'];
+ var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'spoiler', 'map', 'nobb', 'list', 'ul', 'ol', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer'];
var open_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr', ];
var elements = open_close_elements.concat(open_elements);
@@ -274,6 +284,7 @@ function listNewLineAutocomplete(id) {
},
index: 1,
replace: function (element) {
+ element = string2bb(element);
if(open_elements.indexOf(element) < 0) {
if(element === 'list' || element === 'ol' || element === 'ul') {
return ['\[' + element + '\]' + '\n\[*\] ', '\n\[/' + element + '\]'];
@@ -295,6 +306,7 @@ function listNewLineAutocomplete(id) {
var a = this.textcomplete([bbco], {className:'acpopup', zIndex:1020});
a.on('textComplete:select', function(e, value, strategy) { value; });
+
$(this).keypress(function(e){
if (e.keyCode == 13) {
x = listNewLineAutocomplete(this.id);