GrapesJS Issues

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

829 issues found

๐Ÿ” question
#1549October 29, 2018by jotakar2 answers
0 reactions

Question: getAll and getAllVisible

I read that getAll returns all assets collection and getAllVisible returns all assetes rendered in html (I understand:used in the template). But when I do execute editor.AssetManager.getAll().models and AssetManager.getAllVisible().models I get the same array: all assets in template used and not used. Why? Thanks

artf

It's not "the same array", you just get all the assets visible by default, so if do editor.AssetManager.render(['img1.jpg', 'img2.jpg']) you'll see the difference

lock[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

#1548October 29, 2018by jotakar3 answers
0 reactions

QUESTION: How insert box, section, footer, header...

I'm trying to imagine how to insert a header or a section or a box... I see the blocks panel, and extra an every panel, but all I can insert are rows - columns, images, navs... but a section or a box .... how do it? Please an answer :( Thanks

cjpollard

You can easily create your own blocks. https://grapesjs.com/docs/modules/Blocks.html

jotakar

Thanks Yes I know I can create blocks, but In the demo (https://grapesjs.com/demo.html) I see this elements but I can't see any special block for this kind of elements. This is the reason of my question, hoe this blocks have seen created i...

artf

@jotakar it's just an import of a pre-made template https://github.com/artf/grapesjs/blob/gh-pages/demo.html#L147

#1545October 28, 2018by crashangelbr2 answers
2 reactions

[Question] How I Get ID From Block?

Hi, i have my block and I get print in Div id results from my javascript class component... How i get ID from my block ??? editor.BlockManager.add('test-block', { label: 'Test block', attributes: {class: 'fa fa-text'}, content: { content:'<div id=""></div>', script: function () { console.log(document.getElementById("M...

juanj

You can use this inside the script to reference the block element. If you want the id you can use this.id. Note that document.getElementById(this.id) == this

lock[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

#1543October 26, 2018by TommyLjung2 answers
0 reactions

[Question] Enable Traist-checkbox by default

Hi. I am new to GrapesJs and really liking it so far. But now I have a (probably beginner) question: How can I make a trait-checkbox be selected by default? I have tried with: traits: [ { type: 'checkbox', label: 'Loop', name: 'model-loop-bool', changeProp: 1, selected: 'true', }], But "selected" or "checked" is not t...

artf

If you use changeProp you get the value from the component value, eg: without changeProp, it would be:

lock[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

#1540October 24, 2018by SeongwoonHong2 answers
0 reactions

[Question] Is it possible to add event for preview?

I'd like to convert some texts when a user clicks the preview button. for instance, ((name)) (in the editor) should be 'David' (in preview mode) which comes from the server as it is dynamic field. So, would it be possible to call api when clicking preview and the preview result should wait till i get the data from the...

artf

You can use command events, eg:

lock[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

#1537October 23, 2018by hpruvot3 answers
1 reactions

Duplicate component not style

Hi, First of all, thanks a lot for the awesome work โค๏ธ !!! I've a question about the duplication tool so here the steps to follow :I drag&drop a text componentI change the style (color in green, weight, size, etc...)I duplicate itI change the color in red BUT the original component changes in red too because they have...

artf

Hi @hpruvot I'd like to say, at first, if you clone a component with a class and you change it, you see changes on both, this is because how classes work. If you want to avoid the editor creating classes for you, use this option:

hpruvot

Oh sorry I missed that option, thanks ๐Ÿ‘Œ

lock[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

#1536October 23, 2018by dlorenzo2 answers
0 reactions

[Question] Propagate different value

Hi: I'm trying to prevent children elements from being selected so only the top parent can be selected (so as to prevent removing children and only being able to work with whole blocks). I created a component that defines the parent with a selectable false and propagate: ['selectable']. This works ok but, of course, t...

artf

Any way I can add selectable: true to the parent and propagate a false value? I'd say that the only way is to create a wrapper in the middle: And, in a similar vein, is it possible to override propagation down the line? No, you can't stop...

imanubhardwaj

I'm also facing this issue, where I have created a custom components with image wrapped inside a <a> tag, when I click on the component, image tag click is triggered rather than <a> tag click. Is there any solution to this?

#1531October 19, 2018by alfaalex813 answers
0 reactions

[Question] Css class

Hi! Probably this problem is already posted, but I can't understand where I'm wrong. I use this three parameters on init GrapesJs. I would like GrapeJs not to edit preexisting css, but only creates its own. Is it possible? Thank you!

alfaalex81

For example i have this code on canvas GrapesJs add to CSS this class This rule modify all element with this class, this is a generic bootstrap class that we use in all site.

artf

@alfaalex81 I can't reproduce it, create a live demo please

alfaalex81

https://jsfiddle.net/ugc1otnk/ In the example when i change background color in the first column, GrapesJs set the css attribute to the external class "col-md-6", that is a bootstrap class name. I prefer Grapesjs set own class. Moreover I...

#1526October 18, 2018by gasserol3 answers
2 reactions

[QUESTION] how to make fullscreen command

Hi, unfortunately I do not find documentation and can't manage to get it understand from code: I know there is a built-in command 'fullscreen', but with my configuration (from tutorial) it does load only canvas in fullscreen, no panels. Here is my html code: and here my panel code: Can somebody put me on the right way...

electrotype

@nativeer I had the same problem. My workaround is to call stopCommand before runCommand: Seems to work for me.

artf

Good point, the default Fullscreen command enables the fullscreen on the container (#gjs) but with external panels this obviosly doesn't work, and this is why you see only the canvas. I'd really appreciate a PR for a new option which would...

gabjdev

Hi @artf , Above code worked for full screen, but after I exit full screen manually, it doesn't work anymore. Could you post code to exit full screen with same button?

#1522October 16, 2018by SeongwoonHong2 answers
0 reactions

[Question] is it possible to add some text to content body where the cursor is ?

I'd like to have a button that is outside the editor and if i click this button, some text should be generated in the body where my cursor is currently. I've tried to find but couldn't find a solution for this..

artf

https://github.com/artf/grapesjs/issues/111#issuecomment-310059057

lock[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.