Fix show more button

This commit is contained in:
Jonathan Staab 2023-06-29 08:45:04 -07:00
parent 0a15170757
commit 8b3de91408
4 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,7 @@
# Current # Current
- [ ] nsec bunker support
- [ ] Add relayset support with kind 30022
- [ ] White-labeled - [ ] White-labeled
- [ ] Add invite code registration for relay - [ ] Add invite code registration for relay
- [ ] Add endpoint to nostream that updates whitelist - [ ] Add endpoint to nostream that updates whitelist

View File

@ -11,7 +11,7 @@
export let anchorId = null export let anchorId = null
export let maxLength = 700 export let maxLength = 700
export let showEntire = false export let showEntire = false
export let hideShowMore = true export let expandable = true
export let showMedia = user.getSetting("showMedia") export let showMedia = user.getSetting("showMedia")
</script> </script>
@ -26,7 +26,7 @@
{:else if note.kind === 30023} {:else if note.kind === 30023}
<NoteContentKind30023 {note} {showEntire} {showMedia} /> <NoteContentKind30023 {note} {showEntire} {showMedia} />
{:else} {:else}
<NoteContentKind1 {note} {anchorId} {maxLength} {showEntire} {showMedia} {hideShowMore}> <NoteContentKind1 {note} {anchorId} {maxLength} {showEntire} {showMedia} {expandable}>
<div slot="note-content" let:quote> <div slot="note-content" let:quote>
<svelte:self note={quote} {anchorId} {maxLength} /> <svelte:self note={quote} {anchorId} {maxLength} />
</div> </div>

View File

@ -25,13 +25,15 @@
export let anchorId = false export let anchorId = false
export let showEntire = false export let showEntire = false
export let showMedia = false export let showMedia = false
export let hideShowMore = false export let expandable = true
const fullContent = parseContent(note) const fullContent = parseContent(note)
const shortContent = truncateContent(fullContent, {maxLength, showEntire, showMedia}) const shortContent = truncateContent(fullContent, {maxLength, showEntire, showMedia})
const links = getLinks(shortContent) const links = getLinks(shortContent)
const extraLinks = without(links, getLinks(fullContent)) const extraLinks = without(links, getLinks(fullContent))
console.log(fullContent, shortContent)
export const isNewline = i => export const isNewline = i =>
!shortContent[i] || !shortContent[i] ||
shortContent[i].type === NEWLINE || shortContent[i].type === NEWLINE ||
@ -46,7 +48,7 @@
{#if type === NEWLINE} {#if type === NEWLINE}
<NoteContentNewline {value} /> <NoteContentNewline {value} />
{:else if type === ELLIPSIS} {:else if type === ELLIPSIS}
{#if !hideShowMore} {#if expandable}
<NoteContentEllipsis /> <NoteContentEllipsis />
{/if} {/if}
{:else if type === TOPIC} {:else if type === TOPIC}

View File

@ -75,7 +75,7 @@
</small> </small>
</div> </div>
<div class="break-word overflow-hidden text-gray-1"> <div class="break-word overflow-hidden text-gray-1">
<NoteContent maxLength={80} hideShowMore showMedia={false} {note} /> <NoteContent maxLength={80} expandable={false} showMedia={false} {note} />
</div> </div>
</Card> </Card>
</div> </div>