mirror of
https://github.com/yang991178/fluent-reader.git
synced 2025-02-01 01:47:07 +01:00
Merge branch 'hangman1998-master' into 1.1.1
This commit is contained in:
commit
34971eac80
@ -23,10 +23,15 @@ const CompactCard: React.FunctionComponent<Card.Props> = props => (
|
||||
text={props.item.title}
|
||||
filter={props.filter}
|
||||
title
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</span>
|
||||
<span className="snippet">
|
||||
<Highlights text={props.item.snippet} filter={props.filter} />
|
||||
<Highlights
|
||||
text={props.item.snippet}
|
||||
filter={props.filter}
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<Time date={props.item.date} />
|
||||
|
@ -25,10 +25,19 @@ const DefaultCard: React.FunctionComponent<Card.Props> = props => (
|
||||
) : null}
|
||||
<CardInfo source={props.source} item={props.item} />
|
||||
<h3 className="title">
|
||||
<Highlights text={props.item.title} filter={props.filter} title />
|
||||
<Highlights
|
||||
text={props.item.title}
|
||||
filter={props.filter}
|
||||
title
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</h3>
|
||||
<p className={"snippet" + (props.item.thumb ? "" : " show")}>
|
||||
<Highlights text={props.item.snippet} filter={props.filter} />
|
||||
<Highlights
|
||||
text={props.item.snippet}
|
||||
filter={props.filter}
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
|
@ -1,11 +1,13 @@
|
||||
import * as React from "react"
|
||||
import { validateRegex } from "../../scripts/utils"
|
||||
import { FeedFilter, FilterType } from "../../scripts/models/feed"
|
||||
import { SourceTextDirection } from "../../scripts/models/source"
|
||||
|
||||
type HighlightsProps = {
|
||||
text: string
|
||||
filter: FeedFilter
|
||||
title?: boolean
|
||||
dir: SourceTextDirection
|
||||
}
|
||||
|
||||
const Highlights: React.FunctionComponent<HighlightsProps> = props => {
|
||||
@ -57,10 +59,25 @@ const Highlights: React.FunctionComponent<HighlightsProps> = props => {
|
||||
}
|
||||
}
|
||||
|
||||
const testStyle = {
|
||||
direction: "inherit",
|
||||
writingMode: "inherit",
|
||||
} as React.CSSProperties
|
||||
if (props.dir === SourceTextDirection.RTL) {
|
||||
testStyle.direction = "rtl"
|
||||
} else if (props.dir === SourceTextDirection.Vertical) {
|
||||
testStyle.writingMode = "vertical-rl"
|
||||
}
|
||||
return (
|
||||
<>
|
||||
{spans.map(([text, flag]) =>
|
||||
flag ? <span className="h">{text}</span> : text
|
||||
flag ? (
|
||||
<div className="h" style={testStyle}>
|
||||
{text}
|
||||
</div>
|
||||
) : (
|
||||
<div style={testStyle}>{text}</div>
|
||||
)
|
||||
)}
|
||||
</>
|
||||
)
|
||||
|
@ -31,6 +31,7 @@ const ListCard: React.FunctionComponent<Card.Props> = props => (
|
||||
text={props.item.title}
|
||||
filter={props.filter}
|
||||
title
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</h3>
|
||||
{Boolean(props.viewConfigs & ViewConfigs.ShowSnippet) && (
|
||||
@ -38,6 +39,7 @@ const ListCard: React.FunctionComponent<Card.Props> = props => (
|
||||
<Highlights
|
||||
text={props.item.snippet}
|
||||
filter={props.filter}
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</p>
|
||||
)}
|
||||
|
@ -28,12 +28,14 @@ const MagazineCard: React.FunctionComponent<Card.Props> = props => (
|
||||
text={props.item.title}
|
||||
filter={props.filter}
|
||||
title
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</h3>
|
||||
<p className="snippet">
|
||||
<Highlights
|
||||
text={props.item.snippet}
|
||||
filter={props.filter}
|
||||
dir={props.source.textDir}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user