Skip to content

Fix insert modal collapse: add Default option#368

Merged
ebullient merged 1 commit intomainfrom
claude/magical-lewin
Mar 28, 2026
Merged

Fix insert modal collapse: add Default option#368
ebullient merged 1 commit intomainfrom
claude/magical-lewin

Conversation

@ebullient
Copy link
Copy Markdown
Owner

Changes

  • Simplified collapse logic: Replaced complex conditional checks with a straightforward collapse !== "default" comparison in both code block and callout insertion handlers
  • Added Default option: Added "Default" as the initial collapse dropdown option in the insert modal, which respects the plugin's Collapsible By Default setting
  • Updated modal initialization: Changed collapse state to initialize as "default" instead of conditionally choosing between the default collapse type or "none"
  • Fixed preview rendering: Added logic to resolve the "default" collapse state to the appropriate value when generating the preview element
  • Enhanced documentation: Added comprehensive tables explaining collapse behavior for both callouts and code block admonitions, detailing how each dropdown option maps to written syntax and runtime behavior

Type

🐛 Bug fix, 🎨 Code cleanup

The "Make Collapsible" dropdown in the Insert Admonition/Callout modal
had inverted logic: it only wrote the collapse parameter when the value
*differed* from the configured default, meaning the selected value was
never written when left at the default.

Add a "Default" option (meaning: write nothing, let Obsidian or the
plugin's global setting decide). The modal now initializes to the
configured default collapse type when "Collapsible By Default" is on,
or "Default" otherwise. Insertion logic simplifies to: write the value
for any explicit selection (Open/Closed/None), skip it for "Default".

Also documents the collapse behavior for both callout and code block
formats in docs/commands.md.

Fixes #335
Closes #357

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ebullient ebullient merged commit 0846007 into main Mar 28, 2026
1 check passed
@ebullient ebullient deleted the claude/magical-lewin branch March 28, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant