GrapesJS Issues

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

829 issues found

๐Ÿ” question
#2813June 3, 2020by KaytotheH1 answer
0 reactions

Blocks attributes

` const blocktext = blockManager.get('text').set({ label: 'Modified text', attributes: { } }) ` I want to add an attribute to the original text block, I want the attribute to give the user the option of giving the component, time to appear and disappear at another time. My question is, what are the attributes that I c...

artf

You can do this editor.Blocks.get('text').set({ attributes: { class: 'my-custom-class' } })

#2810May 30, 2020by BerkeAras2 answers
1 reactions

[QUESTION]: Possible to make it for non-devs?

Hello! Is it possible to make a version for non-developers or people who don't know css basics. I am programming a CMS and most users don't know what position: absolute is, they just want to drag and drop element to a place, where they want.

Ju99ernaut

grapesjs already supports moving components freely, check issue #1936

BerkeAras

Thanks ๐Ÿ‘

#2809May 29, 2020by antman33511 answer
0 reactions

[Question] Modal destroy contents on close

Hello, I'm using the modal with some commands. I've noticed when calling modal.setContent( ... ) what ever was in the modal before is moved to a hidden div with class gjs-mdl-collector . Is there a way to destroy the content on close? Or should I just remove the content .innerHTML('') before closing? Thanks, Antonio

artf

If you don't need those references you can clean them manually

#2808May 27, 2020by robertraf3 answers
1 reactions

[QUESTION] Custom type component in production environment

Hi, I have a question, when I create a custom type component from the editor, what would be the next step to show that component in my application? Currently I am saving the component data in firebase with the firestore plugin, the attributes that are stored in the object are the following: gjs-assets, gjs-components,...

Ju99ernaut

onRender simply specifies what should happen when you successfully place a component onto the canvas, whereas script is code that will be generated in your html inside script tags. Something like:

Ju99ernaut

I think in a production environment all you need is the html and css code generated by grapesjs.

robertraf

I understand that part, but if I want to render the component I have created it doesn't work. I'll explain a little, I have created a type of component that renders data from an endpoint, if I use the html and css code it doesn't work. Cus...

#2805May 27, 2020by EgorPashko3 answers
6 reactions

[QUESTION] "Changes you made may not be saved." alert popup is displayed

Hey guys I have some problem related to alert which displayed when I tried log out of page. Actually I do not know bug is it or something else. I have read documentation, but did not get answer yet. If you help me I will gratefully to you. Alert message is "Changes you made may not be saved."

Ju99ernaut

I guess the alert still shows up even if you have storage set up. Add this to your initialization: By default it's set to true

Ju99ernaut

It's probably because you have no storage set up

pjdevries

I thought about storage as well and was about to set up a dummy storage, hoping it would circumvent the problem. The noticeOnUnload: 0 works like a charm though, so no need for that. Thank you very much.

#2801May 25, 2020by fedd3 answers
1 reactions

[Questions] Enrich any component with the serverside if or foreach expressions (namely, MVEL)

I am researching how to make a template with server side expressions that will repeat a component (foreach) or completely remove it (if). My backend parses templates with mvel. What I am thinking is to add a couple of settings to all or some select elements. For example, to a <div> of a Cell, so it looks like this: <d...

Ju99ernaut

To surround an element take look at toHtml, you can search it in the issues for examples. In any case I don't think it's a good idea to replace the default component type, I'd suggest creating a new component that extends the default type...

fedd

The docs for components might be helpful I've written my code based on this article. It says,Updating component types is quite easy, let's see how: .... // The defaults property is handled differently // and will be merged with the old def...

artf

@fedd you can add your new traits in model.init function

#2799May 24, 2020by dintifla3 answers
0 reactions

[Questions] Ordering of selector with id and class selectors, space after id-selector

I am currently working on a web application for which we integrate this project as GUI editor to customize the environments. Our GUI components are loaded and parsed from the database. We can identify e.g. a button, data grid, etc. by an ID (e.g. 17190fbd-13d6-430f-bb32-1a09d2151a77). These components are then built f...

dintifla

a short update: I managed to get the the selectors in the right order when using selectors.unshift(idSelector) instead of selectors.add(idSelector) in above sample. Now i still have the issue with the missing space between the id- and the...

artf

Hi @dintifla SelectorManager is not meant to work like that (you can only have a mix of classes .class1.class2 but not with IDs), but honestly I don't understand what is your goal of using the SelectorManager at all. If you need to query a...

dintifla

Hi @artf Thanks for your reply. In the end it is not just about querying a component, but generate the CSS for it. I don't need the HTML since my application is designed in a rich client application, stored in an abstract representation in...

#2789May 19, 2020by iamDreamcode1 answer
0 reactions

[QUESTION]: Adding colors to built-in RTE

Hi I'm trying to add color to built-in rte for background and foreground, but after unfocusing an element - style prop resets. Here is an example : https://jsfiddle.net/2s3vhygn/ Looks like i need to update an model and set up styles on it. Trying to update model using this code: But inserted span isn't selectable. So...

artf

@iamDreamcode to make that element selectable you should force the sync of the text component https://jsfiddle.net/xhp7k1bs/

#2787May 18, 2020by JoLoZ1 answer
0 reactions

[QUESTION] Replace all of HTML

Hello there, I am trying to use GrapesJS for template customization for my end users, but ran in the following problem: There is no documented way which I can replace all of the content with something like a function. I tried redirecting, but that, well... redirects. What I have: -An exact copy of the demo page (I cou...

artf

Well a lot of things depend on your backend and there I can't help you, but if you need to replace the canvas with a new template you would use something like this