`getDirtyCount()` returns `1` after loading
Hi @padcom this is an expected behavior as the load itself updates the state of the editor. You can simply clear the dirty counter via editor.clearDirtyCount() right after your manual load.
Read full answer below βQuestion
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome latest Reproducible demo link https://github.com/padcom/grapes-bug-dirty-after-loading/blob/master/src/App.vue#L37 Describe the bug Clone and start the projectOpen console Current behavior: number of changes is 1 Expected behavior: number of changes is 0 Additional note: when using autoload number of changes stays at 0Code of Conduct [X] I agree to follow this project's Code of Conduct
Answers (4)
Hi @padcom this is an expected behavior as the load itself updates the state of the editor.
You can simply clear the dirty counter via editor.clearDirtyCount() right after your manual load.
Please note, that if you enable autoload: and disable loading: number of changes is 0, even though the result is the same - the page is loaded. Since in my project I desperately need to be able to load the page at a specific time this is messing everything up. I also tried clearing the number of ch...
I beg your pardon? Are you quite serious that it is the "expected" behavior? Have you seen that in any other editor out there that the project is automatically modified upon loading and then automatically saved? I find that hard to believe.
The behavior you're observing, where editor.getDirtyCount() returns 1 immediately after programmatically loading content, is a common scenario when manually setting editor content after initialization, and it's not strictly a bug but rather how the GrapesJS undo manager tracks changes. Root Cause E...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #5385
GetDirtyCount() non deterministic after load
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link https://gith...
Issue #3860
Blocks not working after upgrading from 0.16.27 to 0.17.27
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Firefox 93.0, Chrome 94.0.4606.71 Reproduc...
Issue #5442
After applying the text color not able to set the background color
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? chrome Reproducible demo link https://jsfi...
Issue #4006
Background color automatically changes to black
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link https://grap...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins βPremium plugins ship with support, regular updates, and production-ready features β save days of integration work.
Browse premium plugins βRelated tutorials
In-depth guides on the same topic.
Tutorial
Ship to Production Faster: Whatβs New in GrapesJS Shadcn
Supercharge your page builder! GrapesJS Shadcn adds live drag previews, rich text / commands, dynamic data, and canvas presets to ship to prod faster.
Tutorial
How to Build a Production GrapesJS Editor: The Complete Walkthrough of Brief, Preset, Plugins, and Services
A complete walkthrough of building a production GrapesJS editor: how to choose a preset, pick plugins, and scope setup services without burning a sprint.
Tutorial
GrapesJS Inline RTE Plugins Update: CKEditor 5 v0.1.4 and Froala Inline Text Editor
CKEditor 5 Inline for GrapesJS v0.1.4 fixes Studio SDK toolbar clipping, iframe injection and link balloon bugs. Compare with Froala Inline β both $69.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.