Skip to content

Commit

Permalink
Fix the selectable text feature
Browse files Browse the repository at this point in the history
  • Loading branch information
MisRob authored and KshitijThareja committed Dec 17, 2024
1 parent 84dd30a commit 2a2c994
Showing 1 changed file with 41 additions and 5 deletions.
46 changes: 41 additions & 5 deletions lib/KCard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,47 @@
:class="['k-card', rootClass, thumbnailAlignClass]"
:headingStyles="headingStyles"
>
<template v-if="$slots.title" #title>
<!-- @slot Optional slot section containing the title contents, should not contain a heading element. -->
<slot name="title"></slot>
</template>
<template #default>
<div
:class="['card-area', layoutClass, thumbnailAlignClass]"
:style="{ backgroundColor: $themeTokens.surface }"
>
<component
:is="headingElement"
v-if="title || $slots.title"
class="heading"
:style="{ color: $themeTokens.text }"
>
<!--
`event=""` prevents router-link click event
(technique used by Vue community because
the usual ways don't work for router-link).
This is to
- (1) prevent double navigation (the wrapping
<li> is supposed to take care of navigation)
- (2) together with the `draggable` disabled,
ensures that text selection works on
the title text (see the feature for allowing
selecting card's content in `onClick`)
-->
<router-link
event=""
tabindex="-1"
:to="to"
draggable="false"
>
<!-- @slot Optional slot section containing the title contents, should not contain a heading element. -->
<slot
v-if="$slots.title"
name="title"
></slot>
<KTextTruncator
v-else
:text="title"
:maxLines="titleLines"
/>
</router-link>
</component>

<div
v-if="thumbnailDisplay !== Thumbnail_Displays.NONE"
class="thumbnail"
Expand Down

0 comments on commit 2a2c994

Please sign in to comment.