fix: edit note headings by visible paragraph semantics

This commit is contained in:
Valdemar Lorenzen
2026-10-20 13:39:29 +02:00
parent 3dfd9f58a4
commit bfdc1ced7d
4 changed files with 132 additions and 9 deletions
+9 -5
View File
@@ -8,10 +8,14 @@
- [x] add action to delete a note (currently selected note)
- [x] make images have rounded corners
- [x] bug: text flashes when inserting characters, which is visually disturbing.
- [ ] bug: deleting at line start on a heading removes the leading `#` symbols and changes formatting, and writing e.g. `#<space>` before the heading on that line doesn't change the heading level accordingly. we should instead:
- modify heading level based on leading `#.<space>` (interpret as regex)
- when deleting (backspace) at line start, interpret as deleting newline and just move heading up.
- maybe this warrants compressing elements into a semantic representation such that the underlying text that's being edited isn't necessarily one-to-one normal markdown, but instead something that's easier and less complex to edit and navigate that also fits the visual presentation more naturally.
- this should still be converted to normal markdown when saved to the persisted files and the content of those files should then also be converted to the representation discussed when editing.
- [x] fix heading editing using paragraph semantics:
- typing `#{1,6} ` at the visible paragraph start sets the absolute heading level, replacing any existing level; fenced code remains literal.
- Backspace at heading start deletes the preceding newline, not the heading prefix; at document start it does nothing.
- joining onto nonempty prose inherits the preceding paragraph's type: `Text\n## Heading` becomes `TextHeading`; removing an empty line above preserves the heading.
- keep native attributed-text editing, Undo, images, and Markdown serialization; retain RTFD autosaves rather than introducing a full document-model rewrite.
- [ ] add whole-note Markdown export actions to the Notes Actions menu:
- Copy as Markdown: replace images with inline-code placeholders such as `<photo.png>`.
- Export as Markdown…: save a single `.md` file without images; with images, create a folder containing the Markdown and image files, using relative links.
- exports leave the original note and RTFD autosaves unchanged.
- [ ] the guidelines for centering the application when dragged are blurry on some external monitors.
- track down the cause and fix it.