From 825452a560a34f0dd015ddb43595729bf1d608ee Mon Sep 17 00:00:00 2001 From: sd <1504629600@qq.com> Date: Tue, 3 Feb 2026 16:38:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=82=B9=E5=8F=8A=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E6=8F=92=E5=85=A5bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/public/stepEditor.html | 24 +++++++++++++++++++++--- ruoyi-ui/src/views/childRoom/BottomTimeline.vue | 17 +++++++++-------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/ruoyi-ui/public/stepEditor.html b/ruoyi-ui/public/stepEditor.html index 8c2e600..eb9f60f 100644 --- a/ruoyi-ui/public/stepEditor.html +++ b/ruoyi-ui/public/stepEditor.html @@ -515,25 +515,43 @@ insertText(text) { const editor = this.$refs.editor const selection = window.getSelection() + if (selection.rangeCount > 0) { const range = selection.getRangeAt(0) const textNode = document.createTextNode(text) range.insertNode(textNode) } else { - editor.innerHTML += `

${text}

` + if (editor.innerHTML.trim() === '') { + editor.innerHTML = `

${text}

` + } else { + editor.innerHTML += `

${text}

` + } } + + this.$nextTick(() => { + this.updateWordCount() + }) }, insertHTML(html) { const editor = this.$refs.editor const selection = window.getSelection() + if (selection.rangeCount > 0) { const range = selection.getRangeAt(0) const div = document.createElement('div') div.innerHTML = html range.insertNode(div) } else { - editor.innerHTML += html + if (editor.innerHTML.trim() === '') { + editor.innerHTML = `

${html}

` + } else { + editor.innerHTML += `

${html}

` + } } + + this.$nextTick(() => { + this.updateWordCount() + }) }, onInput() { this.content = this.$refs.editor.innerHTML @@ -566,7 +584,7 @@ }, onFocus() { const editor = this.$refs.editor - if (editor.innerText.trim() === '' || editor.innerText === this.placeholder) { + if (editor.innerText.trim() === '' && editor.innerHTML.trim() === '') { editor.innerHTML = '' } }, diff --git a/ruoyi-ui/src/views/childRoom/BottomTimeline.vue b/ruoyi-ui/src/views/childRoom/BottomTimeline.vue index d4ecdba..8b8b636 100644 --- a/ruoyi-ui/src/views/childRoom/BottomTimeline.vue +++ b/ruoyi-ui/src/views/childRoom/BottomTimeline.vue @@ -471,18 +471,19 @@ export default { }) this.scaleLabels = [] - const labelCount = 5 - for (let i = 0; i <= labelCount; i++) { - const percentage = (i / labelCount) * 100 - const currentSeconds = startSeconds + (totalSeconds * percentage / 100) - const hours = Math.floor(currentSeconds / 3600) - const minutes = Math.floor((currentSeconds % 3600) / 60) + const sortedSegments = [...this.timelineSegments].sort((a, b) => { + return this.timeToSeconds(a.time) - this.timeToSeconds(b.time) + }) + sortedSegments.forEach(segment => { + const segmentSeconds = this.timeToSeconds(segment.time) + const hours = Math.floor(segmentSeconds / 3600) + const minutes = Math.floor((segmentSeconds % 3600) / 60) const timeStr = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}` this.scaleLabels.push({ - position: percentage, + position: segment.position, time: timeStr }) - } + }) }, editSegment(segment) {