diff options
| author | hallgren <hallgren@chalmers.se> | 2011-09-13 15:19:16 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2011-09-13 15:19:16 +0000 |
| commit | e36af534bf70e719212836c12f133770357cd93b (patch) | |
| tree | dfb9a42b85266f68ff3f0cf5290c10ecba9262fc /src/editor/simple/editor.js | |
| parent | d394f76e3dc65e190cbdc839cb87d24eee837e96 (diff) | |
gfse: added grammar cloning
Diffstat (limited to 'src/editor/simple/editor.js')
| -rw-r--r-- | src/editor/simple/editor.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/editor/simple/editor.js b/src/editor/simple/editor.js index 3b1a9a486..64efd4ab1 100644 --- a/src/editor/simple/editor.js +++ b/src/editor/simple/editor.js @@ -37,12 +37,15 @@ function draw_grammar_list() { editor.appendChild(home) var gs=ul([]); function del(i) { return function () { delete_grammar(i); } } + function clone(i) { return function (g,b) { clone_grammar(i); } } for(var i=0;i<local.count;i++) { var grammar=local.get(i,null); if(grammar && grammar.basename) { var link=a(jsurl("open_grammar("+i+")"),[text(grammar.basename)]); gs.appendChild( - li([deletable(del(i),link,"Delete this grammar")])) + node("li",{"class":"extensible"}, + [deletable(del(i),link,"Delete this grammar"), + more(grammar,clone(i),"Clone this grammar")])) } } if(local.get("count",null)==null) @@ -80,6 +83,13 @@ function delete_grammar(i) { } } +function clone_grammar(i) { + var old=local.get(i); + var g={basename:old.basename,abstract:old.abstract,concretes:old.concretes} + save_grammar(g); + draw_grammar_list(); +} + function open_grammar(i) { var g=local.get(i); g.index=i; |
