What I'm trying to achieve is whenever the "block" inside of the canvas is edited the style isn't added to an #id but instead added to a class. My logic is to take the current ID that is used - the random string and remove it as the ID and make it a class and then assign styles to that class instead of the ID, yes it'...
artf
Just create blocks/components with classes and, by default, the Style Manager will apply styles to them
Fahad-ishfaq
Just create blocks/components with classes and, by default, the Style Manager will apply styles to them Hi! Can you please tell if we can switch off this behaviour. I want to editor to setup CSS style to element id instead of class names....
Steps to reproduce:Select any element.Try to add a background via Style Manager using 'Decorations' -> 'Background'.Click a plus sign. Expected behaviour: No extraneous requests are made. Actual behaviour: An extraneous GET request is made to ../none (i.e. to https://grapesjs.com/none if on https://grapesjs.com/demo.h...
Hi, Reading through the documentation, I can't find anywhere that explains what I'm looking to do. Currently, Grapes grabs the background image and puts it into the style, but I want to take this image and not add it to a background style, I want to put it into a data-element on the element that is selected. I've been...
pouyamiralayi
Hi @awaredigital StyleManager targets both Components and CssRules, so do it like below: Cheers!
andy-aware
That is great. How do i stop the data of model.getStyle()['background-image'] being passed into the CSS? Only the background image. Thanks
pouyamiralayi
@awaredigital i have tested the above code and it was working fine. but for the error, you may check `bg` before further processing because after we update the component style we may get the callback again which is your case here: Cheers!
Hi @artf I hope everything's going well. This is more like a reminder or a warning message for an issue I've just had that it took me some time to figure out. if the wrapper's height (modified by the selector #wrapper by default) is set to height: 100%; instead of min-height: 100%, the editor's tool container will tak...
artf
Hi Juan, thank you for all the details, I'm going to merge soon a big canvas refactoring and will see if we can fix it (eg. attaching scroll callback to the wrapper)
artf
Thanks for the reminder @bgrand-ch I actually forgot about this issue 😬 Will be fixed in the next release.
jcamejo
Glad to hear it, i hope the refactoring helps to fix the issue.
Hello Is it possible to only allowing one h1 tag on the every page? I need to make sure that we only can drag one h1 tag into the canvas. What to do? :-)
artf
@pouyamiralayi thanks as always for the huge support ❤️ BTW @ikenderham keep in mind that is correct but only if need to check components as first children of editor.getComponents() (which returns children of the main wrapper) If you need...
pouyamiralayi
@ikenderham cheers!
ikenderham
You are so nice! How can I thank you?? Thanks alot! Khdafesممنون I will try this example tomorrow on work. I just follwed you on github !
I'm using component.find() to search for a nested component in a big chunk of HTML content for a fieldset tag so that I can append components after it. Component.find locates the component, as seen in the console.log, but attempting to .append or use .components to inject content results in a console error: fieldSet.a...
msantore
Figured this out! Just had to specific an array position :-) After using component.find('fieldset') be sure to set an array position fieldSet[0].append(questionFieldSet);
Hello, I'm trying to make a simple modification to the default image asset and am running into a wall, and am sure I'm missing something simple. I need the image element to have an additional attribute that I pass into it, called mySpecialId. I can't figure out how to get the asset to render this into the DOM. I think...
artf
Put it in a plugin if you need to update also the already defined assets
When I drag a component - say a Map - onto the canvas, it now creates three copies of that element in the DOM. However, the model is correct, and if I refresh the screen, it renders correctly. Without trying to erect an entire sandbox to reproduce, any quick thoughts on what might be causing this? Thanks, Andrew
andrewryan1906
OK, as far as I can tell the problem is in Sorter.js and centers around this code: This code is called by onMove any time you start to drag a component onto the canvas. I see that you create temporary component, and then immediately remove...
andrewryan1906
This entire problem disappears when I remove this line from my configuration init: Something about that setting causes this behavior. Still don't understand what.
artf
Thanks @andrewryan1906 for all the insights, actually the Sorter file was in my to refactor list for a while now but didn't yet find the time to handle it... Anyway I'm still confused about what is going on, for sure I need you to create a...
Not sure why, But all of a sudden, when I start dragging components onto a canvas, I get this: This seems to happen when I edit a template, save it, and reload it. It also seems to happen when I try to drag a new component to the LAST element of the page; if I try to drag and element inside of a DIV container inside t...
andrewryan1906
Here's another clue... once the canvas "breaks" (which I can reliable make happen by refreshing the page and forcing a load... this behavior doesn't happen on new templates, only when the template is loaded from my custom storage, but I ve...
andrewryan1906
OK, I managed to stick grapes.js into my Angular project and reference it instead of the minified version, so I could get more insight into what is going on. The problem seems to be in Sorter.js. The findPosition method is tasked with figu...
When I create a new Dom Component, I give it a name in the "defaults" section, like: When the component is dragged on to the canvas, the Foo Bar string shows up as a badge like it should, and the text appears in the Layers panel and everything is good. But when the canvas is persisted to storage, and I refresh the pag...
pouyamiralayi
@andrewryan1906 please define your component type inside a plugin. cheers!