{"action":"created","issue":{"url":"https://api.github.com/repos/jshimko/meteor-ghostdown/issues/3","labels_url":"https://api.github.com/repos/jshimko/meteor-ghostdown/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/jshimko/meteor-ghostdown/issues/3/comments","events_url":"https://api.github.com/repos/jshimko/meteor-ghostdown/issues/3/events","html_url":"https://github.com/jshimko/meteor-ghostdown/issues/3","id":70511822,"number":3,"title":"How to read the content from the editor?","user":{"login":"inhji","id":322385,"avatar_url":"https://avatars.githubusercontent.com/u/322385?v=3","gravatar_id":"","url":"https://api.github.com/users/inhji","html_url":"https://github.com/inhji","followers_url":"https://api.github.com/users/inhji/followers","following_url":"https://api.github.com/users/inhji/following{/other_user}","gists_url":"https://api.github.com/users/inhji/gists{/gist_id}","starred_url":"https://api.github.com/users/inhji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inhji/subscriptions","organizations_url":"https://api.github.com/users/inhji/orgs","repos_url":"https://api.github.com/users/inhji/repos","events_url":"https://api.github.com/users/inhji/events{/privacy}","received_events_url":"https://api.github.com/users/inhji/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-23T20:59:03Z","updated_at":"2015-04-28T21:29:56Z","closed_at":null,"body":"Hi Jeremy, \r\n\r\nthis is a great project and I appreciate your effort of extracting the best part of ghost (imho) for use with meteor!\r\n\r\nThere's one little thing that I can't figure out: How do I get the contents of the editor? The CodeMirror Docs say I should use the `doc.getValue` method where `doc` is a CodeMirror instance. But that variable is scoped only to the package ([here](https://github.com/jshimko/meteor-ghostdown/blob/master/lib/client/ghostdown.js#L13)) and your package doesn't expose this to the app, right?\r\n\r\nSo how did you achieve this, because I think a markdown needs some way to get the content.\r\n\r\nWould love to hear from you,\r\nInhji"},"comment":{"url":"https://api.github.com/repos/jshimko/meteor-ghostdown/issues/comments/97215423","html_url":"https://github.com/jshimko/meteor-ghostdown/issues/3#issuecomment-97215423","issue_url":"https://api.github.com/repos/jshimko/meteor-ghostdown/issues/3","id":97215423,"user":{"login":"jshimko","id":3077956,"avatar_url":"https://avatars.githubusercontent.com/u/3077956?v=3","gravatar_id":"","url":"https://api.github.com/users/jshimko","html_url":"https://github.com/jshimko","followers_url":"https://api.github.com/users/jshimko/followers","following_url":"https://api.github.com/users/jshimko/following{/other_user}","gists_url":"https://api.github.com/users/jshimko/gists{/gist_id}","starred_url":"https://api.github.com/users/jshimko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jshimko/subscriptions","organizations_url":"https://api.github.com/users/jshimko/orgs","repos_url":"https://api.github.com/users/jshimko/repos","events_url":"https://api.github.com/users/jshimko/events{/privacy}","received_events_url":"https://api.github.com/users/jshimko/received_events","type":"User","site_admin":false},"created_at":"2015-04-28T21:29:56Z","updated_at":"2015-04-28T21:29:56Z","body":"I have been using session variables to accomplish this.  I just pushed out a few updates to the package that include [those changes][1].  You can now access the editor contents reactively with:\r\n\r\n```javascript\r\nSession.get('editor-markdown');   // markdown content\r\nSession.get('editor-html');       // HTML content\r\nSession.get('editor-word-count'); // number of words\r\n```\r\n\r\nYou can also test this out on the demo page (http://ghostdown.meteor.com).  Just type in some content, then open your browser console and check the session variable values.  \r\n\r\nSo saving content from the editor might look something like: \r\n\r\n```javascript\r\nTemplate.myTemplate.events({\r\n  'click .save-button': function () {\r\n    \r\n    var post = {\r\n      markdown: Session.get('editor-markdown'),\r\n      html: Session.get('editor-html'),\r\n      wordCount: Session.get('editor-word-count') \r\n    }\r\n\r\n    Posts.insert(post);\r\n    \r\n  }\r\n});\r\n```\r\n\r\n[1]: https://github.com/jshimko/meteor-ghostdown/commit/ab8970b9d5bead07ae9f207ef812e3740a68342a"}}