Skip to content

Commit 8a0fca6

Browse files
committed
优化文件格式前向兼容
1 parent 473b8c6 commit 8a0fca6

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

src/core/file/project/dataVer/0_1.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ import type { ProjDataTill_0_0 } from './0_0'
55
/**
66
* Data version 0.1
77
*
8-
* CHANELOG (v0.0 -> v0.1):
8+
* CHANGELOG (v0.0 -> v0.1):
99
* - Rename "words" to "syllables"
1010
* - Rename "lyricLines" to "lines"
1111
* - Remove "currentplaceholdingBeat" from syllables
12+
*
13+
* CHANGELOG (v0.1 -> v0.1.1):
14+
* - Add "connectNext" to lines
1215
*/
1316
export interface ProjData_0_1 {
1417
dataVersion: 'ALDv0.1'
@@ -33,6 +36,7 @@ export interface ProjData_0_1 {
3336
}[]
3437
ignoreInTiming: boolean
3538
bookmarked: boolean
39+
connectNext?: boolean
3640
}[]
3741
}
3842

src/core/file/project/parse.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import JSZip from 'jszip'
22

3-
import type { Persist } from '@core/types'
3+
import type { LyricLine, Persist } from '@core/types'
44

55
import type { ProjPayload } from '.'
66
import {
@@ -53,8 +53,9 @@ export async function parseProjectFile(file: Blob): Promise<ProjPayload> {
5353
function parseProjectData(data: SupportedProjData): Persist {
5454
const latestData = migrateToLatestProjData(data)
5555
const { metadata } = latestData
56-
const persistLines = latestData.lines.map((line) => ({
56+
const persistLines: LyricLine[] = latestData.lines.map((line) => ({
5757
...line,
58+
connectNext: line.connectNext ?? false,
5859
syllables: line.syllables.map((syllable) => ({
5960
...syllable,
6061
currentplaceholdingBeat: 0,

src/core/types/core.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export interface LyricLine {
2525
ignoreInTiming: boolean
2626
/** 已添加书签 */
2727
bookmarked: boolean
28+
/** 结束时间延长到下一行的开始时间 */
29+
connectNext: boolean
2830
}
2931

3032
/** 单词 */

src/states/stores/core.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const newLine = (attrs: Partial<LyricLine> = {}) =>
1919
romanization: '',
2020
background: false,
2121
duet: false,
22+
connectNext: false,
2223
...attrs,
2324
id: nanoid(),
2425
})

0 commit comments

Comments
 (0)