dist/hashedit.js
function(block) {

      var x, dialog, list, html, el, target, i, items;

      if(block !== null) {
        block.setAttribute('hashedit-block-active', '');
      }

      // show the layout dialog
      dialog = document.querySelector('#hashedit-layout-modal');

      // get list
      list = document.querySelector('#hashedit-layouts-list');

      items = list.querySelectorAll('.hashedit-list-item');

      // init items
      if(items.length === 0) {

        for(x=0; x<hashedit.grid.length; x++) {
           el = document.createElement('DIV');
           el.setAttribute('class', 'hashedit-list-item');
           el.setAttribute('data-index', x);
           el.innerHTML = '<h2>' + hashedit.grid[x].name + '</h2><small>' + hashedit.grid[x].desc + '</small>';

           list.appendChild(el);
        }

        list.addEventListener('click', function(e) {

          target = e.target;

          if(target.nodeName.toUpperCase() !== 'DIV'){
            target = hashedit.findParentBySelector(target, '.hashedit-list-item');
          }

          if(target != null) {

            // append the block
            i = target.getAttribute('data-index');
            html = hashedit.grid[i].html;

            hashedit.appendBlock(html, block, 'before');

            hashedit.setupBlocks();

            dialog.removeAttribute('visible');

          }

        });

      }

      dialog.setAttribute('visible', '');

    }
function(block) {

      var x, dialog, list, html, el, target, i, items;

      if(block !== null) {
        block.setAttribute('hashedit-block-active', '');
      }

      // show the layout dialog
      dialog = document.querySelector('#hashedit-layout-modal');

      // get list
      list = document.querySelector('#hashedit-layouts-list');

      items = list.querySelectorAll('.hashedit-list-item');

      // init items
      if(items.length === 0) {

        for(x=0; x<hashedit.grid.length; x++) {
           el = document.createElement('DIV');
           el.setAttribute('class', 'hashedit-list-item');
           el.setAttribute('data-index', x);
           el.innerHTML = '<h2>' + hashedit.grid[x].name + '</h2><small>' + hashedit.grid[x].desc + '</small>';

           list.appendChild(el);
        }

        list.addEventListener('click', function(e) {

          target = e.target;

          if(target.nodeName.toUpperCase() !== 'DIV'){
            target = hashedit.findParentBySelector(target, '.hashedit-list-item');
          }

          if(target != null) {

            // append the block
            i = target.getAttribute('data-index');
            html = hashedit.grid[i].html;

            hashedit.appendBlock(html, block, 'before');

            hashedit.setupBlocks();

            dialog.removeAttribute('visible');

          }

        });

      }

      dialog.setAttribute('visible', '');

    }
function ( block ) { var x , dialog , list , html , el , target , i , items ; if ( block !== null ) { block . setAttribute ( 'hashedit-block-active' , '' ) ; } // show the layout dialog dialog = document . querySelector ( '#hashedit-layout-modal' ) ; // get list list = document . querySelector ( '#hashedit-layouts-list' ) ; items = list . querySelectorAll ( '.hashedit-list-item' ) ; // init items if ( items . length === 0 ) { for ( x = 0 ; x < hashedit . grid . length ; x ++ ) { el = document . createElement ( 'DIV' ) ; el . setAttribute ( 'class' , 'hashedit-list-item' ) ; el . setAttribute ( 'data-index' , x ) ; el . innerHTML = '<h2>' + hashedit . grid [ x ] . name + '</h2><small>' + hashedit . grid [ x ] . desc + '</small>' ; list . appendChild ( el ) ; } list . addEventListener ( 'click' , function ( e ) { target = e . target ; if ( target . nodeName . toUpperCase ( ) !== 'DIV' ) { target = hashedit . findParentBySelector ( target , '.hashedit-list-item' ) ; } if ( target != null ) { // append the block i = target . getAttribute ( 'data-index' ) ; html = hashedit . grid [ i ] . html ; hashedit . appendBlock ( html , block , 'before' ) ; hashedit . setupBlocks ( ) ; dialog . removeAttribute ( 'visible' ) ; } } ) ; } dialog . setAttribute ( 'visible' , '' ) ; }
Sets up the layout dialog
Sets up the layout dialog