Ionaru / Ionaru/easy-markdown-editor
Autosave text not working when there is two editors on same page
- Dominant language
- JavaScript
- Stars
- 3.1k
- Forks
- 363
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When two editor are created at same page with autosave enabled, autosave text does not work on second editor ie. it is empty and never updated.
Keep in mind that autosave itself works fine, only text is not updated correctly.
**To Reproduce**
Create html page with two editors
**Expected behavior**
Autosave text displays and updates correctly in both editors.
**Screenshots**

**Additional context**
I looked at the code a little and I believe that problem is [here](https://github.com/Ionaru/easy-markdown-editor/blob/1708e40c42ec5413af53119053caf66f89b0adb1/src/js/easymde.js#L2366C1-L2367C1). It seems that autosave text is retrieved via id which is problem in this case for obvious reason.
Contributor guide
Research direction
Start in src/js/easymde.js at the linked lines around 2366, where autosave text is retrieved, and reproduce the issue with two editors on one HTML page and autosave enabled. Done means each editor displays and updates its own autosave text independently, while autosave itself continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100