BUG: When we resize an image with a class 'xyz', all the elements on the page with same class also gets resized because editor adds css to those classes.
See original GitHub issueGrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Version 104.0.5112.101 (Official Build) (arm64)
Video demo link
Describe the bug
- When we resize an image with a class ‘xyz’, all the elements on the page with the same class also get resized because the editor adds height width CSS to those classes.
- But when I remove all the classes from the image, the editor uses the id to set height width CSS.
- I am loading a bootstrap template in the editor. Recording link: https://d.pr/i/27EgH2
Steps to reproduce:
- Load bootstrap template for editing.
- Add multiple divs with shadow class ex.(
<div class='shadow'></div>
) - Place an image in one of the div which has shadow class and then try to resize the image.
- Notice all the divs moving/resized along with the image.
- Expected behavior only image should be resized.
- Using grapesjs-parser-postcss as well and added it in initialization code.
- Passing the CSS & javascript URLs using canvas option.
init method:
grapesjs.init({
container: "#gjs",
.....,
canvas: {
scripts: scriptUrls,
styles: styleUrls,
},
parser: {
parserPostCSS,
},
});
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
resize - CSS: Cascading Style Sheets - MDN Web Docs - Mozilla
The resize CSS property sets whether an element is resizable, and if so, in which directions.
Read more >CSS force image resize and keep aspect ratio - Stack Overflow
I 've tried the max-width/max-height as numbers with width/height as auto, but as setec said above, it will not enlarge the image. I've...
Read more >How to Resize Images Using CSS for Responsive Web Design
Ensure that your images stay sharp and pixel-perfect on every screen size by resizing them with CSS, or intuitively on Editor X.
Read more >Resize image proportionally with CSS - GeeksforGeeks
The resize image property is used in responsive web where image is resizing automatically to fit the div container.
Read more >How to resize an image in HTML? - ImageKit.io
One of the simplest ways to resize an image in the HTML is using the height and width attributes on the img tag....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
https://grapesjs.com/docs/modules/Components.html#components-css
Thanks, @DevMetwaly it worked, my bad I missed this.