New Trait creation. The value is not set?
See original GitHub issueI am trying to create a new Trait for a component. The textarea appears but it is not saving when trying to edit back, and the object has no “content” attribute. Why? I am basically using the code from here: https://github.com/artf/grapesjs/wiki/Traits#define-new-trait-type
// Each new type extends the default Trait
editor.TraitManager.addType('content', {
events:{
'keyup': 'onChange', // trigger parent onChange method on keyup
},
/**
* Returns the input element
* @return {HTMLElement}
*/
getInputEl: function() {
var selectedModel = this.target;
var input = document.createElement('textarea');
input.value = selectedModel.get('content');
return input;
},
/**
* Triggered when the value of the model is changed
*/
onValueChange: function () {
this.target.set('content', this.model.get('value'));
}
});
Thank you!
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Defining Traits: Initialization and Validation
method : The default value is created by calling a method on the object the trait is bound to; the default attribute returns...
Read more >How to fix value is not a member of specific trait with instance ...
The problem is that observer is of type Observer which doesn't have any method updated defined, thus it fails. You may refine the...
Read more >Error while creating new trait from Signals Dashboard
Description. While creating a new traits from signals present in Signals Dashboard, I am getting below error: Signal that I am trying to...
Read more >SQL Traits | Segment Documentation
From the Audiences viewer, go to the Computed Traits tab, and click New Computed Trait. Next, choose SQL, and click Configure.
Read more >Trait Types — traitlets 5.8.0 documentation
Create a List trait type from a list, set, or tuple. The default value is created by doing list(default_value) , which creates a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
done
Thank you, @artf ! It works now.