diff --git a/packages/plugins/src/menu/NewProject.ts b/packages/plugins/src/menu/NewProject.ts index 3e4dfa902d..042d1dd963 100644 --- a/packages/plugins/src/menu/NewProject.ts +++ b/packages/plugins/src/menu/NewProject.ts @@ -20,13 +20,23 @@ import { } from '@openscd/open-scd/src/schemas.js'; export default class NewProjectPlugin extends LitElement { + private createNewProject( inputs: WizardInputElement[], wizard: Element ): EditorAction[] { - const docName = inputs[0].value?.match(/\.s[sc]d$/i) - ? inputs[0].value - : inputs[0].value + '.scd'; + + let docName = inputs[0].value ?? '' + + const acceptedFileExtension = ['.ssd', '.scd','.fsd']; + const isValidFileFormat = acceptedFileExtension.some((extension) => { + return inputs[0].value?.endsWith(extension); + }) + + if(!isValidFileFormat) { + docName = docName + '.scd'; + } + const version = ( (wizard.shadowRoot!.querySelector('mwc-list')!.selected) .value @@ -39,7 +49,6 @@ export default class NewProjectPlugin extends LitElement { return [{ actions: [], title: '', derived: true }]; } - private newProjectWizard(): Wizard { return [ {