Post by DarkPikachu on Oct 16, 2014 9:46:50 GMT -8
this is an issue I'm having with extension plugins for my real-time BBC preview plugin
here's the handler: (operates per key press)
the .html() part works just fine, but that's all that works...
the JQuery '.message' node that the plugins expect somehow doesn't get passed to the extension plugins...
how this works... here's a setup for an extension:
when the extension functions are actually passed, I get:
Uncaught TypeError: Cannot read property 'find' of undefined
returned from the extension.
anyone know what's going on?? :/
here's the handler: (operates per key press)
$(".preview-area.message").html( '<br/>'+convert_bbc_to_html($(".editor.bbcode-editor").children()[0].value)+'<br/><br/><br/>' );
for ( eid=0; eid<window.Tcll5850_RTBBCP_extensions.length; eid++ ) { window.Tcll5850_RTBBCP_extensions[eid]( $(".preview-area.message") ); };
the .html() part works just fine, but that's all that works...
the JQuery '.message' node that the plugins expect somehow doesn't get passed to the extension plugins...
how this works... here's a setup for an extension:
function parse_function( node ) {
var codes = []; node.find('code').each(function() { codes.push($(this).html()); }); // backup code blocks
var quotes = []; node.find('.quote_body').each(function() { quotes.push($(this).html()); }); // backup quotes
// operate on the post here
var i=0; node.find('code').each(function() { $(this).html(codes[i]); i = i+1; }); // restore code blocks
i=0; node.find('.quote_body').each(function() { $(this).html(quotes[i]); i = i+1; }); // restore quotes
};
$(document).ready(function() {
try { window.Tcll5850_RTBBCP_extensions.push( parse_function ); }
catch(exc){}; //preview plugin not found
var name = proboards.data('route').name;
if (name.match(/(thread|conversation)|(new|quote|edit)_(thread|post|mess|conversation|user_conversation)/)) {
$('.content .message').each(function() { parse_function($(this)); });
};
});
when the extension functions are actually passed, I get:
Uncaught TypeError: Cannot read property 'find' of undefined
returned from the extension.
anyone know what's going on?? :/