[BUG] Custom compoent and JS
Question
Hi @artf ,
I'm trying to create a custom component and attach a JS to it. To give you a better example, think this component as a Slideshow component. For this component, I have some custom traits to allow the user to change some pre-defined configurations.
The problem is happening when I attach the Js through the script key while I'm adding the block.
The isComponent method is not being called for my new custom component.
Debugging the code, I discovered when the components are being parsed, there is a validation to check if the content is a string or an array. When we have an attached Js to the component, the content will be an object.
Checkout PR #1866 and let me know your thoughts
Answers (2)
The problem is happening when I attach the Js through the script key while I'm adding the block. The isComponent method is not being called for my new custom component.
Hi Arthur, can you provide some code example of your case because I can't really get what is the issue.
By looking at your PR, I don't understand why are you trying to parse the content property, which is used by the editor for static content (eg. as a content to be edit by RTE) and so it shouldn't be parsed
editor.addComponents({
type: 'text',
content: `<i>Some</i> <b>static content</b> for RTE`,
});
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.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1626
[Bug] Wrong Placeholder marker when inserting in column flexbox component
Hello artf, I have a Problem with the Insertion Placeholder Marker. When you insert a component in a Flexbox-Parent it is always vertical (...
Issue #1679
How to render component in canvas using trait.
Hi Artf ,Thanks for your great tool,I have created test case for my problem https://js.do/code/271771 I have created custom tool sidebar an...
Issue #873
[Need help]: After using urlLoad from storage manager impossible to change component with Traits
Hello, I am save template to db and after loading from db impossible to change component with Traits. Video example on countdown: https://y...
Issue #1030
[Question] Firing events with custom components
I'm trying to build a plugin for Grapesjs with some custom components, and I'm having trouble with triggering events and interacting with t...
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.