Creating BLOCKs with settings like Style Manager
Question
Hello! I would like to know if you can create BLOCKs with options such like style manager, i. e. not drag, showing options in the same sidebar.
Thanks
Answers (3)
Hi @chiqui3d you can create blocks with an object as a content with all available properties
blockManager.add('my-block', {
label: 'Simple block',
content: {
// Component properties
removable: false,
draggable: false,
...
}
})
@artf I don't want it to be draggable and I don't want to drag it into the canvas. I just want to click on the Link Replace block button, this show an input to put URL and a submit button (these options as Style Manager does, which shows the options inside the panel).
Ok, this is has nothing to do with Blocks then For your case, I'd suggest adding a new button with a custom command which just opens a Modal with your stuff and executes your logic
Hello @artf , Nothing happens, I mean that I have created a block, and clicking doesn't do anything, componets is not the attribute to display the html?
here my code:
bm.add('link-replace', {
name: 'link-replace',
category: 'Extra',
label: 'Link Replace',
content: {
removable: false,
draggable: false,
droppable: false,
script: "console.log('the element', this)",
components: "<h2>Test Block</h2>",
content: "<h2>Test Block</h2>",
traits: [{
label: 'Link Replace',
name: 'link-eplace',
changeProp: 1,
}],
style: {
width: '100px',
height: '100px'
}
},
attributes: {
title: 'Link Replace',
class: 'fa fa-external-link'
}
});
The only thing I want to do, is to show an input URL type, for replace all links of canvas. or is there another better way for this?
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1709
[QUESTION] Is it possible to affect child component's styling through parent component's style manager?
Hello there! Awesome project and thanks for your contribution. I would like to know if it is possible to change the styling of a child comp...
Issue #1748
How to prevent drag items inside the editor
Hello @artf You are doing great job with grapesjs and it's extremely helpful to make our functionality more user friendly. Thanks for creat...
Issue #2097
New views question
Hello all, Is there is any simple way to add a new view right next to the style manager? I would like to create a new view that will show s...
Issue #1639
[Question]: Would it be possible to have change settings under style manager in a way that it has href when a link is created?
I'm using preset newsletter with built-in RTE (do not want to use ck editor like the demo) In order to make any text to link, i need to cli...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.