From 58324473a98db0d9f792c733c157daed5f1c5130 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 7 Apr 2016 11:16:30 +0200 Subject: move li back in the list since it will be used far less than list --- view/js/autocomplete.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'view/js') diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 36551dc42..8eb46d83d 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -252,7 +252,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', 'li', 'list', 'ul', 'ol', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer']; + 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_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr', ]; var elements = open_close_elements.concat(open_elements); -- cgit v1.2.3 From e419b2c18c246eb79c3261ba4255761724efd477 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 7 Apr 2016 11:34:38 +0200 Subject: some more autocompletion for bbcode tables - leave it open if we wanna use th or td though --- view/js/autocomplete.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'view/js') diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 8eb46d83d..91b779316 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -278,6 +278,9 @@ function listNewLineAutocomplete(id) { if(element === 'list' || element === 'ol' || element === 'ul') { return ['\[' + element + '\]' + '\n\[*\] ', '\n\[/' + element + '\]']; } + else if(element === 'table') { + return ['\[' + element + '\]' + '\n\[tr\]', '\[/tr\]\n\[/' + element + '\]']; + } else { return ['\[' + element + '\]', '\[/' + element + '\]']; } -- cgit v1.2.3 From cf84ff334444c09269fd77cf06dac44828bc9bae Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 7 Apr 2016 23:03:55 +0200 Subject: 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 --- view/js/autocomplete.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'view/js') 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); -- cgit v1.2.3