-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
BUG: editor.Css.setRule API not working as expected, it is not updating the rule existing rule. #5173
Comments
Hi @FaisalShaikhHA this is expected behaviour but I guess the documentation of This is what you should do if you need to add new styles instead of replacing them const selector = `#${this.getId()}`;
const rule = editor.Css.getRule(selector);
editor.Css.setRule(selector, {
...rule?.getStyle(),
background: 'black'
}); I guess I can add a new |
Thanks @artf for the clarification |
* Add autoFormat option to CodeMirrorEditor * Add optsCodeViewer * Remove unused options * Use createViewer in ExportTemplate * Up ExportTemplate * Cleanup * Up panel/index to TS * Refactor Panels TS #5144 * Cleanup * Up panels test * Fix `usePlugin is not a function`. Closes #5167 * Move css_composer/index to TS * Up css_composer tests * Up tests * Add `addStyles` option to `editor.Css.setRule`. Closes #5173 * Update setRule JSDoc * Fix PropertyStack in bundled dts file. Closes #5154 * Fixed broken link in README.md (#5188) Update README.md added ".com" in a not functioning link. * Refactor Traits Collection (#4983) * Refactor Traits Collection * Fix css prefix * Fix trait undo and add test for it --------- Co-authored-by: Artur Arseniev <[email protected]> * Update keymaps add jsdoc * Improve typings (#5192) * add component:resize to ComponentEvent type * limit storageManager type to be 'local' | 'remote' | undefined * add type to components parameter * Use LiteralUnion in storage_manager config * Up editor TS * Improve components TS * Update ComponentModelDefinition * [Docs] Update Broken Links for (Component Types, and Commands) (#5196) update links * Don't remove styles with avoidInlineStyle #4503 * Up block_manager * Up device_manager * Up pages TS * Add PageProperties * Update PageManager TS * Export Sector/s in TS * Up style_manager TS * Up Property TS * Up TS * Up TS * Up canvas class * Fix SwitchVisibility * Store custom selector manager container * Refactor OpenStyleManager * Up OpenStyleManager * Up OpenStyleManager * Up selector_manager * Add custom option to trait_manager * Up trait model * Up OpenTraitManager for custom traits * Up * Handle properly Component model `defaults` as functions. Closes #5199 * Fix PropertyFactory tests * Up RTE doc * Update rich_text_editor.md (#5201) The previous code snippet encountered a syntax error when attempting to use it in my application. To ensure its usability for others, I have made necessary updates to resolve the syntax error and enable successful execution. These modifications aim to provide a code snippet that can be easily utilized by anyone without encountering any syntax-related issues. * Build * Up docs --------- Co-authored-by: pfaffmann <[email protected]> Co-authored-by: Alex Ritter <[email protected]> Co-authored-by: Julia Alberici <[email protected]> Co-authored-by: Abdelrhman Said <[email protected]> Co-authored-by: Ai Anshu <[email protected]>
GrapesJS version
What browser are you using?
Version 112.0.5615.137 (Official Build) (arm64)
Reproducible demo link
https://jsfiddle.net/yhj6qa1u/6/
Describe the bug
How to reproduce the bug?
editor.Css.setRule
to set some style for that particular component, notice the previous styles are removed but as per the documentation it should update the CSS rule.What is the expected behavior?
It should update the existing rule.
What is the current behavior?
It removes the existing rule rather than updating the existing rule.
Screen.Capture.on.2023-06-09.at.18-50-06.mp4
Code of Conduct
The text was updated successfully, but these errors were encountered: