mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Expose highlight on release to web
This commit is contained in:
parent
d54211a146
commit
1a9924bedb
3 changed files with 44 additions and 1 deletions
|
|
@ -573,7 +573,7 @@ export function HighlightsLayer(props: HighlightsLayerProps): JSX.Element {
|
|||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (props.highlightOnRelease && selectionData?.wasDragEvent) {
|
||||
if (props.highlightOnRelease) {
|
||||
handleAction('create')
|
||||
setSelectionData(null)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,37 @@ function AdvancedSettings(props: SettingsProps): JSX.Element {
|
|||
<SwitchThumb />
|
||||
</SwitchRoot>
|
||||
</HStack>
|
||||
|
||||
<HStack
|
||||
css={{
|
||||
width: '100%',
|
||||
pr: '30px',
|
||||
alignItems: 'center',
|
||||
'&:hover': {
|
||||
opacity: 0.8,
|
||||
},
|
||||
'&[data-state="on"]': {
|
||||
bg: '$thBackground',
|
||||
},
|
||||
}}
|
||||
alignment="start"
|
||||
distribution="between"
|
||||
>
|
||||
<Label htmlFor="auto-highlight-mode" css={{ width: '100%' }}>
|
||||
<StyledText style="displaySettingsLabel" css={{ pl: '20px' }}>
|
||||
Auto highlight mode
|
||||
</StyledText>
|
||||
</Label>
|
||||
<SwitchRoot
|
||||
id="high-contrast-text"
|
||||
checked={readerSettings.highlightOnRelease ?? false}
|
||||
onCheckedChange={(checked) => {
|
||||
readerSettings.setHighlightOnRelease(checked)
|
||||
}}
|
||||
>
|
||||
<SwitchThumb />
|
||||
</SwitchRoot>
|
||||
</HStack>
|
||||
</VStack>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ export type ReaderSettings = {
|
|||
setJustifyText: (set: boolean) => void
|
||||
highContrastText: boolean | undefined
|
||||
setHighContrastText: (set: boolean) => void
|
||||
|
||||
highlightOnRelease: boolean | undefined
|
||||
setHighlightOnRelease: (set: boolean) => void
|
||||
}
|
||||
|
||||
export const useReaderSettings = (): ReaderSettings => {
|
||||
|
|
@ -61,6 +64,13 @@ export const useReaderSettings = (): ReaderSettings => {
|
|||
initialValue: false,
|
||||
})
|
||||
|
||||
const [highlightOnRelease, setHighlightOnRelease] = usePersistedState<
|
||||
boolean | undefined
|
||||
>({
|
||||
key: `--display-highlight-on-release`,
|
||||
initialValue: false,
|
||||
})
|
||||
|
||||
const [justifyText, setJustifyText] = usePersistedState<boolean | undefined>({
|
||||
key: `--display-justify-text`,
|
||||
initialValue: false,
|
||||
|
|
@ -216,5 +226,7 @@ export const useReaderSettings = (): ReaderSettings => {
|
|||
setJustifyText,
|
||||
highContrastText,
|
||||
setHighContrastText,
|
||||
highlightOnRelease,
|
||||
setHighlightOnRelease,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue