File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
src/routes/tutorial/[slug] Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 60
60
remove: []
61
61
};
62
62
for (const key in data .section .b ) {
63
- if (key .endsWith (' __delete' )) {
64
- const to_delete = key .slice (0 , - ' /__delete' .length );
65
- editing_constraints .remove .push (to_delete);
63
+ const stub = data .section .b [key];
64
+
65
+ if (stub .type === ' file' && stub .contents .startsWith (' __delete' )) {
66
+ // remove file
67
+ editing_constraints .remove .push (key);
68
+ delete b[key];
69
+ } else if (key .endsWith (' /__delete' )) {
70
+ // remove directory
71
+ const parent = key .slice (0 , key .lastIndexOf (' /' ));
72
+ editing_constraints .remove .push (parent);
73
+ delete b[parent];
66
74
for (const k in b) {
67
- if (k .startsWith (to_delete )) {
75
+ if (k .startsWith (parent + ' / ' )) {
68
76
delete b[k];
69
77
}
70
78
}
You can’t perform that action at this time.
0 commit comments