inacho / bootstrap-markdown-editor

Markdown editor for Bootstrap with preview, image upload support, shortcuts and other features.
MIT License
294 stars 73 forks source link

Issues with setting content #24

Open jaylucas opened 8 years ago

jaylucas commented 8 years ago

So I am having issues setting the content after initialization of the markdown editor.

 debugger;  // $scope.candidateInfo.notes <--- has a string in it
$('#editor').markdownEditor('setContent', $scope.candidateInfo.notes);

I get a :

  TypeError: Cannot read property 'env' of undefined

Any idea why? This is the order of execution:

    $('#editor').markdownEditor({
        preview: true,
        onPreview: function (content, callback) {
            callback( marked(content) );
        }
    });

    someService.getById($routeParams.id).then(
        function(response){
            $scope.candidateInfo = response.data;
            debugger;
            $('#editor').markdownEditor('setContent', $scope.candidateInfo.notes);
        }
    );

if it helps it is breaking on this line:

var editor = ace.edit(this.find('.md-editor')[0]);