Skip to content

Commit 153cd99

Browse files
committed
refactor: make filenames the note identity
1 parent 4361730 commit 153cd99

4 files changed

Lines changed: 147 additions & 174 deletions

File tree

‎EdgeMark/Core/Editor/MarkdownEditorView.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ struct MarkdownEditorView: View {
136136
documentId: noteID.uuidString,
137137
onPasteImage: { [noteID, noteTitle, noteFolder] pasteboard in
138138
guard let (data, ext) = Self.imageData(from: pasteboard) else { return nil }
139-
let note = Note(id: noteID, title: noteTitle, folder: noteFolder)
139+
let note = Note(id: noteID, filename: "\(noteTitle).md", folder: noteFolder)
140140
// Return embed syntax — gets inserted into the display-layer text.
141141
// onChange converts it back to standard ![](path) markdown before saving.
142142
return (try? FileStorage.saveImage(data: data, ext: ext, forNote: note))?.embedMarkdown
@@ -214,7 +214,7 @@ struct MarkdownEditorView: View {
214214
ImageDropOverlay { [noteID, noteTitle, noteFolder] url in
215215
guard let data = try? Data(contentsOf: url) else { return }
216216
let ext = url.pathExtension.lowercased()
217-
let note = Note(id: noteID, title: noteTitle, folder: noteFolder)
217+
let note = Note(id: noteID, filename: "\(noteTitle).md", folder: noteFolder)
218218
guard let result = try? FileStorage.saveImage(data: data, ext: ext, forNote: note) else { return }
219219
// After a drag completes the text view may have lost first responder.
220220
// Fall back to walking the window hierarchy to find it.

0 commit comments

Comments
 (0)