@@ -918,8 +918,26 @@ class Main extends Model {
918918 var ndel = new MenuItem ( { label : " Delete" } );
919919 var nindex = new MenuItem ( { label : " Add Index" , type : MenuItemType .checkbox } );
920920 var ngroup = new MenuItem ( { label : " Add Group" , type : MenuItemType .checkbox } );
921- for ( m in [nins , nleft , nright , nren , ndel , nindex , ngroup ] )
921+
922+ var ncsv = new MenuItem ( { label : " CSV..." } );
923+ var csv = new Menu ();
924+ var importSheetCSV = new MenuItem ( { label : " Import..." , type : MenuItemType .checkbox } );
925+ var exportSheetCSV = new MenuItem ( { label : " Export..." , type : MenuItemType .checkbox } );
926+ csv .append (importSheetCSV );
927+ csv .append (exportSheetCSV );
928+ ncsv .submenu = csv ;
929+
930+ var njson = new MenuItem ( { label : " JSON..." } );
931+ var json = new Menu ();
932+ var importSheetJSON = new MenuItem ( { label : " Import..." , type : MenuItemType .checkbox } );
933+ var exportSheetJSON = new MenuItem ( { label : " Export..." , type : MenuItemType .checkbox } );
934+ json .append (importSheetJSON );
935+ json .append (exportSheetJSON );
936+ njson .submenu = json ;
937+
938+ for ( m in [nins , nleft , nright , nren , ndel , nindex , ngroup , njson , ncsv ] )
922939 n .append (m );
940+
923941 nleft .click = function () {
924942 var prev = - 1 ;
925943 for ( i in 0 ... base .sheets .length ) {
@@ -1005,6 +1023,49 @@ class Main extends Model {
10051023 nren .click = function () {
10061024 li .dblclick ();
10071025 };
1026+
1027+ importSheetJSON .click = function () {
1028+ var i = J (" <input>" ).attr (" type" , " file" ).css (" display" ," none" ).change (function (e ) {
1029+ var j = JTHIS ;
1030+ this .importSheetJSON (s , j .val ());
1031+ initContent ();
1032+ j .remove ();
1033+ });
1034+ i .appendTo (J (" body" ));
1035+ i .click ();
1036+ };
1037+ exportSheetJSON .click = function () {
1038+ var i = J (" <input>" ).attr (" type" , " file" ).attr (" nwsaveas" ,' ${s .name }.json' ).css (" display" ," none" ).change (function (e ) {
1039+ var j = JTHIS ;
1040+ this .exportSheetJSON (s , j .val ());
1041+ initContent ();
1042+ j .remove ();
1043+ });
1044+ i .appendTo (J (" body" ));
1045+ i .click ();
1046+ };
1047+
1048+ importSheetCSV .click = function () {
1049+ var i = J (" <input>" ).attr (" type" , " file" ).css (" display" ," none" ).change (function (e ) {
1050+ var j = JTHIS ;
1051+ this .importSheetCSV (s , j .val ());
1052+ initContent ();
1053+ j .remove ();
1054+ });
1055+ i .appendTo (J (" body" ));
1056+ i .click ();
1057+ };
1058+ exportSheetCSV .click = function () {
1059+ var i = J (" <input>" ).attr (" type" , " file" ).attr (" nwsaveas" ,' ${s .name }.csv' ).css (" display" ," none" ).change (function (e ) {
1060+ var j = JTHIS ;
1061+ this .exportSheetCSV (s , j .val ());
1062+ initContent ();
1063+ j .remove ();
1064+ });
1065+ i .appendTo (J (" body" ));
1066+ i .click ();
1067+ };
1068+
10081069 if ( s .isLevel () || (s .hasColumn (" width" , [TInt ]) && s .hasColumn (" height" , [TInt ]) && s .hasColumn (" props" ,[TDynamic ])) ) {
10091070 var nlevel = new MenuItem ( { label : " Level" , type : MenuItemType .checkbox } );
10101071 nlevel .checked = s .isLevel ();
0 commit comments