doxiaodong / ng2-simplemde

angular2 component of https://github.com/sparksuite/simplemde-markdown-editor
24 stars 21 forks source link

doesn't work with Angular Universal #18

Closed rjriel closed 6 years ago

rjriel commented 6 years ago

Trying to get ng2-simplemde implemented with Angular Universal. Seems like the code mirror package is using the navigator object quite extensively without proper checking, resulting in a crash when serving.

I know that since the issue is in code mirror the knee jerk reaction will be to say it's not in the scope of this project, but I figured the simplemde project isn't going to care about Angular Universal and I know codemirror won't, so I figured this is the best place to start

doxiaodong commented 6 years ago

Since simplemde is used after viewInit, see https://github.com/doxiaodong/ng2-simplemde/blob/master/src/component.ts#L64 . A way to clear the crash is to mock navigator object on the server side code. maybe https://github.com/darrylwest/mock-browser