Skip to content

Commit

Permalink
* Only attach event listener to timestamp catcher componenet from des…
Browse files Browse the repository at this point in the history
…cription component
  • Loading branch information
PikachuEXE committed Dec 30, 2024
1 parent 7d16b4a commit b35f5f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
10 changes: 1 addition & 9 deletions src/renderer/components/FtTimestampCatcher.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<template>
<p
@click="onClick"
@keydown.space.prevent="onClick"
@timestamp-clicked="catchTimestampClick"
v-html="displayText"
/>
Expand Down Expand Up @@ -44,13 +42,7 @@ const displayText = computed(() => props.inputHtml.replaceAll(/(?:(\d+):)?(\d+):
return `<a tabindex="${props.linkTabIndex}" href="${url}" onclick="event.preventDefault();this.dispatchEvent(new CustomEvent('timestamp-clicked',{bubbles:true,detail:${time}}));window.scrollTo(0,0)">${timestamp}</a>`
}))
const emit = defineEmits(['text-click', 'timestamp-event'])
function onClick(e) {
// Ignore link clicks
if (e.target.tagName === 'A') { return }
emit('text-click')
}
const emit = defineEmits(['timestamp-event'])
/**
* @param {CustomEvent} event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
:input-html="processedShownDescription"
:link-tab-index="linkTabIndex"
@timestamp-event="onTimestamp"
@text-click="expandDescription"
@click.native="expandDescriptionWithClick"
/>
<span
v-if="showControls && showFullDescription"
Expand Down Expand Up @@ -97,6 +97,16 @@ function onTimestamp(timestamp) {
emit('timestamp-event', timestamp)
}
/**
@param {PointerEvent} e
*/
function expandDescriptionWithClick(e) {
// Ignore link clicks
if (e.target.tagName === 'A') { return }
expandDescription()
}
/**
* Enables user to view entire contents of description
*/
Expand Down

0 comments on commit b35f5f2

Please sign in to comment.