GrapesJS Issues

3,464 parsed GitHub issues β€” 370 solved Β· 90 open. Search, filter and explore battle-tested answers.

545 issues found

πŸ” typescript
#3185Dec 11, 2020by Stiggi2 answers
0 reactions

How to get the models trait of a component?

Hi there, I added a new type "array" to the TraitManager. So I can add several sub traits. On one point I have to check the traits of the model. I do this with a construct like this: Is there an easier way to get the model of a component directly from the component? Best regards, Michael

Stiggi

simpler than I thought :) editor.getSelected().defaults.traits

GJSBlock

Thanks for reporting this, @Stiggi. Great question about [QUESTION] How to get the models trait of a component?. The recommended approach with Components is to use the event-driven API. Start here: Check the GrapesJS documentation for your...

#3181Dec 11, 2020by congweibai2 answers
0 reactions

SelectorManager not return a String but an Object

Version:0.16.30 Are you able to reproduce the bug from the demo? [1 ] Yes What is the expected behavior?* SelectorManager.getState() is supposed to return a string according to https://grapesjs.com/docs/api/selector_manager.html#getstate Describe the bug detailed What is the current behavior? SelectorManager.getState(...

congweibai

Could you have a look at https://github.com/artf/grapesjs/pull/3182 is this fix this issue? Thanks

GJSBlock

Thanks for reporting this, @congweibai. The issue with SelectorManager not return a String but an Object appears to be a race condition or state management timing problem. This typically happens when component lifecycle events and DOM modi...

#3179Dec 10, 2020by TheEightArms4 answers
1 reactions

AssetManager seems to load assets from cache and doesnt update (Question)

Hi, i've been trying to integrate Grapes for last few weeks into my VueJs project, but i got a question for the AssetManagement. thats my simple assetManager configuration, for some reason it loads another Image i uploaded two weeks ago and doesnt update, no matter what i try. If i use assetManager.add('URL'), it says...

gixid192

@TheEightArms You can set storeManager to false in init function

TheEightArms

I found out, its loading its assets from the saved code and from the database, is there a possibility to tell the StoreManager not to load assets ? Thx

artf

You can also avoid returning assets from your endpoint (where you load components and styles)

#3176Dec 9, 2020by mcottret4 answers
1 reactions

`setStyle` & `setComponents` options parameter not taken into account

Version: 0.16.30 Are you able to reproduce the bug from the demo? [x] Yes [ ] No Steps to reproduce:Open the consoleExecute editor.setComponents('', {avoidStore: true});Execute editor.setStyle('', {avoidStore: true});The "Stored ..." log still appears (see attached screenshot) What is the expected behavior? The option...

artf

Thanks @mcottret the fix is ready for the next release

artf

Unfortunately, due to the bad initial naming, avoidStore is intended to skip the UndoManager and not the Storage 😁 The good news, I had to introduce the new noCount option, in order to fix #3189, this will skip triggering the editor chang...

mcottret

Hello @artf ! I'm sorry to reopen this issue but the setStyle issue still seems to be present. Redoing the steps above, the "Stored ..." log still appears while calling setStyle with the noCount option. I'm seeing the fixed handleChanges h...

#3175Dec 9, 2020by mcottret2 answers
0 reactions

Selection & active RTE not cleared when component is removed programatically

Version: 0.16.30 Are you able to reproduce the bug from the demo? [x] Yes [ ] No Steps to reproduce:Select a text component in the demo's canvasThe selection box & RTE appearOpen the consoleExecute editor.setComponents('');The component is removed, but the selection box & RTE are still present (see attached screenshot...

artf

Thanks @mcottret for the report. I've handled this on my side, so it should be fixed in the next release, but as always, thanks for your willingness to help :)

GJSBlock

Thanks for reporting this, @mcottret. The issue with Selection & active RTE not cleared when component is removed programatically appears to be a race condition or state management timing problem. This typically happens when component life...

#3174Dec 9, 2020by ThetripGr2 answers
1 reactions

Creating a new component type does not inherit the functions of it's parent type

Hello, I am trying to create a new common trait shared among all components by creating the following plugin on another plugin file I am also creating a new component type same way following the docs, called extendedText which uses the text type as it's basis. While the text type has the handleBgColorChange() as shown...

ThetripGr

nvm , I revisited the docs more carefully, I somehow missed this about extending parent functions

GJSBlock

Thanks for reporting this, @ThetripGr. Great question about Creating a new component type does not inherit the functions of it's parent type. The recommended approach with Components is to use the event-driven API. Start here: Check the Gr...

#3172Dec 8, 2020by theSC0RP2 answers
0 reactions

How to track the updates of components down the tree?

Hi, @artf. I have a few questions regarding component lifecycle hooks. In my application, I want to track the updates to all the children of a component and their children, and so on. How should I do it?Updates on immediate children are tracked by the model.updated() hook but I need to track the updates to a component...

artf

I'd create a specific listener on the parent then I'd trigger that event from the child

GJSBlock

Thanks for reporting this, @theSC0RP. Great question about How to track the updates of components down the tree?. The recommended approach with Components is to use the event-driven API. Start here: Check the GrapesJS documentation for you...

#3171Dec 7, 2020by skbhagat404 answers
0 reactions

Adding / Updating href trait does not add `<a></a>` wrapper to image.

Expected Behavior - when I update href trait value, the image should be wrapped inside a with href value set. i.e. <a href="google.com"><img src="/></a> Current behavior = no change is reflected Here's code for adding trait The above function is triggered on double click, Please help me how do I add href to image dyna...

skbhagat40

It's not working, even if I do `selectedElement.getTrait('href').set({value: 'fb.com', target: '_blank'})

skbhagat40

I think the component view is not getting updated, if I repeat the action, it is rendering a tag with previous value.

skbhagat40

It works if I update href in the attributes

#3170Dec 7, 2020by ThetripGr3 answers
0 reactions

Add class name from traits

Hello, what i am trying to achieve is to have the text component extended by assigning an extra trait named Alignment and deciding through the trait the kind of alignment i wish to do, after that no css should be applied but the appropriate class name should be given to the component. Is there an example of how i coul...

ThetripGr

So i got it working after some more tries, i will try to explain how i got it to work. When you define the trait you can declare a name. When you select option A from the dropdown selection you can track this change on init(), as this.on('...

artf

sry for the formatting but i do not know how to paste formatted code yet :P https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown

GJSBlock

Thanks for reporting this, @ThetripGr. Great question about Add class name from traits. The recommended approach with StyleManager is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look f...

#3169Dec 7, 2020by mrobertshaw3 answers
1 reactions

I am trying to implement an editor where certain sections of the page are edita…

Hi There I am trying to implement an editor where certain sections of the page are editable / droppable etc (i.e a mixed page where some elements are dynamic and others aren't). I am having a lot of success by using the data-gjs attributes to block this behaviour generally on the static elements however I don't seem t...

mrobertshaw

This is immensely helpful. Thank you for responding so quickly and for your fantastic, clever and well designed product which is a massive help to our product.

artf

Hi @mrobertshaw the main element is intended as the editor container and not the wrapper. You have to use this option if you need to edit the wrapper's props:

GJSBlock

Thanks for reporting this, @mrobertshaw. Great question about *. The recommended approach with GrapesJS is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on() event listener...

Browse all topics