Skip to content

Commit a0f0ecb

Browse files
Dean OhashiDean Ohashi
authored andcommitted
commented out fs module files
1 parent 6209701 commit a0f0ecb

File tree

3 files changed

+118
-118
lines changed

3 files changed

+118
-118
lines changed

src/components/ExportProject.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// import path from "path";
1212
// const ipc = require("electron").ipcRenderer;
1313
export default {
14-
name: "ExportProjectComponent"
14+
name: "ExportProjectComponent",
1515
// methods: {
1616
// showExportDialog() {
1717
// remote.dialog.showSaveDialog({

src/components/OpenProjectComponent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// import { mapState, mapActions } from 'vuex'
1212
1313
export default {
14-
// name: 'OpenProjectComponent',
14+
name: 'OpenProjectComponent',
1515
// methods: {
1616
// ...mapActions([
1717
// 'setComponentMap',

src/components/SaveProjectComponent.vue

Lines changed: 116 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -11,127 +11,127 @@
1111
1212
export default {
1313
name: 'SaveProjetComponent',
14-
methods: {
15-
showSaveJSONDialog(){
16-
remote.dialog.showSaveDialog({
17-
title: 'Choose location to save JSON object in',
18-
defaultPath: remote.app.getPath('desktop'),
19-
message: 'Choose location to save JSON object in',
20-
nameFieldLabel: 'Application State Name',
21-
filters: [{
22-
name: 'JSON Files',
23-
extensions: ['json']
24-
}]
25-
},
26-
result => {
27-
// event.sender.send('save-json-location', result);
28-
this.saveJSONLocation(result);
29-
});
30-
},
31-
parseFileName(file) {
32-
//'asdf/asdff/sdf.txt -> sdf.txt
33-
return file.split('/').pop();
34-
},
35-
parseAndDelete(htmlList) {
36-
htmlList.forEach(element => {
37-
if (element.children.length > 0) {
38-
console.log('in recurse');
39-
this.parseAndDelete(element.children);
40-
}
41-
delete element._vm;
42-
delete element.parent;
43-
delete element.open;
44-
delete element.active;
45-
delete element.style;
46-
delete element.class;
47-
delete element.innerStyle;
48-
delete element.innerClass;
49-
delete element.innerBackStyle;
50-
delete element.innerBackClass;
51-
});
52-
},
53-
saveProjectJSON() {
54-
console.log('THIS ONE');
55-
let projectLocation = this.$store.state.projects[
56-
this.$store.state.activeTab
57-
].lastSavedLocation;
58-
if (projectLocation) {
59-
console.log('IN SAVE LOCATION', this.$store.state);
60-
let state = this.$store.state;
61-
let routes = state.routes;
62-
for (let view in routes) {
63-
routes[view].forEach(component => {
64-
let htmlList = component.htmlList;
65-
this.parseAndDelete(htmlList);
66-
});
67-
}
68-
let componentMap = this.$store.state.componentMap;
69-
console.log('compmap', componentMap);
70-
for (let component in componentMap) {
71-
if (componentMap[component].htmlList) {
72-
let comphtml = componentMap[component].htmlList;
73-
console.log('COMPHTML', comphtml);
74-
this.parseAndDelete(comphtml);
75-
}
76-
}
14+
// methods: {
15+
// showSaveJSONDialog(){
16+
// remote.dialog.showSaveDialog({
17+
// title: 'Choose location to save JSON object in',
18+
// defaultPath: remote.app.getPath('desktop'),
19+
// message: 'Choose location to save JSON object in',
20+
// nameFieldLabel: 'Application State Name',
21+
// filters: [{
22+
// name: 'JSON Files',
23+
// extensions: ['json']
24+
// }]
25+
// },
26+
// result => {
27+
// // event.sender.send('save-json-location', result);
28+
// this.saveJSONLocation(result);
29+
// });
30+
// },
31+
// parseFileName(file) {
32+
// //'asdf/asdff/sdf.txt -> sdf.txt
33+
// return file.split('/').pop();
34+
// },
35+
// parseAndDelete(htmlList) {
36+
// htmlList.forEach(element => {
37+
// if (element.children.length > 0) {
38+
// console.log('in recurse');
39+
// this.parseAndDelete(element.children);
40+
// }
41+
// delete element._vm;
42+
// delete element.parent;
43+
// delete element.open;
44+
// delete element.active;
45+
// delete element.style;
46+
// delete element.class;
47+
// delete element.innerStyle;
48+
// delete element.innerClass;
49+
// delete element.innerBackStyle;
50+
// delete element.innerBackClass;
51+
// });
52+
// },
53+
// saveProjectJSON() {
54+
// console.log('THIS ONE');
55+
// let projectLocation = this.$store.state.projects[
56+
// this.$store.state.activeTab
57+
// ].lastSavedLocation;
58+
// if (projectLocation) {
59+
// console.log('IN SAVE LOCATION', this.$store.state);
60+
// let state = this.$store.state;
61+
// let routes = state.routes;
62+
// for (let view in routes) {
63+
// routes[view].forEach(component => {
64+
// let htmlList = component.htmlList;
65+
// this.parseAndDelete(htmlList);
66+
// });
67+
// }
68+
// let componentMap = this.$store.state.componentMap;
69+
// console.log('compmap', componentMap);
70+
// for (let component in componentMap) {
71+
// if (componentMap[component].htmlList) {
72+
// let comphtml = componentMap[component].htmlList;
73+
// console.log('COMPHTML', comphtml);
74+
// this.parseAndDelete(comphtml);
75+
// }
76+
// }
7777
78-
fs.writeFileSync(projectLocation, JSON.stringify(state));
78+
// fs.writeFileSync(projectLocation, JSON.stringify(state));
7979
80-
console.log('PROJECT SAVED TO LAST SAVED LOCATION');
81-
} else {
82-
// ipc.send('show-save-json-dialog');
83-
this.showSaveJSONDialog();
84-
}
85-
},
86-
saveJSONLocation(data){
87-
//delete original key from local forage
88-
let deleteKey = this.$store.state.projects[this.$store.state.activeTab].filename;
89-
localforage
90-
.removeItem(deleteKey)
91-
.then(function() {
92-
console.log(deleteKey, 'Key is cleared!');
93-
})
94-
.catch(function(err) {
95-
console.log(err);
96-
});
80+
// console.log('PROJECT SAVED TO LAST SAVED LOCATION');
81+
// } else {
82+
// // ipc.send('show-save-json-dialog');
83+
// this.showSaveJSONDialog();
84+
// }
85+
// },
86+
// saveJSONLocation(data){
87+
// //delete original key from local forage
88+
// let deleteKey = this.$store.state.projects[this.$store.state.activeTab].filename;
89+
// localforage
90+
// .removeItem(deleteKey)
91+
// .then(function() {
92+
// console.log(deleteKey, 'Key is cleared!');
93+
// })
94+
// .catch(function(err) {
95+
// console.log(err);
96+
// });
9797
98-
let fileName = this.parseFileName(data);
98+
// let fileName = this.parseFileName(data);
9999
100-
this.$set(this.$store.state.projects, this.$store.state.activeTab, {
101-
filename: fileName,
102-
lastSavedLocation: data
103-
});
104-
let state = this.$store.state;
105-
let routes = state.routes;
106-
for (let view in routes) {
107-
routes[view].forEach(component => {
108-
let htmlList = component.htmlList;
109-
this.parseAndDelete(htmlList);
110-
});
111-
}
112-
let componentMap = this.$store.state.componentMap;
113-
for (let component in componentMap) {
114-
if (component.htmlList) {
115-
let comphtml = component.htmlList;
116-
this.parseAndDelete(comphtml);
117-
}
118-
}
100+
// this.$set(this.$store.state.projects, this.$store.state.activeTab, {
101+
// filename: fileName,
102+
// lastSavedLocation: data
103+
// });
104+
// let state = this.$store.state;
105+
// let routes = state.routes;
106+
// for (let view in routes) {
107+
// routes[view].forEach(component => {
108+
// let htmlList = component.htmlList;
109+
// this.parseAndDelete(htmlList);
110+
// });
111+
// }
112+
// let componentMap = this.$store.state.componentMap;
113+
// for (let component in componentMap) {
114+
// if (component.htmlList) {
115+
// let comphtml = component.htmlList;
116+
// this.parseAndDelete(comphtml);
117+
// }
118+
// }
119119
120-
fs.writeFileSync(data, JSON.stringify(state));
121-
localforage
122-
.setItem(fileName, JSON.parse(fs.readFileSync(data, 'utf8')))
123-
.then(result => {
124-
console.log('saved ', fileName, 'to local forage');
125-
console.log('result is', result);
126-
});
127-
console.log('PROJECT SAVED AS A JSON OBJECT!');
128-
}
129-
},
130-
created(){
131-
Mousetrap.bind(['command+s', 'ctrl+s'], () => {
132-
this.saveProjectJSON()
133-
})
134-
}
120+
// fs.writeFileSync(data, JSON.stringify(state));
121+
// localforage
122+
// .setItem(fileName, JSON.parse(fs.readFileSync(data, 'utf8')))
123+
// .then(result => {
124+
// console.log('saved ', fileName, 'to local forage');
125+
// console.log('result is', result);
126+
// });
127+
// console.log('PROJECT SAVED AS A JSON OBJECT!');
128+
// }
129+
// },
130+
// created(){
131+
// Mousetrap.bind(['command+s', 'ctrl+s'], () => {
132+
// this.saveProjectJSON()
133+
// })
134+
// }
135135
}
136136
</script>
137137

0 commit comments

Comments
 (0)