decap-cms
decap-cms copied to clipboard
Code block with language annotation causes report of unsaved changes
Describe the bug When loading a collection item into the editor which has a code block with a language mode set on it, the editor will report that there are "unsaved changes".
However, if you save the item, no change will be made to the source document, even though it has reported that there is an unsaved change.
To Reproduce
- Open a collection item for editing which has a field with a markdown widget
- Add a code block to the field using the visual editor. In the code settings, assign a language using the "mode" option
- Save the post, then reopen it
- Note that the "Unsaved changes" message is displayed at top left
Note that the content is correctly saved with the language attribute, e.g.:
```java
// some code in here
```
Expected behavior We should see "Changes saved" in the top left corner. If no language mode is set on the code, we do not see the issue.
Applicable Versions:
- Decap CMS version: 3.6.2
- Git provider: GitLab or local
- OS: MacOS 15.3.2
- Browser version: Firefox Developer 137
- Node.JS version: 23.10.0