Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

How to refresh simplemde? #26

Open
eugene-b360 opened this issue Jul 16, 2021 · 2 comments
Open

How to refresh simplemde? #26

eugene-b360 opened this issue Jul 16, 2021 · 2 comments

Comments

@eugene-b360
Copy link

Default simplemde can be refreshed using codemirror refresh like simplemde.codemirror.refresh().
When I'm using simplemde with some value in modal window it stays blank until focused. I found a solution: refresh simplemde after modal is opened. How can I do it?

@cipchk
Copy link
Owner

cipchk commented Jul 17, 2021

I recommend using Vditor instead of simplemde, About angular version for @ng-util/markdown

@vipkek
Copy link

vipkek commented Apr 16, 2022

@eugene-b360 Hi! You can try this solution:

setTimeout(() => {
        this.simplemde.writeValue(value);
}, 0);

For example I've used this using Angular 2+ in ngOnChanges, listening for [open] Input changes:

ngOnChanges(changes: SimpleChanges): void {
    if (changes.open.currentValue) {
      setTimeout(() => {
        this.simplemde.writeValue(value);
      }, 0);
    }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants