mirror of
https://github.com/yang991178/fluent-reader.git
synced 2025-03-30 11:20:05 +02:00
fix search with rtl
This commit is contained in:
parent
d5ab8bf53f
commit
59cc7293c7
4
dist/styles/cards.css
vendored
4
dist/styles/cards.css
vendored
@ -91,6 +91,10 @@
|
|||||||
.card span.h {
|
.card span.h {
|
||||||
background: #fce10080;
|
background: #fce10080;
|
||||||
}
|
}
|
||||||
|
.card.rtl .snippet,
|
||||||
|
.card.rtl .title {
|
||||||
|
direction: rtl;
|
||||||
|
}
|
||||||
|
|
||||||
.default-card {
|
.default-card {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
997
package-lock.json
generated
997
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@
|
|||||||
"@types/react-redux": "^7.1.9",
|
"@types/react-redux": "^7.1.9",
|
||||||
"@yang991178/rss-parser": "^3.8.1",
|
"@yang991178/rss-parser": "^3.8.1",
|
||||||
"electron": "^19.0.0",
|
"electron": "^19.0.0",
|
||||||
"electron-builder": "^22.11.3",
|
"electron-builder": "^23.0.3",
|
||||||
"electron-react-devtools": "^0.5.3",
|
"electron-react-devtools": "^0.5.3",
|
||||||
"electron-store": "^5.2.0",
|
"electron-store": "^5.2.0",
|
||||||
"electron-window-state": "^5.0.3",
|
"electron-window-state": "^5.0.3",
|
||||||
|
@ -3,10 +3,12 @@ import { Card } from "./card"
|
|||||||
import CardInfo from "./info"
|
import CardInfo from "./info"
|
||||||
import Time from "../utils/time"
|
import Time from "../utils/time"
|
||||||
import Highlights from "./highlights"
|
import Highlights from "./highlights"
|
||||||
|
import { SourceTextDirection } from "../../scripts/models/source"
|
||||||
|
|
||||||
const className = (props: Card.Props) => {
|
const className = (props: Card.Props) => {
|
||||||
let cn = ["card", "compact-card"]
|
let cn = ["card", "compact-card"]
|
||||||
if (props.item.hidden) cn.push("hidden")
|
if (props.item.hidden) cn.push("hidden")
|
||||||
|
if (props.source.textDir === SourceTextDirection.RTL) cn.push("rtl")
|
||||||
return cn.join(" ")
|
return cn.join(" ")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,15 +25,10 @@ const CompactCard: React.FunctionComponent<Card.Props> = props => (
|
|||||||
text={props.item.title}
|
text={props.item.title}
|
||||||
filter={props.filter}
|
filter={props.filter}
|
||||||
title
|
title
|
||||||
dir={props.source.textDir}
|
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<span className="snippet">
|
<span className="snippet">
|
||||||
<Highlights
|
<Highlights text={props.item.snippet} filter={props.filter} />
|
||||||
text={props.item.snippet}
|
|
||||||
filter={props.filter}
|
|
||||||
dir={props.source.textDir}
|
|
||||||
/>
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<Time date={props.item.date} />
|
<Time date={props.item.date} />
|
||||||
|
@ -2,11 +2,13 @@ import * as React from "react"
|
|||||||
import { Card } from "./card"
|
import { Card } from "./card"
|
||||||
import CardInfo from "./info"
|
import CardInfo from "./info"
|
||||||
import Highlights from "./highlights"
|
import Highlights from "./highlights"
|
||||||
|
import { SourceTextDirection } from "../../scripts/models/source"
|
||||||
|
|
||||||
const className = (props: Card.Props) => {
|
const className = (props: Card.Props) => {
|
||||||
let cn = ["card", "default-card"]
|
let cn = ["card", "default-card"]
|
||||||
if (props.item.snippet && props.item.thumb) cn.push("transform")
|
if (props.item.snippet && props.item.thumb) cn.push("transform")
|
||||||
if (props.item.hidden) cn.push("hidden")
|
if (props.item.hidden) cn.push("hidden")
|
||||||
|
if (props.source.textDir === SourceTextDirection.RTL) cn.push("rtl")
|
||||||
return cn.join(" ")
|
return cn.join(" ")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,19 +27,10 @@ const DefaultCard: React.FunctionComponent<Card.Props> = props => (
|
|||||||
) : null}
|
) : null}
|
||||||
<CardInfo source={props.source} item={props.item} />
|
<CardInfo source={props.source} item={props.item} />
|
||||||
<h3 className="title">
|
<h3 className="title">
|
||||||
<Highlights
|
<Highlights text={props.item.title} filter={props.filter} title />
|
||||||
text={props.item.title}
|
|
||||||
filter={props.filter}
|
|
||||||
title
|
|
||||||
dir={props.source.textDir}
|
|
||||||
/>
|
|
||||||
</h3>
|
</h3>
|
||||||
<p className={"snippet" + (props.item.thumb ? "" : " show")}>
|
<p className={"snippet" + (props.item.thumb ? "" : " show")}>
|
||||||
<Highlights
|
<Highlights text={props.item.snippet} filter={props.filter} />
|
||||||
text={props.item.snippet}
|
|
||||||
filter={props.filter}
|
|
||||||
dir={props.source.textDir}
|
|
||||||
/>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -7,7 +7,6 @@ type HighlightsProps = {
|
|||||||
text: string
|
text: string
|
||||||
filter: FeedFilter
|
filter: FeedFilter
|
||||||
title?: boolean
|
title?: boolean
|
||||||
dir?: SourceTextDirection
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Highlights: React.FunctionComponent<HighlightsProps> = props => {
|
const Highlights: React.FunctionComponent<HighlightsProps> = props => {
|
||||||
@ -59,22 +58,10 @@ const Highlights: React.FunctionComponent<HighlightsProps> = props => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const testStyle = {
|
|
||||||
direction: "inherit",
|
|
||||||
} as React.CSSProperties
|
|
||||||
if (props.dir === SourceTextDirection.RTL) {
|
|
||||||
testStyle.direction = "rtl"
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{spans.map(([text, flag]) =>
|
{spans.map(([text, flag]) =>
|
||||||
flag ? (
|
flag ? <span className="h">{text}</span> : text
|
||||||
<div className="h" style={testStyle}>
|
|
||||||
{text}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div style={testStyle}>{text}</div>
|
|
||||||
)
|
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
@ -3,6 +3,7 @@ import { Card } from "./card"
|
|||||||
import CardInfo from "./info"
|
import CardInfo from "./info"
|
||||||
import Highlights from "./highlights"
|
import Highlights from "./highlights"
|
||||||
import { ViewConfigs } from "../../schema-types"
|
import { ViewConfigs } from "../../schema-types"
|
||||||
|
import { SourceTextDirection } from "../../scripts/models/source"
|
||||||
|
|
||||||
const className = (props: Card.Props) => {
|
const className = (props: Card.Props) => {
|
||||||
let cn = ["card", "list-card"]
|
let cn = ["card", "list-card"]
|
||||||
@ -10,6 +11,7 @@ const className = (props: Card.Props) => {
|
|||||||
if (props.selected) cn.push("selected")
|
if (props.selected) cn.push("selected")
|
||||||
if (props.viewConfigs & ViewConfigs.FadeRead && props.item.hasRead)
|
if (props.viewConfigs & ViewConfigs.FadeRead && props.item.hasRead)
|
||||||
cn.push("read")
|
cn.push("read")
|
||||||
|
if (props.source.textDir === SourceTextDirection.RTL) cn.push("rtl")
|
||||||
return cn.join(" ")
|
return cn.join(" ")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +33,6 @@ const ListCard: React.FunctionComponent<Card.Props> = props => (
|
|||||||
text={props.item.title}
|
text={props.item.title}
|
||||||
filter={props.filter}
|
filter={props.filter}
|
||||||
title
|
title
|
||||||
dir={props.source.textDir}
|
|
||||||
/>
|
/>
|
||||||
</h3>
|
</h3>
|
||||||
{Boolean(props.viewConfigs & ViewConfigs.ShowSnippet) && (
|
{Boolean(props.viewConfigs & ViewConfigs.ShowSnippet) && (
|
||||||
@ -39,7 +40,6 @@ const ListCard: React.FunctionComponent<Card.Props> = props => (
|
|||||||
<Highlights
|
<Highlights
|
||||||
text={props.item.snippet}
|
text={props.item.snippet}
|
||||||
filter={props.filter}
|
filter={props.filter}
|
||||||
dir={props.source.textDir}
|
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
@ -2,11 +2,13 @@ import * as React from "react"
|
|||||||
import { Card } from "./card"
|
import { Card } from "./card"
|
||||||
import CardInfo from "./info"
|
import CardInfo from "./info"
|
||||||
import Highlights from "./highlights"
|
import Highlights from "./highlights"
|
||||||
|
import { SourceTextDirection } from "../../scripts/models/source"
|
||||||
|
|
||||||
const className = (props: Card.Props) => {
|
const className = (props: Card.Props) => {
|
||||||
let cn = ["card", "magazine-card"]
|
let cn = ["card", "magazine-card"]
|
||||||
if (props.item.hasRead) cn.push("read")
|
if (props.item.hasRead) cn.push("read")
|
||||||
if (props.item.hidden) cn.push("hidden")
|
if (props.item.hidden) cn.push("hidden")
|
||||||
|
if (props.source.textDir === SourceTextDirection.RTL) cn.push("rtl")
|
||||||
return cn.join(" ")
|
return cn.join(" ")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,14 +30,12 @@ const MagazineCard: React.FunctionComponent<Card.Props> = props => (
|
|||||||
text={props.item.title}
|
text={props.item.title}
|
||||||
filter={props.filter}
|
filter={props.filter}
|
||||||
title
|
title
|
||||||
dir={props.source.textDir}
|
|
||||||
/>
|
/>
|
||||||
</h3>
|
</h3>
|
||||||
<p className="snippet">
|
<p className="snippet">
|
||||||
<Highlights
|
<Highlights
|
||||||
text={props.item.snippet}
|
text={props.item.snippet}
|
||||||
filter={props.filter}
|
filter={props.filter}
|
||||||
dir={props.source.textDir}
|
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user