feat: introduce an ImageContent component in editor#328
feat: introduce an ImageContent component in editor#328eric-burel wants to merge 1 commit intostackblitz:mainfrom
Conversation
|
|
| export function ImageContent({ src }: { src: string }) { | ||
| return <img src={src} />; | ||
| } |
There was a problem hiding this comment.
Problems left:
somehow the editor displays code from another file alongside the image
The existing <BinaryContent /> does too, but it uses position: absolute; inset: 0 to cover the text area. We could do same here:
| export function ImageContent({ src }: { src: string }) { | |
| return <img src={src} />; | |
| } | |
| export function ImageContent({ src }: { src: string }) { | |
| return ( | |
| <div className="flex items-center justify-center absolute inset-0 z-10 bg-tk-elements-app-backgroundColor"> | |
| <img src={src} /> | |
| </div> | |
| ); | |
| } |
This isn't actually good approach as the text content of previous file is still present in DOM. It's part of tab and read order so users can actually navigate to this invisible element. But as this bug is already present in TutorialKit we can ignore it on this PR. 🤷♂️
There was a problem hiding this comment.
I think this is a leftover of a time where we were trying to cache the EditorView from CodeMirror which I don't think is necessary. We should change the logic so that the CodeMirrorEditor is not rendered in that case.
This PR introduces an ImageContent component for the editor, for binary images.
Design choices:
Problems left:
Closes #309