Issue #1959Opened April 10, 2019by trafalmejo0 reactions

[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)

simplecommerceApril 10, 20190 reactions

@trafalmejo Try looking at the way they implement the link component, I think it might help you, not 100% sure though.

artfApril 11, 20190 reactions

You should extend the text component

lock[bot]April 15, 20200 reactions

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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.