<commit_before><link rel="import" href="../the-graph/the-graph.html">

<polymer-element name="the-graph-editor" attributes="grid snap width height autolayout theme selectedNodes errorNodes selectedEdges animatedEdges onContextMenu displaySelectionGroup forceSelection" touch-action="none">
  <template>
    <the-graph id="graph"
      name="{{ graph.properties.name }}"
      graph="{{nofloGraph}}"
      menus="{{menus}}"
      width="{{width}}" height="{{height}}"
      pan="{{pan}}" scale="{{scale}}"
      autolayout="{{autolayout}}"
      theme="{{theme}}"
      selectedNodes="{{selectedNodes}}"
      errorNodes="{{errorNodes}}"
      selectedEdges="{{selectedEdges}}"
      animatedEdges="{{animatedEdges}}"
      displaySelectionGroup="{{displaySelectionGroup}}"
      forceSelection="{{forceSelection}}"
      getMenuDef="{{getMenuDef}}">
    </the-graph>
  </template>
  <script>
  (function () {
    "use strict";

    Polymer('the-graph-editor', {
      graph: null,
      grid: 72,
      snap: 36,
      width: 800,
      height: 600,
      scale: 1,
      plugins: {},
      nofloGraph: null,
      menus: null,
      autolayout: false,
      theme: "dark",
      selectedNodes: [],
      copyNodes: [],
      errorNodes: {},
      selectedEdges: [],
      animatedEdges: [],
      displaySelectionGroup: true,
      forceSelection: false,
      created: function () {
        this.pan = [0,0];
        var pasteAction = function (graph, itemKey, item) {
          var pasted = TheGraph.Clipboard.paste(graph);
          this.selectedNodes = pasted.nodes;
          this.selectedEdges = [];
        }.bind(this);
        var pasteMenu = {
          icon: "paste",
          iconLabel: "paste",
          action: pasteAction
        };
        // Default context menu defs
        this.menus = {
          main: {
            icon: "sitemap",
            e4: pasteMenu
          },
          edge: {
            icon: "long-arrow-right",
            s4: {
              icon: "trash-o",
              iconLabel: "delete",
              action: function (graph, itemKey, item) {
                graph.removeEdge(item.from.node, item.from.port, item.to.node, item.to.port);
                // Remove selection
                var newSelection = [];
                for (var i=0, len=this.selectedEdges.length; i<len; i++){
                  var selected = this.selectedEdges[i];
                  if (selected !== item) {
                    newSelection.push(selected);
                  }
                }
                this.selectedEdges = newSelection;
              }.bind(this)
            }
          },
          node: {
            s4: {<commit_msg>Include the option config node<commit_after><link rel="import" href="../the-graph/the-graph.html">

<polymer-element name="the-graph-editor" attributes="grid snap width height autolayout theme selectedNodes errorNodes selectedEdges animatedEdges onContextMenu displaySelectionGroup forceSelection" touch-action="none">
  <template>
    <the-graph id="graph"
      name="{{ graph.properties.name }}"
      graph="{{nofloGraph}}"
      menus="{{menus}}"
      width="{{width}}" height="{{height}}"
      pan="{{pan}}" scale="{{scale}}"
      autolayout="{{autolayout}}"
      theme="{{theme}}"
      selectedNodes="{{selectedNodes}}"
      errorNodes="{{errorNodes}}"
      selectedEdges="{{selectedEdges}}"
      animatedEdges="{{animatedEdges}}"
      displaySelectionGroup="{{displaySelectionGroup}}"
      forceSelection="{{forceSelection}}"
      getMenuDef="{{getMenuDef}}">
    </the-graph>
  </template>
  <script>
  (function () {
    "use strict";

    Polymer('the-graph-editor', {
      graph: null,
      grid: 72,
      snap: 36,
      width: 800,
      height: 600,
      scale: 1,
      plugins: {},
      nofloGraph: null,
      menus: null,
      autolayout: false,
      theme: "dark",
      selectedNodes: [],
      copyNodes: [],
      errorNodes: {},
      selectedEdges: [],
      animatedEdges: [],
      displaySelectionGroup: true,
      forceSelection: false,
      created: function () {
        this.pan = [0,0];
        var pasteAction = function (graph, itemKey, item) {
          var pasted = TheGraph.Clipboard.paste(graph);
          this.selectedNodes = pasted.nodes;
          this.selectedEdges = [];
        }.bind(this);
        var pasteMenu = {
          icon: "paste",
          iconLabel: "paste",
          action: pasteAction
        };
        // Default context menu defs
        this.menus = {
          main: {
            icon: "sitemap",
            e4: pasteMenu
          },
          edge: {
            icon: "long-arrow-right",
            s4: {
              icon: "trash-o",
              iconLabel: "delete",
              action: function (graph, itemKey, item) {
                graph.removeEdge(item.from.node, item.from.port, item.to.node, item.to.port);
                // Remove selection
                var newSelection = [];
                for (var i=0, len=this.selectedEdges.length; i<len; i++){
                  var selected = this.selectedEdges[i];
                  if (selected !== item) {
                    newSelection.push(selected);
                  }
                }
                this.selectedEdges = newSelection;
              }.bind(this)
            }
          },
          node: {
            /*
             * PLUGIN: 
             * Include a option to open config menu panel according to the
             * type of box 
             */
            n4: {
              icon: "gear",
              iconLabel: "config",
              action: function (graph, itemKey, item) {
                graph.displayMenu(graph, itemKey, item);
              }.bind(this) 
            },
            s4: {
{'fraction_non_alphanumeric': 0.13854166666666667, 'fraction_numerical': 0.006076388888888889, 'mean_word_length': 1.787131107885825, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5549302', 'n_tokens_mistral': 1632, 'n_tokens_neox': 1573, 'n_words': 333}