0

I'm making simple blog application and I'm getting the error while I load from db

Template

<template name="view">
 <div>
         {{{ summernote }}}
 </div>
</template>

Displaying from Mongodb.....

  <div class="container">
{{> editor}}

  {{#each post }} {{> view}} {{/each}}

main.js

if (Meteor.isClient) {

  Template.body.helpers({

    post: function () {

      return Post.find();
    }
  });

  Template.editor.onRendered(function () {
    $(document).ready(function () {
      $('#summernote').summernote({

        height: 300
      });
    });
  });

  Template.editor.events({
    'click #saveContent': function (e) {

      e.preventDefault();

      var summernote = $('#summernote').summernote('code');

      Meteor.call('posts.insert', summernote);
    }
  });
}

lib.js

import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { Mongo } from 'meteor/mongo';

export const Post = new Mongo.Collection('posts');

Meteor.methods({

  'posts.insert'(summernote) {

    check(summernote, String);
    Post.insert({
      summernote,
      createdAt: new Date()
    });
    console.log(summernote);
  }
});

And I'm getting following errors

Exception in queued task: Spacebars.include@http://localhost:3000/packages/spacebars.js?hash=547cf8e466d1d52603d19bd5f48fb5df184fd237:48:13 template.main.js/http://localhost:3000/app/app.js?hash=47d4ac698c02f59520602a8871b3d5485a3a5b26:31:19 doRender@http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:2086:20 viewAutorun/http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1934:18 Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:3744:12 viewAutorun/<@http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1932:14 Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:2271:12 viewAutorun@http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1931:12 Tracker.Computation.prototype._compute@http://localhost:3000/packages/tracker.js?hash=0e8b5c18d543a28ce43b2f183c26b49ee62196af:339:5 Tracker.Computation@http://localhost:3000/packages/tracker.js?hash=0e8b5c18d543a28ce43b2f183c26b49ee62196af:229:5 Tracker.autorun@http://localhost:3000/packages/tracker.js?hash=0e8b5c18d543a28ce43b2f183c26b49ee62196af:613:11 Blaze.View.prototype.autorun@http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:1944:14 Blaze._materializeView/<@http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:2080:5 Tracker.nonreactive@http://localhost:3000/packages/tracker.js?hash=0e8b5c18d543a28ce43b2f183c26b49ee62196af:640:12 Blaze._materializeView@http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:2079:3 addedAt/<@http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:2851:25 Tracker.nonreactive@http://localhost:3000/packages/tracker.js?hash=0e8b5c18d543a28ce43b2f183c26b49ee62196af:640:12 addedAt@http://localhost:3000/packages/blaze.js?hash=a1ff2d6d5ecd59ee11e2ba260b8650a9d1140f59:2824:9 addedAt@http://localhost:3000/packages/observe-sequence.js?hash=5da2e60ce61e074a6463979f3992dd5bac41b43d:373:9 addedBefore@http://localhost:3000/packages/minimongo.js?hash=9d4bb4b714acae5bd3d70f96bb3803e155b57e38:3372:11 addedBefore@http://localhost:3000/packages/minimongo.js?hash=9d4bb4b714acae5bd3d70f96bb3803e155b57e38:2836:13 wrapCallback/http://localhost:3000/packages/minimongo.js?hash=9d4bb4b714acae5bd3d70f96bb3803e155b57e38:1827:13 SQp.runTask@http://localhost:3000/packages/meteor.js?hash=c9a34f92f28ede5a42eac467d3fa1763b624436a:782:9 SQp.flush@http://localhost:3000/packages/meteor.js?hash=c9a34f92f28ede5a42eac467d3fa1763b624436a:811:3 SQp.drain@http://localhost:3000/packages/meteor.js?hash=c9a34f92f28ede5a42eac467d3fa1763b624436a:820:5 resumeObservers@http://localhost:3000/packages/minimongo.js?hash=9d4bb4b714acae5bd3d70f96bb3803e155b57e38:2438:7 endUpdate@http://localhost:3000/packages/mongo.js?hash=7dae0d2bbf4992c92bbb005435b6ee27a23d13b2:339:9 registerStore/http://localhost:3000/packages/ddp-client.js?hash=a547928b29e722e419948bbc25e954f2c268a1c3:631:20 _performWrites/<@http://localhost:3000/packages/ddp-client.js?hash=a547928b29e722e419948bbc25e954f2c268a1c3:1630:11 _performWrites@http://localhost:3000/packages/ddp-client.js?hash=a547928b29e722e419948bbc25e954f2c268a1c3:1629:9 _flushBufferedWrites@http://localhost:3000/packages/ddp-client.js?hash=a547928b29e722e419948bbc25e954f2c268a1c3:1587:7 _livedata_data@http://localhost:3000/packages/ddp-client.js?hash=a547928b29e722e419948bbc25e954f2c268a1c3:1548:9 onMessage@http://localhost:3000/packages/ddp-client.js?hash=a547928b29e722e419948bbc25e954f2c268a1c3:2153:9 _launchConnection/this.socket.onmessage/<@http://localhost:3000/packages/socket-stream-client.js?hash=55bf4fc2eb00d41c79827f8ec3b3949bbec01ce1:261:13 forEachCallback@http://localhost:3000/packages/socket-stream-client.js?hash=55bf4fc2eb00d41c79827f8ec3b3949bbec01ce1:355:7 _launchConnection/this.socket.onmessage@http://localhost:3000/packages/socket-stream-client.js?hash=55bf4fc2eb00d41c79827f8ec3b3949bbec01ce1:260:11 sockjs-0.3.4.js/SockJShttp://localhost:3000/packages/socket-stream-client.js?hash=55bf4fc2eb00d41c79827f8ec3b3949bbec01ce1:645:7 sockjs-0.3.4.js/SockJShttp://localhost:3000/packages/socket-stream-client.js?hash=55bf4fc2eb00d41c79827f8ec3b3949bbec01ce1:1824:5 sockjs-0.3.4.js/SockJShttp://localhost:3000/packages/socket-stream-client.js?hash=55bf4fc2eb00d41c79827f8ec3b3949bbec01ce1:1890:11 sockjs-0.3.4.js/SockJShttp://localhost:3000/packages/socket-stream-client.js?hash=55bf4fc2eb00d41c79827f8ec3b3949bbec01ce1:2048:7 meteor.js:992:11

6
  • 2
    What's that each block doing outside of the <template> tag? Commented May 4, 2018 at 11:20
  • 1
    Where do you define 'summernote' ? Can you show it? Commented May 4, 2018 at 11:58
  • I have updated the code @MasterAM Commented May 4, 2018 at 15:35
  • @GokhanKaradag, which one {{{ summernote }}} ??? Commented May 4, 2018 at 15:36
  • When you use triple brackets in Spacebar you should be careful because you are inserting a raw HTML within them. Commented May 4, 2018 at 17:33

1 Answer 1

0

Try in your methods with

Post.insert({
      summernote: summernote,
      createdAt: new Date()
    });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.