[Question] Edit innerHTML in a custom button
Question
Hi All,
I am trying to change the text in a button component, but I am not able to edit it. I added this type:
comps.addType('button', {
// Define the Model
model: defaultModel.extend({
// Extend default properties
defaults: Object.assign({}, defaultModel.prototype.defaults, {
style: {
width: '130px',
height: '50px',
},
// Can't drop other elements inside it
droppable: false,
resizable: true,
editable: true,
}),
},
I included the editable: true parameter but is not working And add the button to the Component Manager
editor.BlockManager.add('button', {
label: 'Button',
attributes: { class:'gjs-fonts gjs-f-b1'},
category: 'Basic',
content: '<button type="button">Click Me!</button>'
})
Is there any way to workaround this? Thanks!
Answers (3)
@trafalmejo Try looking at the way they implement the link component, I think it might help you, not 100% sure though.
You should extend the text component
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 #738
image reverted to original size after resized
hi, i got a strange issue with component: i got 2 types, image and icon the issue is when i first drag and drop the image component, i'm ab...
Issue #1962
[QUESTION] any other way to listen the traits option changes
HI, I added the code of listening to the changes made when the user selects the values in the dropdown. but I need to listen to the changes...
Issue #852
[QUESTION] How to change <a> content in traits?
I'm re-declaring a link type like this: When my button (<a>) is created, it is creating like this: <a class="btn botao-roxo">Botão</a> I wo...
Issue #1891
Can't create new button component
I'm having a hard time creating a new component for a <button> element. What am I missing? Is something bugged out here? Works fine if I ch...
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.