joemccann / dillinger

The last Markdown editor, ever.
https://dillinger.io
MIT License
7.9k stars 1.1k forks source link

Use Chrome Extension to manipulate the markdown #856

Open AnguoZhao2020 opened 9 months ago

AnguoZhao2020 commented 9 months ago

sometimes, we need some private function to process the document automatically eg., 1) global search and replace by regex 2) quickly remove some specific characters, like blank or continuous blank etc 3) collate 2 language text or vice versa, de-collate for translation purpose

I use chrome extension version 3 now, I can get the markdown from localStorage.getitem("currentDocument"), property "body"

but, how can i write back the updated text to the editor? and make the document in editor refreshed?

AnguoZhao2020 commented 9 months ago

It's not elegant that, after process the current document I store the result back to local storage "files" then, use 'location.reload();' force the tab refresh, and get my desired effects is there a better solution?