respond icon indicating copy to clipboard operation
respond copied to clipboard

Add menu plugin to editor

Open DTX-92 opened this issue 9 years ago • 1 comments

Or editor already allows to insert menu into page?

DTX-92 avatar Sep 05 '16 10:09 DTX-92

I do not have that as part of any of the themes that I created b/c I prefer to manage the menus outside of the editor. But, you certainly can make the menu plugin available to the editor. If you use the forms as an example:

{
      action: "respond.form",
      selector: "[respond-plugin][type=form]",
      title: "Form",
      display: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="100%" width="100%"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>',
      view: '<div class="respond-plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="100%" width="100%"><path d="M0 0h24v24H0z" fill="none"/><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg><span>' + hashedit.i18n('Form') + '</span></div>',
      html: '<div respond-plugin type="form" form="contact-us"></div>',
      attributes: [
        {
          attr: 'form',
          label: 'Form',
          type: 'select',
          values: ['respond.forms']
        }
      ]
  }

You would end up with something like this:

{
      action: "respond.menu",
      selector: "[respond-plugin][type=menu]",
      title: "Menu",
      display: '<svg fill="#000000" height="100%" viewBox="0 0 24 24" width="100%" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>',
      view: '<div class="respond-plugin"><svg fill="#000000" height="100%" viewBox="0 0 24 24" width="100%" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg><span>' + hashedit.i18n('Menu') + '</span></div>',
      html: '<div respond-plugin type="menu" menu="primary"></div>',
      attributes: [
        {
          attr: 'menu',
          label: 'Menu',
          type: 'select',
          values: ['respond.menus']
        }
      ]
  }

madoublet avatar Sep 05 '16 17:09 madoublet