mjml icon indicating copy to clipboard operation
mjml copied to clipboard

Question: How to add the custom action(variable)

Open TechWhiz10 opened this issue 1 year ago • 3 comments

Hi, @Artur Arseniev. Grapesjs is very awesome. just like WordPress or Bubble.

I made a function using https://github.com/GrapesJS/grapesjs/issues/481. editor.RichTextEditor.add('custom-vars', { icon: <select class="gjs-field"> <option value="">- Select -</option> <option value="[[firstname]]">FirstName</option> <option value="[[lastname]]">LastName</option> <option value="[[age]]">Age</option> </select>, // Bind the 'result' on 'change' listener event: 'change', result: (rte, action) => rte.insertHTML(action.btn.firstChild.value), // Reset the select on change update: (rte, action) => { action.btn.firstChild.value = "";} })

It works well in grapesjs-plugins-newsletter. but it doesn't work in grapesjs-mjml. Sometimes it works.

![Uploading image.png…] error ()

I don't know why it doesn't work. How can I resolve this problem?

TechWhiz10 avatar Oct 05 '23 03:10 TechWhiz10

Hi have the exact same issue for the exact same need!

LcsGa avatar Nov 15 '23 12:11 LcsGa

Did you find a solution @TechWhiz10?

LcsGa avatar Nov 15 '23 12:11 LcsGa

@LcsGa not yet

TechWhiz10 avatar Nov 19 '23 13:11 TechWhiz10

Tried it on the current demo and it seems to work as expected. If you still face the issue please open a proper bug report with reproducible steps and demo.

artf avatar Aug 23 '24 11:08 artf