I'm trying to add multiple components which are in my canvas into the block manager but I believe because of an id issue they're not visible properly. What exactly does the id refer to? Here's my code:
WebEtSolutions
Hi, Your LinkedIn sign-in id is the same that your GooglePlus sign-in. The key of block must be unique. Bye
arthuralmeidap
The id is used internally to track each block individually. As @WebEtSolutions said you should put unique identifiers to each new block
How can I create dynamic components in block manager such that when a delete action is performed on a component it triggers the component to be placed in the block manager?
arthuralmeidap
Well, component and blocks are different concepts. If you are saying about blocks you can use the .trigger('remove') on the block that will remove it from the BlockManager
artf
@sakshigarg9 Read the documentation https://grapesjs.com/docsTry to understand what you're readingTry to solve your issues by yourselfIf you're not able to do it, then you can open an issue, by following its template, and SHOW US what you...
sakshigarg9
@artf thanks for all your patience, I'll do the same now onwards
Just like an image has an asset manager that can provide predefined alternatives for the image component, is it possible to implement a similar thing for buttons and text. Like providing alternative icons for the button component or alternative predefined text for the text component. For eg, in place of the "Show" but...
artf
@sakshigarg9 with custom Components you can do whatever you want. Probably just take a look at how the image component is made (its model and view)
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.
Hi, In my javascript i already create 2 components (type "A" and type "B) with their own traits. I create a context menu on both elements to switch (in the editor) the selected element from type "A" to type "B" and change the traits in consequence. I didn't found the way to change the type of an element already insert...
arthuralmeidap
Take a look here: https://grapesjs.com/docs/modules/Traits.html#add-traits-to-components It shows how to add/remove custom traits for existing types. It may help you
MisterFK
Thanks, but i don't want to change the type but i want to change the type of only one selected element... If i change the traits of component, all the others elements with this type will be changed and it's not the purpose.
artf
I didn't found the way to change the type of an element already insert in the editor. The solution will be the same in case you would like to change a <div> with an <img>... so you remove it and replace it with another component at the sam...
I have a problem in getHtml. I add an icon in the button, in the web the icon is visible, and when in the inspect element there is an icon object, but when in getHtml it uses the editor.getHtml() function, the icon disappears. Object icon result editor.getHtml() :
artf
getHtml is based on the component model data, you probably just changing its view data (eg. this.$el.append('<i class="fa ...')). Read carefully this part https://grapesjs.com/docs/modules/Components.html
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.
Hi, I am trying to build a plugin which sets up the asset manager as a SVG repository. If the user selects a SVG, the asset manager opens. Next, the user can replace the current SVG with the one selected. Most of the code I am using is found on: https://grapesjs.com/docs/modules/Assets.html#customization Demo: https:/...
noogen
Line 28, you're filtering it twice since you're already doing it on line 23? am.render(am.getAll().filter(assets)); Works when I'm doing it like so: am.render(assets);
NicoEngler
Awesome, thanks for the catch! @noogen
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.
Hi, I try to have the mouse position when i drag&drop a block. Is it possible to have the X position and Y position with this event or another ? editor.on('block:drag:stop', model => [...]); Thanks
NicoEngler
Hi, one attempt to solve this could be:Find the iframe of the canvasFind the mouse position inside the iframe To do so, you could combine functions shared on StackOverflow. The first step could be tackled with the function found right here...
MisterFK
Thanks artf, I already try to catch the onmouseup or onmousemove events on the iframe (and it's work) but when i drag&drop a block the event don't trigger (maybe because the mouse is on the block image)... There is no event grapesjs to hav...
NicoEngler
Well, first off I am not artf :) Second, set up a demo we can work on to solve your issue.
if any changes happened state/reducer then grapes js component doesn't re-rendering any help please
arthuralmeidap
Yeah, GrapesJS doesn't work like that. In this case you will need to get the reference and use the API provided by GrapesJS to handle the changes. Take a look here: https://reactjs.org/docs/refs-and-the-dom.html
ramusesan
yup, it works... great when using ref to DOM and also handles the changes using grapes js' APIs thank you @arthuralmeidap
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.