balthazar / ng-markdown

:memo: [DEPRECATED] Markdown directive for AngularJS
http://apercu.github.io/ng-markdown/
MIT License
12 stars 1 forks source link

Setting the model appears to break the render #21

Open staxmanade opened 9 years ago

staxmanade commented 9 years ago

Given the following plnkr: http://plnkr.co/edit/fVBlVyb1fRwfwh0zAKzY?p=preview

This is basically setting the model value on a timeout.

I notice the following error in the console:

 TypeError: Cannot read property 'appendChild' of undefined
    at makeSpritedButtonRow (https://rawgit.com/Apercu/ng-markdown/master/dist/ng-markdown.js:2914:34)
    at new UIManager (https://rawgit.com/Apercu/ng-markdown/master/dist/ng-markdown.js:2696:9)
    at run (https://rawgit.com/Apercu/ng-markdown/master/dist/ng-markdown.js:1656:25)
    at post (https://rawgit.com/Apercu/ng-markdown/master/dist/ng-markdown.js:105:22)
    at https://code.angularjs.org/1.2.25/angular.js:7113:44
    at nodeLinkFn (https://code.angularjs.org/1.2.25/angular.js:6711:13)
    at compositeLinkFn (https://code.angularjs.org/1.2.25/angular.js:6105:13)
    at nodeLinkFn (https://code.angularjs.org/1.2.25/angular.js:6705:24)
    at compositeLinkFn (https://code.angularjs.org/1.2.25/angular.js:6105:13)
    at compositeLinkFn (https://code.angularjs.org/1.2.25/angular.js:6108:13) <textarea ng-keydown="refresh()" ng-model="sampleMarkdown" class="ng-isolate-scope ng-pristine ng-valid ng-scope wmd-input" msd-elastic="" style="overflow: hidden; word-wrap: break-word; resize: horizontal;">

Thoughts?

balthazar commented 9 years ago

Hum, I think there is two errors here: first, you have not created a button bar, and that's why you have this error. I'll make it non-mandatory soon. The second problem is when setting the value of the model, the recalculation of the height is not done, you can try to input something and you will see the resize, will work on it too.

Thanks for the feedback!

staxmanade commented 9 years ago

Ok - you're right... I put the button bar and preview in this sample.

http://plnkr.co/edit/cXTatxu4MuffdqSnNd4d?p=preview

What I'm having an issue with is that the preview never gets rendered (until I execute a keydown/up in side of the txt box).

Would like the preview to render when the model gets set.

balthazar commented 9 years ago

Yeah I get that, I've already corrected the error when you've not set a bar, will investigate on how to fix your main problem

staxmanade commented 9 years ago

:+1: thanks for taking a look!!!