The facebook plugin is not working in the grapes js
Question
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Chrome v9
Reproducible demo link
Not there
Describe the bug
How to reproduce the bug?
- Install the Grapes js in react app and run it
- Make the facebook plugin components and import it in grapes js ( get the facebook page listing code from https://developers.facebook.com/docs/plugins/page-plugin/)
- Run the application
- Drag and drop the facebook component in editor
What is the expected behavior? After dropping the facebook component it should display the facebook page in editor
What is the current behavior? After dropping the facebook component , it is not displaying the facebook page But after the tab reload the facebook page is displayed in the editor
If is necessary to execute some code in order to reproduce the bug, paste it here below:
//Editor Code
const editor = grapesjs.init({
container: "#builder",
plugins: [
],
pluginsOpts: {
"custom-gjs-basic-plugin": {
id: self.state.id,
},
},
fromElement: 1,
allowScripts: 1,
avoidInlineStyle: 0,
protectedCss: ``,
cssIcons: null,
canvas: {
styles: [builderCSS],
scripts: [],
},
canvasCss: `.gjs-selected {outline: 2px solid #ff1430 !important;outline-offset: -2px !important;}.gjs-hovered{}`,
storageManager: {
id: "gjs_",
type: "remote",
urlStore: this.API_URL + "update_builder/" + this.state.id,
urlLoad: this.API_URL + this.state.id,
params: {draft: "1",},
headers: { Authorization: localStorage.getItem("token")},
},
assetManager: {
storageType: "",
storeOnChange: true,
storeAfterUpload: true,
upload: process.env.REACT_APP_ASSET_PATH, //for temporary storage
assets: [],
uploadName: "file",
uploadFile: function (e) {
var files = e.dataTransfer ? e.dataTransfer.files : e.target.files;
var formData = new FormData();
for (var i in files) {
formData.append("upload", files[i]);
}
PageService.contentUpload(formData)
.then((response) => {
var imageUpload = response.data.path.replace(/[//:-]/g, "");
var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.jpe?g|png|gif|bmp)$/;
if (regex.test(imageUpload.toLowerCase())) {
editor.AssetManager.add(response.data.path);
} else {
alert("Please upload valid images.");
}
})
.catch((error) => {
alert("Please upload valid images.");
});
},
},
pageManager: true,
layerManager: {
appendTo: ".layers-container",
},
traitManager: {
appendTo: ".traits-container",
},
selectorManager: {
appendTo: ".selectors-container",
componentFirst: true,
},
styleManager: {
appendTo: ".styles-container",
clearProperties: 1,
},
})
// Facebook component
editor.setComponents(`<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v13.0" nonce="aZMwnOeb"></script>
<div class="fb-page" style="width:100%" data-href="https://www.facebook.com/facebook" data-tabs="" data-width=""
data-height="" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true">
<blockquote cite="https://www.facebook.com/facebook" class="fb-xfbml-parse-ignore">
<a href="https://www.facebook.com/facebook">Meta</a></blockquote></div>`)
Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (4)
@artf Please help me on this
I see no issue when I run editor.setComponents(...FB HTML..)

Please provide a reproducible demo.
@artf Thanks for the reply but you have added editor.setComponents(...FB HTML..) by default and then loaded the editor
Please create a component of FB HTML and Drag& drop the component in editor , it wont load
This way i have tried
const blockManager = editor.BlockManager;
blockManager.add('facebook-block', {
label: 'Facebook',
category: "Basic",
content: '<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v13.0" nonce="aZMwnOeb"></script>
<div class="fb-page" style="width:100%" data-href="https://www.facebook.com/facebook" data-tabs="" data-width=""
data-height="" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true">
<blockquote cite="https://www.facebook.com/facebook" class="fb-xfbml-parse-ignore">
<a href="https://www.facebook.com/facebook">Meta</a></blockquote></div>',
});
Thanks for reporting this, @Sudhin35.
Great suggestion about BUG : The facebook plugin is not working in the grapes js! While this specific feature isn't yet in the core API, there are several ways to achieve similar behavior.
Using the event system:
editor.on('component:update', (component) => {
// your logic here
});
Alternative approaches:
- Listen to
selector:addfor CSS selector changes - Use
selector:customfor custom rules - Tap into the
change:*events for fine-grained tracking - Build a plugin that extends the editor with this capability
Making it official: If this feature would benefit many users, consider opening a formal Feature Request on the GrapesJS repo with:
- A detailed use case
- Code example showing the desired behavior
- Why this matters for your workflow
The core team is receptive to well-motivated feature requests backed by real use cases.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3878
Not able to rename the page name and page id if we are using multipage concept
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Chrome v9Reproducible demo link Not thereDes...
Issue #3832
The css classes are removed and the autogenerated ids for each html tags gets changed ( Example : ivj5m-2) after each reload
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link Not there De...
Issue #4503
Missing inline styles used by CKEditor when adding raw html components
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chromium v96 Reproducible demo link https:...
Issue #5718
Possible upgrade path issue where 'textnode' is now called 'wrapper' from 0.18 -> latest
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Version 122.0.6261.95 (Official Bui...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.