Custom BBCode preview not working!



Need help with my BBcode. The Problem in preview doesn´t work but it work´s when posted.

// [DECK]...[/DECK]
  start: /(\[deck\])([\s\S]*)/igm,
  stop: /\[\/deck\]/igm,
  rawContents: true,

  emitter: function(blockContents) {
  	var inner = blockContents.join("\n");
	var ergebnis = inner.match(/(^.*$)/gm);
	var card = new Array();
	for (var i in ergebnis)
		card[i] = '<a href="'+""+ergebnis[i].replace(/(^\d*\s*)/g,"").replace(/(\s)/g, "%20")+'">'+ergebnis[i]+'</a>';
	var inner2 = card.join("\n");
	return ['div', inner2];

(Régis Hanol) #2

Are there any JavaScript errors in the console while you have the composer open?



Uncaught TypeError: undefined is not a function linked me to this Code:

card[i] = '<a href="'+""+ergebnis[i].replace(/(^\d*\s*)/g,"").replace(/(\s)/g, "%20")+'">'+ergebnis[i]+'</a>';

(Sam Saffron) #4

can you make a post with the exact code here, it does look like a bug.


Here are the Code on Github

exact code?

The first linked me to a .js this is the line that be highlighted [JavaScript] }),e.getJSON(""+c+"?v=2&alt=json",fun -

The second

Here no Erros when not in the Editor.

need you more?

(Kane York) #6

Here’s the error:

for (var item in collection) {
    ..... collection[item] .....

Replace that with:

collection.forEach(function(item) {
    ..... item .....


It work´s! Thank you all!

(Régis Hanol) #9