How to add a click event
Question
This is my custom block code:
{
id: 'link',
label: "Link",
content:`<mj-wrapper padding="0px">
<mj-section border="1px dashed #e0e4e8" background-color="#f9fafb" padding="0px">
<mj-column padding-top="0px" vertical-align="middle" width="78%">
<mj-text>https://</mj-text>
</mj-column>
<mj-column padding="0px" vertical-align="middle" width="20%" padding-right="50px">
<mj-button padding="0px" width="100%" > Add link</mj-button>
</mj-column>
</mj-section>
</mj-wrapper>`,
attributes:{class:'fa fa-link'},
}
I want to add a click event to the button after adding it to the canvas, and when I click it, I can get the content in the mj-text
Answers (2)
Related Questions and Answers
Continue research with similar issue discussions.
Issue #2177
How to create a block with HTML and CSS and javascript content.
Can somebody please show me a code example of how to create a block with javascript and css styles. The main problem is that the js code is...
Issue #2973
make not removable elements inside a block
Hello, Given: editor.BlockManager.add('test-component', { id: 'MappaPiuDescrizione', label: 'Mappa + Descrizione', content: <div data-block...
Issue #2961
BUG: Components in custom modal isn't editable
Hello, I'm trying to add custom modal block to my project and I want to change content of this modal also with drag&drop. Here's code of my...
Issue #1471
[Question] Blockmanager and Image
Hi! I use this code to add a new block: blockManager.add("image", { label: 'Image', category: 'Basic', attributes: { class: "gjs-fonts gjs-...
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.