I’m trying to paste the following code:
import * as React from 'react'
import { Image } from 'react-konva'
import useImage from 'use-image'
import Konva from 'konva'
import { useFrameItStore } from '@/store/index'
export const SiteImage = () => {
const imageRef = React.useRef<Konva.Image>(null)
const [imageUrl, setImageUrl] = React.useState('')
const [image] = useImage(imageUrl)
const frameItStore = useFrameItStore()
const browser = frameItStore.browser
React.useEffect(() => {
chrome.runtime.onMessage.addListener((url) => {
setImageUrl(url)
})
}, [])
React.useEffect(() => {
if (image) {
imageRef.current?.cache()
imageRef.current?.getLayer()?.batchDraw()
}
}, [image])
return (
<Image
ref={imageRef}
image={image}
width={browser.width}
height={browser.height}
filters={[Konva.Filters.Blur, Konva.Filters.Brighten]}
blurRadius={10}
/>
)
}
And Obsidian makes it like:
import \* as React from 'react'
import { Image } from 'react-konva'
import useImage from 'use-image'
import Konva from 'konva'
import { useFrameItStore } from '@/store/index'
export const SiteImage \= () \=> {
const imageRef \= React.useRef<Konva.Image\>(null)
const \[imageUrl, setImageUrl\] \= React.useState('')
const \[image\] \= useImage(imageUrl)
const frameItStore \= useFrameItStore()
const browser \= frameItStore.browser
React.useEffect(() \=> {
chrome.runtime.onMessage.addListener((url) \=> {
setImageUrl(url)
})
}, \[\])
React.useEffect(() \=> {
if (image) {
imageRef.current?.cache()
imageRef.current?.getLayer()?.batchDraw()
}
}, \[image\])
return (
<Image
ref\={imageRef}
image\={image}
width\={browser.width}
height\={browser.height}
filters\={\[Konva.Filters.Blur, Konva.Filters.Brighten\]}
blurRadius\={10}
/>
)
}
It adds unnecessary slashes. Plus the tabbing is off. I only have 1 third-party plugin installed for Syntax highlighting. Not sure what’s wrong?