Skip to content

Commit 6a70c2b

Browse files
matthttamclaude
andcommitted
Bug fixes and UX improvements
- Fix hover preview race condition during drag (retry dismiss on mousemove) - Fix drag-then-navigate bug (any pixel movement suppresses navigation) - Fix no-pin-no-icon state: preview shows placeholder, save blocked - Fix unused parameter in onMouseUp - Measurement text renders above markers (SVG overlay z-index) - Modal titles: "Create marker/template/layer" for new items - Layer edit modal uses title bar - Build runs lint before compile - Bump version to 1.1.2 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 322c356 commit 6a70c2b

58 files changed

Lines changed: 10978 additions & 10395 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release Obsidian Plugin
33
on:
44
push:
55
tags:
6-
- "[0-9]+.[0-9]+.[0-9]+"
6+
- '[0-9]+.[0-9]+.[0-9]+'
77

88
permissions:
99
contents: write
@@ -16,7 +16,7 @@ jobs:
1616

1717
- uses: actions/setup-node@v6
1818
with:
19-
node-version-file: ".nvmrc"
19+
node-version-file: '.nvmrc'
2020

2121
- name: Install dependencies
2222
run: npm install

CLAUDE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,32 +57,41 @@ Tests live in `tests/` (outside `src/` so the Obsidian review bot doesn't scan t
5757
This plugin is published to the Obsidian community directory. All code is scanned by an automated review bot using `eslint-plugin-obsidianmd` and `@typescript-eslint`. Run `npx eslint src/` locally before committing to catch issues early.
5858

5959
### UI text must use sentence case
60+
6061
All `.setName()`, `.setButtonText()`, `.setPlaceholder()`, `.setDesc()`, and heading text must use sentence case (first word capitalized, rest lowercase). Exceptions: proper nouns (TTRPG), acronyms (ID, SVG). Example: "Default marker scale", not "Default Marker Scale".
6162

6263
### No inline styles
64+
6365
Never use `element.style.X = ...` directly. Use CSS classes instead:
66+
6467
- Show/hide: `el.addClass("ttrpgmap-hidden")` / `el.removeClass("ttrpgmap-hidden")` (defined in styles.css)
6568
- Cursors: `ttrpgmap-cursor-grab`, `ttrpgmap-cursor-crosshair`, `ttrpgmap-cursor-copy`
6669
- Image rendering: `ttrpgmap-pixelated`
6770
- For truly dynamic values (positions, transforms, CSS custom properties), use `// eslint-disable-next-line obsidianmd/no-static-styles-assignment`
6871

6972
### Headings use the Setting API
73+
7074
Use `new Setting(containerEl).setName("...").setHeading()` instead of `createEl("h2")` or `createEl("h3")`.
7175

7276
### No innerHTML writes
77+
7378
Use `parent.empty()` to clear content. Use `DOMParser` + `appendChild` for injecting SVG strings. Reading innerHTML in tests is OK.
7479

7580
### No browser confirm()
81+
7682
Use an Obsidian `Modal` with buttons that resolve a Promise instead of `confirm()`.
7783

7884
### No async lifecycle overrides
85+
7986
Don't declare `onload()`, `onOpen()`, etc. as `async`. Wrap the async body in `void (async () => { ... })()` inside a synchronous method.
8087

8188
### Promise handling
89+
8290
- Don't pass `async` callbacks to `.onChange()`, `.onClick()`, or `addEventListener`. Either remove async and prefix promise calls with `void`, or wrap in `void (async () => { ... })()`.
8391
- Prefix fire-and-forget promise calls with `void` (e.g., `void plugin.dataManager.saveSettings(...)`).
8492

8593
### No explicit `any` in production code
94+
8695
Use proper types. For undocumented Obsidian APIs (e.g., `setSubmenu()`, `app.setting`), use `// eslint-disable-next-line @typescript-eslint/no-explicit-any`. In test/mock files, eslint-disable comments are acceptable for mock objects.
8796

8897
## Key conventions

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Add an empty `ttrpgmap` code block to any note:
5050

5151
````markdown
5252
```ttrpgmap
53+
5354
```
5455
````
5556

@@ -105,7 +106,6 @@ Configure rounding in the measurement panel to snap distances to the nearest mul
105106
<img width="803" height="624" alt="image" src="https://github.com/user-attachments/assets/5cfcdd20-8d77-4bbe-a943-4fe0faca4f65" />
106107
<img width="800" height="793" alt="image" src="https://github.com/user-attachments/assets/cd25067e-1f9f-4c8d-8d4f-55f31f966307" />
107108

108-
109109
### 5. Manage templates
110110

111111
Open **Settings** > **TTRPG Maps** to create and organize marker templates. Templates define default values for color, icon, shape, direction, and more. Use **Save & Update Markers** to push template changes to all existing markers that use it.
@@ -114,11 +114,11 @@ Open **Settings** > **TTRPG Maps** to create and organize marker templates. Temp
114114

115115
## How data is stored
116116

117-
| Data | Location | Managed by |
118-
|---|---|---|
119-
| Map config (image, zoom, dimensions) | Code block in your markdown file | Plugin writes back on settings change |
120-
| Markers, scale, layers, rounding | `.ttrpgmap/{mapId}.json` sidecar files | Plugin (debounced 300ms saves) |
121-
| Global settings and templates | `.obsidian/plugins/ttrpg-maps/data.json` | Obsidian `loadData`/`saveData` |
117+
| Data | Location | Managed by |
118+
| ------------------------------------ | ---------------------------------------- | ------------------------------------- |
119+
| Map config (image, zoom, dimensions) | Code block in your markdown file | Plugin writes back on settings change |
120+
| Markers, scale, layers, rounding | `.ttrpgmap/{mapId}.json` sidecar files | Plugin (debounced 300ms saves) |
121+
| Global settings and templates | `.obsidian/plugins/ttrpg-maps/data.json` | Obsidian `loadData`/`saveData` |
122122

123123
Sidecar files keep marker data separate from note content. You can safely commit them to version control or sync them across devices.
124124

0 commit comments

Comments
 (0)