doxiaodong / ng2-simplemde

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

frozen with ionic #16

Open jongchun opened 6 years ago

jongchun commented 6 years ago

Hello,

I am trying to use this with ionic. After clicking the preview button 3 times, It's frozen. I have to refresh a page to use it. But if I click the preview button 3 times, it happen again.

In app.modele.ts

import { SimplemdeModule, SIMPLEMDE_CONFIG } from 'ng2-simplemde/no-style' imports:[ BrowserModule, SimplemdeModule.forRoot(), IonicModule.forRoot(MyApp) ]

and

added in index.html In home.ts, added test:string; or test: any; In home.html, added <simplemde [(ngModel)]="test">

doxiaodong commented 6 years ago

Can you provide a simple repo?

jongchun commented 6 years ago

Too late? Sorry for this.

repo: https://github.com/jongchun/test

One more question. How to use this with ionic lazy loading? If I add this to child module like these: SimplemdeModule.forChild(post) or SimplemdeModule

I got errors both ways.

Thank You.

doxiaodong commented 6 years ago

Where is ng2-simplemde ?https://github.com/jongchun/test/search?utf8=%E2%9C%93&q=simplemde&type=

jongchun commented 6 years ago

sorry, my mistake. added now. Thank you.

doxiaodong commented 6 years ago

I don't provide forChild. It's only forRoot now.

doxiaodong commented 6 years ago

https://github.com/sparksuite/simplemde-markdown-editor/blob/6abda7ab68cc20f4aca870eb243747951b90ab04/src/js/simplemde.js#L768

since ionic will add '.activated' for a short time. and simplemde do not do right with that '.active' is not lastest class in classList. A fixed way is change all replace with ' ' in https://github.com/sparksuite/simplemde-markdown-editor/blob/6abda7ab68cc20f4aca870eb243747951b90ab04/src/js/simplemde.js example

toolbarButton.className.replace(/\s*active\s*/g, " ");
doxiaodong commented 6 years ago

https://github.com/sparksuite/simplemde-markdown-editor/issues/681. You can make a pr for this.

jongchun commented 6 years ago

Any future plan for lazy loading, SimplemdeModule or SimplemdeModule.forChild() ?

Thank You. ^^