It seems Template.myTemplate.rendered
doesn't work properly or I don't get it...
I need to load TinyMCE inline after a template with all posts are rendered, so I have :
- a Template
<div id="wrapper">
{{#each posts}}
<div class="editable">{{post}}</div>
{{/each}}
</div>
- and a Function
Template.myPosts.rendered = function(){
console.dir($("div"));
tinymce.init({
selector: "div.editable",
inline: true,
plugins: [
"advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table contextmenu paste"
],
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
});
}
However the console logs only the <div id="wrapper">
and not the <div class="editable">
divs, which contain my posts. So, it seems Template.myTemplate.rendered
callback occures before the template is rendered, right?
EDIT: I put the Template.myTemplate.rendered
code inside a setTimeout()
and all seems to work, so I'm sure Template.myTemplate.rendered
causes the problem.