From 66f78d697980d9c70251906e60cfc30f2afd47a8 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Tue, 22 Mar 2022 20:19:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=81=8F=E7=A7=BB=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E7=9A=84=E5=8C=B9=E9=85=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/core/PlayDetail/components/LyricMenu.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/core/PlayDetail/components/LyricMenu.vue b/src/renderer/components/core/PlayDetail/components/LyricMenu.vue index ae5a3881..7d5bf3f9 100644 --- a/src/renderer/components/core/PlayDetail/components/LyricMenu.vue +++ b/src/renderer/components/core/PlayDetail/components/LyricMenu.vue @@ -49,7 +49,8 @@ import { computed, useRefGetter, ref, useCommit, watch } from '@renderer/utils/v import useMenuLocation from '@renderer/utils/compositions/useMenuLocation' import { setLyricEdited, removeLyricEdited, debounce } from '@renderer/utils' -const offsetTagRxp = /^\s*\[offset:\s*(\S+(?:\d+)*)\s*\]/ +const offsetTagRxp = /(?:^|\n)\s*\[offset:\s*(\S+(?:\d+)*)\s*\]/ +const offsetTagAllRxp = /(?:^|\n)\s*\[offset:\s*(\S+(?:\d+)*)\s*\]/g const saveLyric = debounce((musicInfo, lyricInfo) => { setLyricEdited(musicInfo, lyricInfo) @@ -105,9 +106,9 @@ export default { let tlyric = props.lyricInfo.tlyric let lxlyric = props.lyricInfo.lxlyric if (offsetTagRxp.test(lyric)) { - lyric = lyric.replace(offsetTagRxp, `[offset:${offset}]`) - if (tlyric) tlyric = tlyric.replace(offsetTagRxp, `[offset:${offset}]`) - if (lxlyric) lxlyric = lxlyric.replace(offsetTagRxp, `[offset:${offset}]`) + lyric = lyric.replace(offsetTagAllRxp, `[offset:${offset}]`) + if (tlyric) tlyric = tlyric.replace(offsetTagAllRxp, `[offset:${offset}]`) + if (lxlyric) lxlyric = lxlyric.replace(offsetTagAllRxp, `[offset:${offset}]`) } else { lyric = `[offset:${offset}]\n` + lyric if (tlyric) tlyric = `[offset:${offset}]\n` + tlyric