mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 10:15:17 -04:00
Add application state hook (#1308)
* Add application state hook Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de> * Add docs Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
4720f2d36b
commit
829cc2fe48
47 changed files with 149 additions and 195 deletions
|
@ -5,13 +5,12 @@
|
|||
*/
|
||||
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { getProxiedUrl } from '../../../../api/media'
|
||||
import { ApplicationState } from '../../../../redux'
|
||||
import { useApplicationState } from '../../../../hooks/common/use-application-state'
|
||||
|
||||
export const ProxyImageFrame: React.FC<React.ImgHTMLAttributes<HTMLImageElement>> = ({ src, title, alt, ...props }) => {
|
||||
const [imageUrl, setImageUrl] = useState('')
|
||||
const imageProxyEnabled = useSelector((state: ApplicationState) => state.config.useImageProxy)
|
||||
const imageProxyEnabled = useApplicationState((state) => state.config.useImageProxy)
|
||||
|
||||
useEffect(() => {
|
||||
if (!imageProxyEnabled || !src) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue