menghao 2 months ago
parent
commit
7c2324214a
  1. 24
      ruoyi-ui/public/stepEditor.html
  2. 17
      ruoyi-ui/src/views/childRoom/BottomTimeline.vue

24
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 += `<p>${text}</p>`
if (editor.innerHTML.trim() === '') {
editor.innerHTML = `<p>${text}</p>`
} else {
editor.innerHTML += `<p>${text}</p>`
}
}
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 = `<p>${html}</p>`
} else {
editor.innerHTML += `<p>${html}</p>`
}
}
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 = ''
}
},

17
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) {

Loading…
Cancel
Save