Importing images and videos is now working in my notes app ๐Ÿš€ But it's not quite perfect yet! There's still more work to do ๐Ÿ’ป When importing media for the first time, an `/assets` folder is created in the root directory where all media is saved. Media files are reference by relative paths in the note documents. Need to work more on videos (notice the black bars on top and bottom - they should be removed). When placing cursor on video and then swiping up and down, the video starts scrubbing which is annoying. Need to figure out how to disable that. Resizing images and videos doesn't work. I also need to get fullscreen working. Basically, when double-clicking on an image, it should go into "fullscreen" - well, more like a popup with a blurry and dark background. I should probably add an option in the context menu when right-clicking an image to make it a fullscreen image that fills the entire screen. Two more options I should add could be "Open image in new tab" and "Reveal in Finder". This is unrelated to media and is more of a general issue: There's a problem with the 'Files' sidebar not updating/re-rendering when new files are imported. It just does not render the new files, so they are never displayed in the sidebar, unless the user quits and reopens the app. I think this should be fairly easy to fix. I probably just forgot to observe an `NSNotification`... #dev #Swift #AppKit #macOS
Frederik Handberg's avatar Frederik Handberg
Today, I'm going to be working on the functionality to insert media like images and videos into documents for my notes app. I'll concentrate on getting images working, but maybe I can even get support for videos implemented as well before the end of today. **I have some decisions I need to make:** - Where should media be saved? I'm thinking of creating an `/assets` folder automatically when the user imports some media. - How should notes reference media? Should probably be the same way as Obsidian - just use a relative path. However, it's important that the path updates automatically if the user moves the media file elsewhere. - What to do if there's a naming conflict? Either, the app can check if the imported media is identical - in that case, there's no reason to import a duplicate so just cancel the import and let the user know, that the media has already been imported. Otherwise, I could just add "(1)", "(2)" and so on after the file name. The last option is certainly easier, so I think I'll start with that, then I can improve it later... Hopefully I can get it working before the end of today ๐Ÿคž
View quoted note →
โ†‘