Issue #2317Opened October 8, 2019by suchiitsme0 reactions

Need a feature to integrate modal form

Question

[FEATURE REQUESTS] I have to add block which should a open a modal with form fields. Based on the form data selected I have to generate a html string and insert it to editor. and on click /double click of the component, modal should open again with the form details. How can I do this? Please help.

Answers (3)

jcarizzaOctober 11, 20190 reactions

Hello @suchiitsme i think you can implement a component type.

comps.addType('custom-form', {
      model: defaultModel.extend({
        defaults: {
          ...defaultModel.prototype.defaults,
          removable: false,
          draggable: false,
          copyable: false,
          editable: true,
          propagate: ["removable", "draggable", "copyable", "editable"]}
      }, {
        isComponent: function(el){
          result = "";
          if (el.tagName === "form" && el.getAttribute("class").toString().indexOf("customForm") > -1) {
            result = {type: "custom-form"}
          }
          return result
        }
      }),
      view: defaultView.extend({
        defaults: {...defaultView.prototype.defaults},
        events: {
          click: function(event) {
              alert("Do anything")
            }
          }
        }
      }),
    });
suchiitsmeOctober 15, 20190 reactions

Hello @suchiitsme i think you can implement a component type.

comps.addType('custom-form', {
      model: defaultModel.extend({
        defaults: {
          ...defaultModel.prototype.defaults,
          removable: false,
          draggable: false,
          copyable: false,
          editable: true,
          propagate: ["removable", "draggable", "copyable", "editable"]}
      }, {
        isComponent: function(el){
          result = "";
          if (el.tagName === "form" && el.getAttribute("class").toString().indexOf("customForm") > -1) {
            result = {type: "custom-form"}
          }
          return result
        }
      }),
      view: defaultView.extend({
        defaults: {...defaultView.prototype.defaults},
        events: {
          click: function(event) {
              alert("Do anything")
            }
          }
        }
      }),
    });

Thank you. I will give a try!!

suchiitsmeOctober 16, 20190 reactions

Hi How do I link this to block?

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.