@social-mail/social-mail-client 1.9.56 → 1.9.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.9.56",
3
+ "version": "1.9.57",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -282,8 +282,7 @@ export default class WebSiteStudioPage extends ContentPage {
282
282
  </div>;
283
283
  }
284
284
 
285
- changeFile() {
286
- const file = this.folderTree.selectedItem as IAppFile;
285
+ changeFile(file = this.folderTree.selectedItem as IAppFile) {
287
286
  const folder = this.cloudFileService.getFilePath(this.root, file) ?? "";
288
287
  SiteEditorCommands.editWebSite.dispatch({ id: this.parameters.id, page: folder + file.name });
289
288
  }
@@ -384,6 +383,21 @@ export default class WebSiteStudioPage extends ContentPage {
384
383
  async duplicateHtml(file: IAppFile) {
385
384
  let { name } = file;
386
385
  name = name.replace(/(\.[^\.]+)$/, (ext) => " Copy" + ext);
386
+
387
+ name = name.replace(/\.html$/, "");
388
+
389
+ name = prompt("Name of the file", name);
390
+ if (!name) {
391
+ return;
392
+ }
393
+
394
+ name = name + ".html";
395
+
396
+ // check if name already exists...
397
+ if(this.root.children.find((f) => f.name === name)) {
398
+ throw new Error("File with same name already exists");
399
+ }
400
+
387
401
  file = await this.cloudFileService.save({ ... file,
388
402
  appFileID: void 0,
389
403
  children: void 0,
@@ -391,7 +405,7 @@ export default class WebSiteStudioPage extends ContentPage {
391
405
  name
392
406
  });
393
407
  this.root.children.add(file);
394
- this.selectedFile = file;
408
+ this.changeFile(file);
395
409
  }
396
410
 
397
411
  @Action({ onEvent: "file-history"})