scripts/app.js
// Function to create the entries in the popupmenu
Function to create the entries in the popupmenu
Function to create the entries in the popupmenu
function createPopupMenu(editor, graph, menu, cell, evt) {
    if (cell != null) {
        var cellName;
        var parent;
        if (graph.model.isEdge(cell)) {
            cellName = 'Relationship';
            parent = cell.parent;
        } else if (graph.isHtmlLabel(cell)) {
            cellName = 'Column';
            parent = cell.parent;
        } else {
            cellName = 'Table';
            parent = cell;
        }
        if (!graph.model.isEdge(cell)) {
            menu.addItem('Add Column', 'images/add.svg', function() {
                var column = Column.prototype.newCell();
                Table.prototype.create(graph, evt, parent, column, null);
            });
        }
        if (graph.isHtmlLabel(cell)) {
            menu.addItem('Edit Column', 'images/edit.svg', function() {
                editor.execute('properties', cell);
            });
        }
        menu.addSeparator();
        menu.addItem('Delete ' + cellName, 'images/trash.svg', function() {
            editor.execute('delete', cell);
        });
    }
}
function createPopupMenu ( editor , graph , menu , cell , evt ) { if ( cell != null ) { var cellName ; var parent ; if ( graph . model . isEdge ( cell ) ) { cellName = 'Relationship' ; parent = cell . parent ; } else if ( graph . isHtmlLabel ( cell ) ) { cellName = 'Column' ; parent = cell . parent ; } else { cellName = 'Table' ; parent = cell ; } if ( ! graph . model . isEdge ( cell ) ) { menu . addItem ( 'Add Column' , 'images/add.svg' , function ( ) { var column = Column . prototype . newCell ( ) ; Table . prototype . create ( graph , evt , parent , column , null ) ; } ) ; } if ( graph . isHtmlLabel ( cell ) ) { menu . addItem ( 'Edit Column' , 'images/edit.svg' , function ( ) { editor . execute ( 'properties' , cell ) ; } ) ; } menu . addSeparator ( ) ; menu . addItem ( 'Delete ' + cellName , 'images/trash.svg' , function ( ) { editor . execute ( 'delete' , cell ) ; } ) ; } }
Function to create the entries in the popupmenu
Function to create the entries in the popupmenu
/*
    menu.addItem('Undo', 'images/undo.png', function() {
        editor.execute('undo', cell);
    });

    menu.addItem('Redo', 'images/redo.png', function() {
        editor.execute('redo', cell);
    });

    menu.addSeparator();

    menu.addItem('Show SQL', 'images/export1.png', function() {
        editor.execute('showSql', cell);
    });
    */