-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(edit-content): upload file #29875
- Loading branch information
Showing
12 changed files
with
260 additions
and
77 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
core-web/libs/edit-content/src/lib/fields/dot-edit-content-binary-field/utils/editor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export function extractFileExtension(fileName: string): string { | ||
const includesDot = fileName.includes('.'); | ||
|
||
if (!includesDot) { | ||
return ''; | ||
} | ||
|
||
return fileName.split('.').pop() || ''; | ||
} | ||
|
||
export function getInfoByLang(extension: string) { | ||
if (extension === 'vtl') { | ||
return { | ||
lang: 'html', | ||
mimeType: 'text/x-velocity', | ||
extension: '.vtl' | ||
}; | ||
} | ||
|
||
const language = monaco.languages | ||
.getLanguages() | ||
.find((language) => language.extensions?.includes(`.${extension}`)); | ||
|
||
return { | ||
lang: language?.id || 'text', | ||
mimeType: language?.mimetypes?.[0] || 'text/plain', | ||
extension: language?.extensions?.[0] || '.txt' | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
...dot-edit-content-file-field/components/dot-form-file-editor/dot-form-file-editor.conts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.