sandbox/dialog.js
function placeActionButtons(el, codemirror) {

    // search for h1's
    var positions = [];
    var lineNumber = 0;
    codemirror.eachLine(function(a) {
      if (SLIDE_REGEXP.exec(a.text)) {
         positions.push({
           pos: codemirror.heightAtLine(lineNumber)-66, // header height
           line: lineNumber
         });
      }
      ++lineNumber;
    });

    //remove previously added buttons
    el.selectAll('.actionButton').remove()

    var buttons = el.selectAll('.actionButton')
      .data(positions);

    // enter
    buttons.enter()
      .append('div')
      .attr('class', 'actionButton')
      .style({ position: 'absolute' })
      .html('add')
      .on('click', function(d, i) {
        d3.event.stopPropagation();
        var self = this;
        open(this, context.actions()).on('click', function(e) {
          context.getAction(e, function(action) {
            addAction(codemirror, d.line, action);
            context.changeSlide(i);
          });
          close(self);
        });
      });

    el.on('click.actionbutton', function() {
      //close popup
      close();
    })

    // update
    var LINE_HEIGHT = 38;
    buttons.style({
      top: function(d) { return (d.pos - LINE_HEIGHT) + "px"; },
      left: 16 + "px"
    });

  }
function placeActionButtons(el, codemirror) {

    // search for h1's
    var positions = [];
    var lineNumber = 0;
    codemirror.eachLine(function(a) {
      if (SLIDE_REGEXP.exec(a.text)) {
         positions.push({
           pos: codemirror.heightAtLine(lineNumber)-66, // header height
           line: lineNumber
         });
      }
      ++lineNumber;
    });

    //remove previously added buttons
    el.selectAll('.actionButton').remove()

    var buttons = el.selectAll('.actionButton')
      .data(positions);

    // enter
    buttons.enter()
      .append('div')
      .attr('class', 'actionButton')
      .style({ position: 'absolute' })
      .html('add')
      .on('click', function(d, i) {
        d3.event.stopPropagation();
        var self = this;
        open(this, context.actions()).on('click', function(e) {
          context.getAction(e, function(action) {
            addAction(codemirror, d.line, action);
            context.changeSlide(i);
          });
          close(self);
        });
      });

    el.on('click.actionbutton', function() {
      //close popup
      close();
    })

    // update
    var LINE_HEIGHT = 38;
    buttons.style({
      top: function(d) { return (d.pos - LINE_HEIGHT) + "px"; },
      left: 16 + "px"
    });

  }
function placeActionButtons ( el , codemirror ) { // search for h1's var positions = [ ] ; var lineNumber = 0 ; codemirror . eachLine ( function ( a ) { if ( SLIDE_REGEXP . exec ( a . text ) ) { positions . push ( { pos : codemirror . heightAtLine ( lineNumber ) - 66 , // header height line : lineNumber } ) ; } ++ lineNumber ; } ) ; //remove previously added buttons el . selectAll ( '.actionButton' ) . remove ( ) var buttons = el . selectAll ( '.actionButton' ) . data ( positions ) ; // enter buttons . enter ( ) . append ( 'div' ) . attr ( 'class' , 'actionButton' ) . style ( { position : 'absolute' } ) . html ( 'add' ) . on ( 'click' , function ( d , i ) { d3 . event . stopPropagation ( ) ; var self = this ; open ( this , context . actions ( ) ) . on ( 'click' , function ( e ) { context . getAction ( e , function ( action ) { addAction ( codemirror , d . line , action ) ; context . changeSlide ( i ) ; } ) ; close ( self ) ; } ) ; } ) ; el . on ( 'click.actionbutton' , function ( ) { //close popup close ( ) ; } ) // update var LINE_HEIGHT = 38 ; buttons . style ( { top : function ( d ) { return ( d . pos - LINE_HEIGHT ) + "px" ; } , left : 16 + "px" } ) ; }
place actions buttons on the left of the beggining of each slide
place actions buttons on the left of the beggining of each slide