Render New Html to editor with Action of Traits
Question
I create New custom Tool with (default html) when draged , and i also create traits for this component when i click on checkbox excuting function (do stuff())>> the result of this function new html i want to append it to editor , i have used to select by class ( in jquery ) from editor( the default html to append to it ) but not work , how can i render new html to editor on action , and how can to select some html by class or id to append to it some new htmldata
=============
I create my new custom tool by:
this.editor.BlockManager.add('sidebar', {
id: 'sidebar',
label: 'SideBar',
attributes: {class:'fa fa-bullhorn'},
content: {
style: {color: 'black'},
type: 'sidebar',
}
});
=============
and this to add default render html and traits and excuting some functions on listen to checkbox :
i want to apppent newDom html var to the editor on action
comps.addType('sidebar', {
model: defaultModel.extend({
init() {
this.listenTo(this, 'change:business', this.doStuff);
this.listenTo(this, 'change:confrences', this.doStuff);
this.listenTo(this, 'change:Nuclear', this.doStuff);
},
doStuff() {
// some java script method
//the result new html
},
defaults: Object.assign({}, defaultModel.prototype.defaults, {
traits: [
'Title',
// this.catogrylist ,
{
type: 'checkbox',
label:'business',
name:'business',
changeProp: 1,
},
{
type: 'checkbox',
label:'confrences',
name:'confrences',
changeProp: 1,
},
{
type: 'checkbox',
label:'Nuclear',
name:'Nuclear',
changeProp: 1,
},
],
}),
}, {
isComponent: function(el) {
if(el.tagName == 'div'){
return {type: 'sidebar'};
}
},
}),
view: defaultView.extend({
tagName: 'div',
render: function () {
this.el.innerHTML = ` <div class="categories" style="width:15%;height: 100%;background-color: #4b5257"></div>
`;
return this;
},
}),
});Answers (2)
@alialrabi Read this before opening an issue on Github https://guides.github.com/features/mastering-markdown/ Thanks
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 #1665
Jquery selector in traits Actions
I have created a custom component and and select to its traits, this select cotains multiple URLs. in doStuff() method i've displayed the s...
Issue #1681
adding new custom trait to Video Component
In video Component i need to add new custom traits beside the existing ones, when i do this all traits are disappeared
Issue #1895
[QUESTION] Drag component over canvas with script, script appended multiple times.
Hi, not sure if this is a bug or not. But I noticed a weird behavior, when I drag a block that has a component that contains a script funct...
Issue #1862
Reflect deleted components in block manager
How can I create dynamic components in block manager such that when a delete action is performed on a component it triggers the component 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.