From 76f14bef2abf2bed8165448857f96026d9a2a8f0 Mon Sep 17 00:00:00 2001 From: Rustem Mussabekov Date: Tue, 9 Apr 2024 17:37:50 +0300 Subject: [PATCH] Highlight occurance in search results --- src/co/bookmarks/item/info/index.js | 7 +++++-- src/co/bookmarks/item/info/index.module.styl | 4 ++-- src/co/bookmarks/item/view.js | 12 ++++++++---- src/co/bookmarks/item/view.module.styl | 11 ++++++++--- src/co/common/header/index.module.styl | 4 ++-- src/data/helpers/bookmarks/index.js | 2 +- src/data/modules/persistConfig.js | 2 +- 7 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/co/bookmarks/item/info/index.js b/src/co/bookmarks/item/info/index.js index 72b7ea2e..bc19a8a1 100644 --- a/src/co/bookmarks/item/info/index.js +++ b/src/co/bookmarks/item/info/index.js @@ -3,12 +3,13 @@ import React from 'react' import t from '~t' import { ShortDate } from '~modules/format/date' +import SafeHtml from '~co/common/safeHtml' import { Link } from 'react-router-dom' import Icon, { Avatar } from '~co/common/icon' import Path from './path' export default function BookmarkItemInfo(props) { - const { className='', creatorRef, domain, type, link, created, reparse, collectionId, spaceId, important, broken, duplicate, cache } = props + const { className='', creatorRef, domain, type, link, created, reparse, collectionId, spaceId, important, broken, duplicate, cache, highlight } = props return (
@@ -58,7 +59,9 @@ export default function BookmarkItemInfo(props) {
) : null} -
{domain}
+ {highlight.link ? ( + + ) :
{domain}
}
diff --git a/src/co/bookmarks/item/info/index.module.styl b/src/co/bookmarks/item/info/index.module.styl index 29bf94a1..35a73e25 100644 --- a/src/co/bookmarks/item/info/index.module.styl +++ b/src/co/bookmarks/item/info/index.module.styl @@ -23,14 +23,14 @@ } &:not(:last-child):not([data-inline]) { - padding-right: var(--padding-large) + padding-right: var(--padding-medium) &:after { position: absolute right: 0 top: 0 content: 'ยท' - width: var(--padding-large) + width: var(--padding-medium) text-align: center } } diff --git a/src/co/bookmarks/item/view.js b/src/co/bookmarks/item/view.js index d58f3cbd..47689c1c 100644 --- a/src/co/bookmarks/item/view.js +++ b/src/co/bookmarks/item/view.js @@ -51,11 +51,15 @@ export default function BookmarkItemView(props) {
{note ? ( - - ) : null} - {excerpt ? ( - + ) : null} + {highlight.body || highlight.excerpt ? ( + + ) : ( + excerpt ? ( + + ) : null + )} diff --git a/src/co/bookmarks/item/view.module.styl b/src/co/bookmarks/item/view.module.styl index 9ade1be6..1ab9e148 100644 --- a/src/co/bookmarks/item/view.module.styl +++ b/src/co/bookmarks/item/view.module.styl @@ -77,6 +77,11 @@ align-content: flex-start grid-gap: calc(var(--padding-mini) / 2) + em { + font-weight: bold + font-style: normal + } + .title { font-weight: 500 font-size: var(--title-font-size) @@ -104,7 +109,7 @@ } } - .title, .excerpt, .note { + .title, .excerpt, .note, .body { display: -webkit-box line-clamp: 5 -webkit-line-clamp: 5 @@ -113,7 +118,7 @@ overflow: clip } - .title, .excerpt { + .title, .excerpt, .body { white-space: pre white-space: pre-wrap } @@ -211,7 +216,7 @@ padding: calc(var(--padding-medium) - var(--padding-mini)) } - .title, .excerpt { + .title, .excerpt, .body { line-clamp: 3; -webkit-line-clamp: 3; } diff --git a/src/co/common/header/index.module.styl b/src/co/common/header/index.module.styl index 50444c8f..59959f90 100644 --- a/src/co/common/header/index.module.styl +++ b/src/co/common/header/index.module.styl @@ -1,6 +1,6 @@ .header { - app-region: drag - -webkit-app-region: drag + //app-region: drag + //-webkit-app-region: drag display: flex flex-direction: row align-items: center diff --git a/src/data/helpers/bookmarks/index.js b/src/data/helpers/bookmarks/index.js index 27c4ed40..3dab8c55 100644 --- a/src/data/helpers/bookmarks/index.js +++ b/src/data/helpers/bookmarks/index.js @@ -107,7 +107,7 @@ export const normalizeBookmarks = (items=[], options)=>{ meta[item._id] = normalizeMeta(item) if (item.highlight) - highlight[item._id] = _.pick(item.highlight, 'title', 'excerpt', 'note', 'body') + highlight[item._id] = _.pick(item.highlight, 'title', 'excerpt', 'note', 'body', 'link') ids.push(item._id) }) diff --git a/src/data/modules/persistConfig.js b/src/data/modules/persistConfig.js index 53fece12..a2d3dd18 100644 --- a/src/data/modules/persistConfig.js +++ b/src/data/modules/persistConfig.js @@ -19,7 +19,7 @@ if (RAINDROP_ENVIRONMENT == 'browser') else storage = require('@react-native-async-storage/async-storage').default -const version = 36 +const version = 37 export default { key: 'primary',