GrapesJS Issues

3,464 parsed GitHub issues โ€” 370 solved ยท 90 open. Search, filter and explore battle-tested answers.

829 issues found

๐Ÿ” question
#2777May 14, 2020by kuhelbeher3 answers
2 reactions

[QUESTION] How to update styles in Style Manager

Hello. I created custom component where I set backgraound-image via custom asset manager Custom block code: Command which I run to set new image: It is working fine, image sets. But background property in Styles Manager doesn't update after image set. How can I update background property in style manager?

Ju99ernaut

Noticed that in general when you update styles for a component through code they do not reflect in the Styles Manager until you deselect and reselect the component and I can't find anything in the docs about refreshing the Styles Manager....

Ju99ernaut

Here #2728 they use: My guess is that background image is not updating because the src attribute is set instead of the background-image style property.

kuhelbeher

@Ju99ernaut thanks for advice but unfortunately it didn't worked. Also I noticed that properties like background-size or background-repeat also not reflected properly in Style Manager although it is set for selected component.

#2776May 14, 2020by math-artist3 answers
3 reactions

[QUESTION] Is it possible to use grapejs for printable documents?

Hello, I have a requirement to create a drag and drop template editor for a desktop application, to generate beautiful reports, and found almost nothing to do that easily. Then I found grapejs, and I am considering using the Qt WebEngine and have grapejs embedded in my application. I may have a web-based version of my...

Ju99ernaut

I think grapesjs would be perfect for your use case. Here #2724 it's probably being used in the same context.

Ju99ernaut

For pages that's a matter of creating a page block with height defined. As for variable tags, those can be included in the block as well.

math-artist

Ok, that seems like the right solution to manage a long list or table. Is there a way to lock the height of the web page and see the layout limit while editing? My plan is to create 3 or 4 pages with the same footer and insert variable tag...

#2772May 13, 2020by Mohsen-Khakbiz1 answer
0 reactions

[Question]: loading scripts/css to the canvas depending on traits

hey there. first of all thanks for this sweet lovely tool. what I need is to load js or css files to the canvas depending on traits. let's say I have a button with an option for making it triggering a lightbox. now what I need is to only load the lightbox plugin's files only when this checkbox is checked. I couldn't m...

artf

When you use canvas: { scripts: [], styles: [] } it appends only those files to the canvas of the editor, so you won't see them in your final code (editor.getHtml()). There is no kind of global list but you still can tell the component to...

#2770May 13, 2020by tiptronic852 answers
5 reactions

[QUESTION] Set selected element

Hello, is there a way to select an element after added to the body? When i add a link, i want to open the Component Settings immediately. How can i do it ? Thank you in advance

Mohsen-Khakbiz

I think this should work

tiptronic85

It works, thank you a lot. I add the code only for links and button and it is perfect. if model.is('link')

#2769May 12, 2020by cartifon1 answer
0 reactions

[QUESTION] - Event Handler from KeyMap should trigger the core events?

Hey @artf, question, should the core commands be triggered when the keyMap is activated? The situation: I added this listeners: When I delete a component using the delete icon it calls my listener, but when I press the delete key, it does not trigger the listener... Am I doing anything wrong here? You can check it her...

artf

Yeah, you're right, the command handler is executed directly here https://github.com/artf/grapesjs/blob/fbfa812eaaeeb467337107896ee6decfbfbc028e/src/keymaps/index.js#L154 it should pass through Commands.run(id, opts) https://github.com/art...

#2768May 12, 2020by kuhelbeher1 answer
1 reactions

[QUESTION] Can I add listener when user drag element on the canvas?

Hello, GrapesJS has bunch of events which could be listened with editor.on. One of them is canvas:drop. But it triggers only when I drop element which hasn't been on canvas yet. But I want to listen when user drops some component which already existed on canvas. Can I achiive this?

cartifon

Hi @kuhelbeher, in the version 16.2 they added that option, you can take a look here: https://github.com/artf/grapesjs/releases/tag/v0.16.2

#2764May 11, 2020by lofczNo answers
0 reactions

[QUESTION] block with content -> script after loading via storageManager

I have a component and a block defined inside my plugin. The block relies on fetching some data via AJAX and then re-rendering itself. When I d&d block to the editor canvas all works nice. But once I load the stored data, script is not executed. It can be seen in the image that component type is saved and loaded corre...

#2762May 9, 2020by lofcz3 answers
0 reactions

[QUESTION] How to listen to trait value change directly from block add

I'm passing following JSON to editor.BlockManager.add() function to define my block, load it's content from the server and populate select-type trait named defaultCategory in the same manner. Everything works nice. Now I need to listen to onchange event of that select and execute some JS there. I've consulted https://...

Aiyush-G

Did you solve this issue? If so, how?

SwapnilSoni1999

guide please

Vampire-V

@lofcz How do you fix this problem?

#2755May 6, 2020by Lerdouille1 answer
0 reactions

[QUESTION] Change 2 properties values in Style manager

Hi, i woud like to add a switcher in the style manager to update multiple properties in one click. For example, a switcher with some font awesome icons to align the DOM with the properties margin-left and margin-right. If i click on the "Align left" button, i would like to update both property "margin-left" and "margi...

artf

At the moment it's not that easy (we don't have documentation for custom styles) so, for now, I'd recommend using Traits

#2745April 28, 2020by Lerdouille1 answer
0 reactions

[QUESTION] ADD details in Assets Manager

Hi, is it possible to add some details on the asset manager ? Like the creation file date ? Today, i have only the filename and his properties Width and Height Best regards

artf

@Lerdouille you can extend assets type https://grapesjs.com/docs/modules/Assets.html