Closed mustahsanmustafa closed 4 years ago
UPDATE:
If i just extend my custom components from textnode instead of default, then the issue gets resolved somehow:
export const NavbarMenu = editor => {
var defaultType = editor.DomComponents.getType("textnode"); //<-- changed to textnode
var defaultModel = defaultType.model;
editor.DomComponents.addType('menu-nav', {
isComponent: el => el.tagName === 'menu-nav',
model: defaultModel.extend({
......
but it will be better if the issue is resolved at default as well. cheers
You're mixing the old API with the new one for the custom component definition.
With model: defaultModel.extend({
was required an inner static isComponent
(you're using one outside, like in the new API) and without it, you're breaking the Component Type Stack
You should just change model: defaultModel.extend({...})
to model: {...}
but in your case, I'd also suggest reading carefully
https://grapesjs.com/docs/modules/Components.html
Hi artf,
After creating custom components, the text component does not behave like before. It removes all the naked nodes after changing some code in import modal. e.g
After editing something in import modal it gets change to:
As you can see it removed the Naked text node i.e Insert your text. It should be noted that this behavior doesnt happen when there is no custom component added to the editor.
An example of custom component that i created: