MusicXML 표준 확장자를 지원한다
파일 선택 목록과 가져오기 분기에서 .musicxml 확장자를 .xml 및 .mxl과 동일하게 처리한다. 한국어 파일명의 MusicXML 악보를 실제로 불러올 수 있도록 제목 정리 규칙도 맞췄다.
This commit is contained in:
@@ -247,7 +247,7 @@ export function TransportControls() {
|
||||
)}
|
||||
<input
|
||||
type="file"
|
||||
accept=".mid,.midi,.xml,.mxl,.pdf,.mp3,.wav,.m4a,.ogg,.flac,.aac"
|
||||
accept=".mid,.midi,.xml,.musicxml,.mxl,.pdf,.mp3,.wav,.m4a,.ogg,.flac,.aac"
|
||||
className="hidden"
|
||||
onChange={(e) => {
|
||||
const f = e.target.files?.[0];
|
||||
|
||||
@@ -313,7 +313,7 @@ export const useAppStore = create<AppState>((set, get) => {
|
||||
try {
|
||||
const id = crypto.randomUUID();
|
||||
// M4 - strip path separators, control chars; cap length
|
||||
const rawTitle = file.name.replace(/\.(xml|mxl)$/i, "");
|
||||
const rawTitle = file.name.replace(/\.(xml|musicxml|mxl)$/i, "");
|
||||
const title = rawTitle.replace(/[\x00-\x1f\x7f/\\]/g, "").slice(0, 200) || "Untitled";
|
||||
const xmlBytes = await file.arrayBuffer();
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ export function PracticeView() {
|
||||
const loadFile = useCallback(
|
||||
(file: File) => {
|
||||
if (file.name.match(/\.midi?$/i)) loadMidiFile(file);
|
||||
else if (file.name.match(/\.(xml|mxl)$/i)) loadMusicXmlFile(file);
|
||||
else if (file.name.match(/\.(xml|musicxml|mxl)$/i)) loadMusicXmlFile(file);
|
||||
else if (file.name.match(/\.pdf$/i)) loadPdfFile(file);
|
||||
else if (file.name.match(/\.(mp3|wav|m4a|ogg|flac|aac)$/i)) loadAudioFile(file);
|
||||
},
|
||||
@@ -424,7 +424,7 @@ function EmptyState({ onImport }: { onImport: (file: File) => void }) {
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept=".mid,.midi,.xml,.mxl,.pdf,.mp3,.wav,.m4a,.ogg,.flac,.aac"
|
||||
accept=".mid,.midi,.xml,.musicxml,.mxl,.pdf,.mp3,.wav,.m4a,.ogg,.flac,.aac"
|
||||
className="hidden"
|
||||
onChange={(e) => {
|
||||
const f = e.target.files?.[0];
|
||||
|
||||
Reference in New Issue
Block a user