Default model names not persisting to local storage
Question
When I create a new Dom Component, I give it a name in the "defaults" section, like:
domComponents.addType(''ugly-type-name', {
model: {
defaults: {
tagName: 'component',
name: 'Foo Bar', <-----
attributes: {
'component-id': component.id
},
traits: [{}
]
}
},
When the component is dragged on to the canvas, the Foo Bar string shows up as a badge like it should, and the text appears in the Layers panel and everything is good. But when the canvas is persisted to storage, and I refresh the page, the badge now shows the ugly-type-name, and it appears in the layers as well.
What am I doing wrong?
Answers (2)
@andrewryan1906 please define your component type inside a plugin. cheers!
That works, thanks!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3228
Component Value is not changing
Hi @artf I've added a new component here is the code on selecting the h1 and h2 tag it's changing the value in the HTML section as you can...
Issue #2614
[QUESTION] Recursive view update of custom component
Hi, I have defined a custom type like: I want to keep the customTag in my model and show the content (HTML) in the view. However, in the co...
Issue #2696
[QUESTION]: How can I create block with background image with behavior like built-in "image"?
Hello, I'm trying to create block with background image (similar to Grapedrop Image Box). I added new component like this: And also I added...
Issue #2549
[QUESTION] Update component view on property change
Hi everyone, I'm trying to create a component that will update it's view based on a property value My approach is bassed on #1227 and on th...
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.