JackAdams / meteor-editable-text

Drop-in editable text widget for meteor

Home Page:http://editable-text-demo.taonova.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

editable text 'TypeError

joseterrera opened this issue · comments

I'l trying to add the text but getting this issue on the console:
Exception in template helper: TypeError: Cannot use 'in' operator to search for 'body' in null
https://github.com/joseterrera/meteorBlog/blob/master/client/templates/posts/post_submit.html
am I missing a step?

It sounds like the context is not set as a document from the specified collection (where the widget appears in your template).

Sent from my iPhone

On Nov 13, 2015, at 1:36 AM, Josefina Terrera notifications@github.com wrote:

I'l trying to add the text but getting this issue on the console:
Exception in template helper: TypeError: Cannot use 'in' operator to search for 'body' in null
https://github.com/joseterrera/meteorBlog/blob/master/client/templates/posts/post_submit.html
am I missing a step?


Reply to this email directly or view it on GitHub.

Sorry. Just noticed you'd given a github link - I'll take a look when I get a moment.

Sent from my iPhone

On Nov 13, 2015, at 1:36 AM, Josefina Terrera notifications@github.com wrote:

I'l trying to add the text but getting this issue on the console:
Exception in template helper: TypeError: Cannot use 'in' operator to search for 'body' in null
https://github.com/joseterrera/meteorBlog/blob/master/client/templates/posts/post_submit.html
am I missing a step?


Reply to this email directly or view it on GitHub.

thanks! it may look simple but I'm pretty stuck with it.

You're missing:

Template.postSubmit.helpers({
  postSubmit: function () {
    return Posts.findOne(); // Put some real query in the findOne
  }
});

If the post doesn't exist yet, you need:

Template.postSubmit.helpers({
  postSubmit: function () {
    return {body: ''};
  }
});

and, in the template:

{{> editableText context=postSubmit collection="posts" field="body" wysiwyg=true autoInsert=true}}

I've tried adding those helpers into my postSubmit but it didn't help.