File tree 1 file changed +14
-13
lines changed
src/routes/tutorial/[slug]
1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change 105
105
},
106
106
107
107
edit: async (to_rename , new_name ) => {
108
- const illegal_rename =
109
- ! editing_constraints .remove .some ((r ) => to_rename .name === r) ||
110
- ! editing_constraints .create .some ((c ) => new_name === c);
111
- if (illegal_rename) {
112
- modal_text =
113
- ' Only the following files and folders are allowed to be renamed in this tutorial chapter:\n ' +
114
- editing_constraints .remove .join (' \n ' ) +
115
- ' \n\n They can only be renamed to the following:\n ' +
116
- editing_constraints .create .join (' \n ' );
117
- return ;
118
- }
119
-
120
108
/** @type {Array<[import('$lib/types').Stub, import('$lib/types').Stub]>} */
121
109
const changed = [];
122
- current_stubs = current_stubs .map ((s ) => {
110
+ const updated_stubs = current_stubs .map ((s ) => {
123
111
if (! s .name .startsWith (to_rename .name )) {
124
112
return s;
125
113
}
135
123
return new_stub;
136
124
});
137
125
126
+ const illegal_rename =
127
+ ! editing_constraints .remove .some ((r ) => to_rename .name === r) ||
128
+ changed .some (([, s ]) => ! editing_constraints .create .some ((c ) => s .name === c));
129
+ if (illegal_rename) {
130
+ modal_text =
131
+ ' Only the following files and folders are allowed to be renamed in this tutorial chapter:\n ' +
132
+ editing_constraints .remove .join (' \n ' ) +
133
+ ' \n\n They can only be renamed to the following:\n ' +
134
+ editing_constraints .create .join (' \n ' );
135
+ return ;
136
+ }
137
+
138
+ current_stubs = updated_stubs;
138
139
await load_files (current_stubs);
139
140
140
141
if (to_rename .type === ' file' ) {
You can’t perform that action at this time.
0 commit comments