Adding new components to Block Manager
Question
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:
const bm = editor.BlockManager;
bm.add("social-sign-in-butttons-section", {
label: "Facebook sign-in",
content:
'<div class="pull-left social-sign-in-button padding-right-small" data-gjs-droppable=".fa .fa-facebook-square">' +
'<img data-gjs-draggable=".social-sign-in-button" src="facebook.png" id="facebook" title="facebook" class="fa fa-facebook-square fa-3x ">' +
"</img>" +
"</div>",
attributes: {
class: "fa fa-facebook"
}
});
bm.add("the-row-block", {
label: "GooglePlus sign-in",
content:
'<div class="pull-left social-sign-in-button padding-right-small">' +
'<img src="google.png" id="googleplus" title="googleplus" class="fa fa-google-plus-square fa-3x ">' +
"</img>" +
"</div>",
attributes: {
class: "fa fa-google-plus-square"
}
});
bm.add("the-row-block", {
label: "LinkedIn sign-in",
content:
'<div class="pull-left social-sign-in-button padding-right-small">' +
'<img src="linkedin.png" id="linkedin" title="linkedin" class="fa fa-linkedin-square fa-3x">' +
"</img>" +
"</div>",
attributes: {
class: "fa fa-linkedin-square"
}
});
Answers (3)
Hi,
Your LinkedIn sign-in id is the same that your GooglePlus sign-in. The key of block must be unique.
Bye
The id is used internally to track each block individually. As @WebEtSolutions said you should put unique identifiers to each new block
OHH alright, worked, thanks!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1290
[BUG]Set href for link block not editable once initialized
#1277 is closed but issue still exist so i have to post as new issue Thank you for the help for earlier @maryia-kabash @artf I have made a...
Issue #792
Script property using function don't work with blocks
In Components & JS docs there's this example: This works perfectly. But I couldn't use a function instead of a string in script, as is said...
Issue #1831
[Question] How to run command for a block component?
I'd like to do something like this. so once a user drops the test component into the canvas, I'd like to open up asset manager modal where...
Issue #1817
Change HTML content while block is render in editor
Hello @artf I have one block into block manager like As per above script inside the block, i want to add dynamic HTML content while this bl...
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.