254fcc1b41
- HEADING_REGEX now requires a space/EOL after '#' so tag lines (#project ...) are no longer misdetected as headings and corrupted. - Command enable/disable settings now take effect immediately via checkCallback/editorCheckCallback instead of requiring a reload. - New Adjacent File auto-increments (Untitled.md, Untitled 1.md, ...) instead of throwing once Untitled.md already exists. - Selection-change tracking is delegated from document instead of a one-time .cm-content scan, so editors opened after startup are covered. See CHANGELOG.md for details.
51 lines
2.8 KiB
Markdown
51 lines
2.8 KiB
Markdown
# Changelog
|
|
|
|
All notable changes to this project are documented in this file.
|
|
Format loosely follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
|
## [Unreleased]
|
|
|
|
### Fixed
|
|
|
|
- **Heading toggle corrupted lines starting with a tag (`#tag ...`).** `HEADING_REGEX`
|
|
(`src/Constants.ts`) matched any run of leading `#` characters as a heading marker,
|
|
even without a following space. Obsidian tags like `#project meeting notes` were
|
|
therefore misread as an existing H1, so running *Toggle Heading - H1* on such a
|
|
line stripped the `#` instead of adding a heading (and running any other heading
|
|
level inserted a stray heading marker before the tag). The regex now requires the
|
|
`#` run to be followed by whitespace or end-of-line before it counts as a heading,
|
|
matching the ATX heading rule already used by *Toggle Heading (strip formatting)*.
|
|
(`src/Constants.ts`, `src/ToggleHeading.ts`)
|
|
|
|
- **Command enable/disable toggles in Settings required an Obsidian restart.**
|
|
`registerCommands()` only ran once in `onload()`, checking `enabledCommands` at
|
|
registration time. Flipping a toggle in the settings tab saved the new state but
|
|
had no effect on the already-registered commands until the plugin was reloaded,
|
|
contradicting the setting's own description ("Disabled commands will not appear
|
|
in the command palette"). Commands are now always registered and gated through
|
|
`checkCallback`/`editorCheckCallback`, so palette visibility and hotkeys respond
|
|
immediately to settings changes. Command IDs are unchanged, so existing hotkey
|
|
bindings are unaffected. (`src/main.ts`)
|
|
|
|
- **"New Adjacent File" failed after the first use in a folder.** The command
|
|
always targeted a literal `Untitled.md`; `vault.create()` throws if that path
|
|
already exists (very likely, since it's also Obsidian's own default new-note
|
|
name), surfacing a raw error `Notice` on every subsequent use. It now finds the
|
|
next available `Untitled N.md` name in the folder, mirroring Obsidian's built-in
|
|
new-note behavior. (`src/FileHelper.ts`)
|
|
|
|
- **Selection-tracking listeners went stale for editors opened after startup.**
|
|
`registerSelectionChangeListeners()` attached `keydown`/`click`/`dblclick`
|
|
listeners to every `.cm-content` element found via a single `querySelectorAll`
|
|
at layout-ready. Editors created afterward (new panes, splits, tabs) got their
|
|
own `.cm-content` element that was never instrumented, silently degrading the
|
|
manual-vs-programmatic selection heuristic used by *Select Next/Previous
|
|
Occurrence*. Listeners are now delegated from `document` in the capture phase,
|
|
so any editor present now or opened later is covered. (`src/main.ts`)
|
|
|
|
### Chore
|
|
|
|
- Reinstalled `node_modules` to pull the `@esbuild/win32-x64` binary; the checked
|
|
in lockfile/install had resolved only `@esbuild/linux-x64`, so `npm run build`
|
|
and `npm run dev` failed outright on this machine.
|