` 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' } })
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.
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
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...
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.
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
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...
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/
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