I got images and videos working in `NSTextView` using `NSTextAttachmentViewProvider`.
The reason why I made the block-based editor, was that I just could not figure out how to embed images and videos directly in an `NSTextView`.
Therefore, I decided to make a block-based editor where each block was a completely separate SwiftUI view. This means, instead of showing one continuous text view, I was dividing the blocks individually. For example, a note document could have, say, 20 separate text views. Image blocks were also separate and was represented as a SwiftUI `Image`.
Having so many different text views turned out to be a performance problem. Especially when text needed to wrap around (for example when resizing the window), the whole app would just freeze.
**PROBLEM WITH VIDEOS:** I need to fix scrubbing behavior for videos that happens when swiping up or down inside a video. This is an annoying feature of `AVPlayer` from AppKit, but I assume there is a way to disable that 🤞 For example, if you are just scrolling up/down a markdown file, and you reach a video, then the video will hijack the swipe gesture.
The reason why I made the block-based editor, was that I just could not figure out how to embed images and videos directly in an `NSTextView`.
Therefore, I decided to make a block-based editor where each block was a completely separate SwiftUI view. This means, instead of showing one continuous text view, I was dividing the blocks individually. For example, a note document could have, say, 20 separate text views. Image blocks were also separate and was represented as a SwiftUI `Image`.
Having so many different text views turned out to be a performance problem. Especially when text needed to wrap around (for example when resizing the window), the whole app would just freeze.
**PROBLEM WITH VIDEOS:** I need to fix scrubbing behavior for videos that happens when swiping up or down inside a video. This is an annoying feature of `AVPlayer` from AppKit, but I assume there is a way to disable that 🤞 For example, if you are just scrolling up/down a markdown file, and you reach a video, then the video will hijack the swipe gesture.