Skip to content

Code block with language annotation causes report of unsaved changes #7431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sebduggan opened this issue Mar 20, 2025 · 0 comments
Open
Labels
type: bug code to address defects in shipped code

Comments

@sebduggan
Copy link

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

  1. Open a collection item for editing which has a field with a markdown widget
  2. Add a code block to the field using the visual editor. In the code settings, assign a language using the "mode" option
  3. Save the post, then reopen it
  4. 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
@sebduggan sebduggan added the type: bug code to address defects in shipped code label Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant