GrapesJS Issues

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

644 issues found

๐Ÿ” components
#2673March 20, 2020by qtarant2 answers
4 reactions

[SOLVED] [QUESTION] Function to refresh DOM tree after component changes

Hello. I am developing a site using this amazing software. Now, I am customizing the editor and I have found a task that I am not be able to carry on. I am using the ckeditor plugin and it works as expected. In the ckeditor toolbar I have the option of insert images inline the text. It works well, but the problem is t...

qtarant

I have already solved my problem. The key code is the event "rte:disable" that is fired when the Rich Text Editor (rte) is closed. And another important thing is that the content that it has been edited is not in the component model, only...

pouyamiralayi

@qtarant check out #2537 comment Cheers!

#2664March 18, 2020by Podvodila2 answers
2 reactions

[Bug] getComponents method doesn't return tree of components

I'm trying to implement multiple pages as per discussion in that issue - https://github.com/artf/grapesjs/issues/1331 But when I trying to get components tree by using 'editor.getComponents()' it returns data with wrong format(model collection I guess). When I try to set components using the editor.SetComponents metho...

Podvodila

Need to stringify and parse back returned components(works only if components were set programmatically initially) JSON.parse(JSON.stringify(editor.getComponents())) https://jsfiddle.net/w1497xp8/ Upd.: same with editor.getStyles() method

artf

Yes, this is the correct way to obtain the same string of the StorageManager

#2660March 16, 2020by just-vicu2 answers
1 reactions

[QUESTION] Reinit model's components function

Hello guys, I have a custom component with different structure based on prop's value. How can i recall/reinit model's components function on prop change event. Thank you in advance.

artf

I think this.components(this) will throw the Maximum call stack size exceeded error as you're trying to append the component to itself. Probably you have to try this I'd probably suggest, in this case, to isolate the function to make thing...

pouyamiralayi

Hi @V1cu you can register your listeners inside the init hook like below: Cheers!

#2656March 16, 2020by abozhinov3 answers
1 reactions

[BUG] Wrong position of toolbar when duplicate children component

Hi, you can check this example: https://codepen.io/abozhinov/pen/XWbqjEJ Steps to reproduce the problem:If components existing delete them all.Drag a new carousel block. Select the first children's container.Click on the DUPLICATE icon to create a new component.After that try to select the newest component and then se...

abozhinov

When overwrite these two methods in 'select-comp' command everything works perfectly. The problem was that "el" doesn't exist in the DOM. ` onHovered(em, component) { let result = {}; if (component) { const { view } = component; const { el...

abozhinov

The same result you can get when trigger render instead of reset.

abozhinov

@artf if you try on the demo is the same. Just drag the carousel and click on the slide. <img width="1440" alt="Screenshot 2020-03-16 at 14 58 23" src="https://user-images.githubusercontent.com/1404839/76760669-b8b75780-6796-11ea-8e24-8946...

#2650March 14, 2020by abzal03 answers
2 reactions

Slick.js reload the slider on image asset change

Hello everyone, I am integrating slick slider, the issue is with reloading the slider after image is uploaded. After onclick of open assets the Slick slider must be reinitialized so that regular html of the slider would become slick slider, that happens on adding the component to the canvas only: $('#slickslider').sli...

pouyamiralayi

Hi @abzal0 the correct function is actually `updateScript my bad! here is how i did it: first defining the component type: Every time the script runs, i reset the slickjs for the sake of re initialization which you can see in the script. I...

abzal0

@pouyamiralayi this is incredibly valuable code, thanks a lot for sharing it :) it works better than I needed. Will be sending you an email, hopefully you will reply.

pouyamiralayi

@abzal0 how to reinitialize 'script' function inside editor.blockmanager.add to reload the jquery code of slider? for your `script` code, i suggest you move it to the component definition and in there, you can issue: for script reloads. Ch...

#2637March 11, 2020by mcottret3 answers
1 reactions

[Bug]: Preview mode & automatic components borders toggling

Hello again :) Our team recently started customising the editor & removing the webpage preset, and we might have found some bugs related to the preview mode:When exiting preview mode, an error can be raised if the default options panel has been removed, or if the sw-visibility button has been removed from it (from her...

artf

button would already be deactivated by the time Preview's run would be executed no matter what, is that correct ? oh yeah, right ๐Ÿคฆโ€โ™‚ From your reply on the linked issue, I understand this behaviour is intended, so maybe the solution is si...

artf

Thanks @mcottret for all the references, really well-written issue :)When the preview & the sw-visibility buttons are in the same panel, the behaviour introduced by #2589 breaks, this seems to come from the ButtonView's active change liste...

mcottret

Thanks for the reply @artf ! I'm sorry but I'm not sure how to make this work, from what I understand the active change listener gets executed before the Preview's run, so the sw-visibility button would already be deactivated by the time P...

#2635March 10, 2020by micker3 answers
2 reactions

Load external css in editor

hello i search a lot but i didn't find how to load a css file inside editor My code regards of other issue i add styles: [\'http://localhost/flexidev/templates/shaperhelix3/css/template.css\'] no real error but no style ... what i forgot ? function fclayoutinitbuilder(editorsfx, elementid) { /*Lets say, for instance,...

pouyamiralayi

@micker you must include them like this: I do not see the `canvas` object in your setup. Cheers!

pouyamiralayi

@micker if your `customCss` is a url, that's the way to include it. but if you you have some styles that you want to include by hand, here is the procedure: Cheers!

micker

i try to use https://grapesjs.com/docs/modules/Storage.html#store-and-load-templates but i not sure about this ... if i add canvas like this i have this error seams doesn't link `canvas: { scripts: null, styles: [\'http://localhost/flexide...

#2628March 8, 2020by abzal03 answers
2 reactions

How to update the trait value

Hello @artf thanks a lot for a great project, I have created a new type, it is similar to regular link, but the link title updates with ajax. Then updates the trait 'linktitle'. The value of it and the canvas do update, but the trait inside "Settings" still shows the initial value and does not changes. Part of the cod...

pouyamiralayi

@abzal0 alright! although the prop approach must work fine, i am not sure why it is not, or i am missing something here! if we want to go with attributes, you must use `addAttributes` for changing the attribute, here is a working example o...

abzal0

@pouyamiralayi thanks a lot for your time, this solved the issue: this.model.addAttributes({'linkTitle':oldValue + ' Changed!'}) you saved so much time, thanks again :)

abzal0

editor.getSelected().getTrait('linktitle').set('value','CCC'); does not works too

#2625March 5, 2020by DRoet1 answer
0 reactions

[QUESTION] Call parent method from within plugin

Hi @artf, What would be the recommended way of calling a grapesjs method from within a plugin? The grapesjs-mjml plugin uses this.MethodName() (https://github.com/artf/grapesjs-mjml/blob/7a9712ce7a401079f31932a7fe2c342657e85efa/src/components/index.js#L248) However when the plugin gets minified in the production bundl...

artf

Probably you would need something like this in any case, seems really weird that the minifer makes such an unsafe removal. I use something similar here and it doesn't break