Commit Graph
736 Commits
Author SHA1 Message Date
Zef Hemel cecd56c267 Fix index range for data, space-lua and space-style blocks 2026-05-09 13:05:08 +02:00
Zef Hemel ece758e59d e2e test fix for x-ray 2026-05-09 12:39:00 +02:00
Zef Hemel aa0996bbd0 Add X-Ray editor lens
New "Editor: Toggle X-Ray" command underlines every ranged object the indexer produces and shows a YAML tooltip per indexing tag on hover.
2026-05-09 12:32:11 +02:00
Zef Hemel 2d45929ea8 Fixes #1966 2026-05-06 13:14:14 +02:00
Zef Hemel a28c661d24 refactor: config: rename ui order to priority (consistency with rest of SB), flip sort direction
Also: docs
2026-05-03 16:06:45 +02:00
Zef Hemel c96651d0b2 fix lint... 2026-04-30 19:57:35 +02:00
Zef Hemel 25256307fb plug: register anchor functions on index plug events 2026-04-30 19:46:34 +02:00
Zef Hemel b05b6f4652 editor: anchor autocomplete and lint rules 2026-04-30 19:46:01 +02:00
Zef Hemel 60c2ecf4d8 editor: navigate, toggle, and render anchor refs 2026-04-30 19:44:30 +02:00
Zef Hemel facf5cc141 index: page-level $anchor via frontmatter $ref 2026-04-30 19:38:35 +02:00
Zef Hemel cb36d44634 index: resolveAnchor function and syscall wrapper 2026-04-30 19:34:13 +02:00
Zef Hemel 4e4eb58a21 index: emit dedicated anchor records 2026-04-30 18:02:21 +02:00
Zef Hemel 05d3ba9333 anchor extraction and per-type indexer wiring
Paragraphs, list items, tasks, headers, and fenced-data blocks now adopt the anchor name as the host's `ref` field when present. For fenced-data blocks the anchor comes from a YAML  field named `$ref:` (the markdown anchor syntax doesn't apply inside YAML).
2026-04-30 17:57:10 +02:00
Zef Hemel 0b5cf7c6af Make Configuration UI look more reasonable on mobile devices 2026-04-28 09:07:44 +02:00
Zef Hemel c33b3edd41 Fix "Save & Apply" on hover for configuration management 2026-04-26 20:50:32 +02:00
Zef Hemel 4149fbc287 Fixes #1936 2026-04-26 17:31:53 +02:00
Zef Hemel 5833919faf More robust traversals in case of invalid markdown trees 2026-04-26 17:22:29 +02:00
Zef Hemel e4ffb660c0 Limit restriction on name attribute to just #meta/library pages 2026-04-24 13:55:28 +02:00
Zef Hemel d0cb8e6c0e Menus: refactoring and renaming 2026-04-23 13:32:00 +02:00
Zef Hemel 1e5d35ab8d Simplified navigate home keyboard shortcut 2026-04-23 10:21:50 +02:00
Zef Hemel 47f9d9987c Annotated existing commands with menu placements 2026-04-23 10:16:49 +02:00
Zef Hemel 88428d2111 Key bindings UI: "Filter commands" instead of "Search commands"
Consistency people
2026-04-21 17:09:54 +02:00
Zef Hemel 5a9f9ed101 Std Library: remove plug-manager and legacy Library Manager
Drop the old plug-manager plug and the Space-Lua Library Manager, all superseded by the Libraries tab in the configuration manager.

Pass fallback values to config.get(...) in the Std widgets so  TOC / linked mentions / linked tasks keep rendering on a fresh  space where schema defaults haven't been indexed yet.
2026-04-21 16:59:00 +02:00
Zef Hemel 74173af525 Configuration Manager: Libraries tab
Add a Libraries tab to the configuration manager covering installed libraries, installable libraries (from repositories),  repositories themselves, and detection of "rogue" plugs installed outside a library.

Rename the managed-block marker from "configuration-ui" to"configuration-manager" to match the plug name.
2026-04-21 16:56:55 +02:00
Zef Hemel 54da633d06 Move "Plugs: Reload" command to editor
Move `Plugs: Reload` from the plug-manager plug into the editor plug  alongside the other built-in client commands, ahead of removing plug-manager entirely.
2026-04-21 16:53:45 +02:00
Zef Hemel a446014e2c Fix: accidentally pulled in a huge amount of codemirror code by not using the parseMarkdown syscall in outline ops, whoopsies
Reduces the editor plug bundle size by about 600K
2026-04-21 16:52:50 +02:00
Zef Hemel 42bbcf5f7c lint fixes 2026-04-21 10:16:05 +02:00
Zef Hemel 88c3f00b7d First iteration of the new: configuration-manager plug
Adds the `Configuration: Open` command (Ctrl/Cmd-,) (and `Configuration: Key Bindings` also) backed by a Preact UI compiled through the new plug build steps. Supports editing scalar, enum, password, and object fields against the registered JSON schemas, plus a shortcuts tab with a chord recorder that handles multi-stroke sequences and multiple alternate bindings per command.

Edits are written back into a managed `space-lua` block (created  from template/CONFIG.md on first save).
2026-04-21 10:08:27 +02:00
Zef Hemel 21ce019ede Editor: move built-in commands from plug to client
Cursor motions, selection, delete, undo/redo, completion, and the various navigator/palette openers are registered directly on the CommandHook from client code, eliminating the async plug round-trip that was racing Enter/Backspace handling in some cases (especially e2e tests).

CommandHook gains `registerCommand` and a shared `mergeCommand`  helper so built-ins, plug commands.
2026-04-21 10:05:38 +02:00
Zef Hemel efd827b721 Implements #510
Extracts almost all codemirror keyboard shortcuts into proper SB
commands so they can be rebound

Bonus: renders prettier versions of keyboard shortcuts on Mac
2026-04-17 16:45:11 +02:00
Zef Hemel 1ae2bd4d9e Fix: regression aspiring pages not being deleted once page is created 2026-04-14 09:18:37 +02:00
Zef Hemel 628fbb3ed3 Fixes #1932 2026-04-14 07:57:26 +02:00
Zef Hemel 82868f7992 Fix: cannot rename pages that contain an external link 2026-04-13 07:58:57 +02:00
Zef Hemel 2229a11160 Fix tag stripping for page templates 2026-04-08 20:03:46 +02:00
Zef Hemel e5f188e59e Tag enhancements
* tag.define now supports a `tagPage` attribute, allowing what page to
  send the user to when clicking on a hash tag in the editor
* index.contentPages() and index.metaPages() are convenience wrappers
  around the index.tag("page") collection that filter on content and
  meta pages respectively.
2026-04-01 08:44:50 +02:00
Zef Hemel 49229c1608 Add pageLastModified to item and task, similar to link 2026-03-31 15:43:21 +02:00
Zef Hemel 0580416fed lint 2026-03-28 16:51:23 +01:00
Zef Hemel 8d4695cb9e Fixes #736 adds auto complete of tags: key in frontmatter 2026-03-26 17:34:22 +01:00
Zef Hemel 78a1dc92ac Fixes #1908
Now only "#meta" and "#meta/" prefixed tags are considered meta tags,
not "#metabase"
2026-03-26 14:03:49 +01:00
d2e24ebae0 Add a dropdown picker for custom task states (#1900)
* Add a dropdown picker for custom task states

Add a dropdown picker for custom task states that appears as a small
triangle next to the `[state]` allowing to quickly switch between
defined states with autocomplete.

States marked as done receive strikethrough styling on the task text.

Each state can be styled individually using the `data-task-state`
attribute, for example:

```space-style
[data-task-state=PLANNED] .sb-task-state {
  color: black;
  background-color: orange;
}
```

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

* Keep the current task state visible while the dropdown picker is open

Keep the current task state visible while the dropdown picker is open by
disabling built-in filtering and handling it manually — when the state
text exactly matches a known state all options are shown, otherwise
results are filtered by what the user has typed so far.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

* Added on-hover completion styling

* Fix: Show all defined task states in the dropdown when clicking the picker on an unrecognized state instead of showing an empty menu

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

---------

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
Co-authored-by: Zef Hemel <zef@zef.me>
2026-03-20 15:09:12 +01:00
Zef Hemel b204c07359 More sync edge case fixes 2026-03-20 14:31:12 +01:00
Zef Hemel d1570a6217 lint 2026-03-20 13:34:35 +01:00
Zef Hemel e527be8668 Optimizations to tree traversal and page indexes
* Added benchmark suites for both

Should all be behvior preserving
2026-03-20 13:25:28 +01:00
Matouš Jan FialkaandGitHub 8f7e525812 Fix mobile tasks, annoying caret jumping and empty widgets on navigation (#1890) 2026-03-17 22:16:58 +01:00
Matouš Jan FialkaandGitHub 4db49239a4 Fix extended task state widget click behavior in widgets (#1889)
* Fix extended task state widget click behavior in widgets

* Add mouse click handler on extended task state span to prevent
  CodeMirror from moving selection to widget source on normal click

* Let `Alt+Click` pass to parent div for the "cursor to source" behavior
  matching simple checkbox `Alt+Click` behavior

* Skip state cycling on `Alt+Click`

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

* Prevent task state corruption from concurrent cycling on mobile

On mobile, rapid taps on an enhanced task state (e.g. `[PLANNED]`) could
fire multiple events before the first `taskCycleAtPos` completed.  Add
a reentrancy guard to `taskCycleAtPos` so concurrent calls are dropped.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

---------

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-17 13:55:47 +01:00
Matouš Jan FialkaandGitHub a01b91b707 Resove merge conflict (#1884)
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-13 16:30:17 +01:00
Matouš Jan FialkaandGitHub 6d52350640 Fix extended task rendering in widgets (#1882)
* Fix extended task rendering in widgets

This patch addresses several issues.

1. Extended tasks like `[PLANNED]` or `[TODO]` were not rendering
   correctly when generated via widgets. The HTML renderer was producing
   plain text without brackets or proper styling, while simple `[x]`
   tasks worked fine.  The fix produces the same DOM structure as
   CodeMirror producing coherent styling everywhere.

2. Widget checkboxes are not interactive now. Since widget tasks have no
   backing state handler clicking them only caused a misleading visual
   toggle with no effect. The `disabled` attribute prevents this
   confusion and the dimmed appearanceit signals to the user that the
   checkbox is read-only in this context which is the truth.

To see it in action try the following Markdown snippet in SilverBullet:

```
- [x] #foo [att: i]
- [PLANNED] bar #bar [att: i]

${'- [x] #foo [att: i]\n- [PLANNED] bar #bar [att: i]'}
```

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

* Revert and just prevent widget checkboxes from toggling visually

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

* Support custom task states in widgets and indexer

Custom task states like `[PLANNED]` or `[IN PROGRESS]` now render
correctly in *widgets*, matching the same DOM structure as CodeMirror
uses in the editor. Widget-rendered tasks that reference a real task
(via `page@pos`) are fully interactive — clicking an extended state
cycles it through the configured states and updates the source task.
Tasks without a reference are disabled to prevent misleading visual
feedback.

The task indexer now respects the `done` flag on custom states defined
via `taskState.define`, so queries like `where not t.done` correctly
exclude tasks in states marked as done. Previously only the built-in
simple tasks (`- [x]` or `- [X]`) states were treated as completed. The
`Task: Remove Completed` command already handled custom done states and
continues to work unchanged.

State cycling now preserves the definition order from `taskState.define`
calls instead of sorting alphabetically. A new `order` field allows
explicit control over the cycle sequence. Without it, states cycle in
definition order. With it, states are sorted by the `order` field value.
This gives users full control over the progression, for example:

    PLANNED --> IN PROGRESS --> FINISHED

The `taskState.define` API now validates its input against a schema:
`name` (string, required), `done` (boolean, optional), and `order`
(number, optional).

The `expandMarkdown` no longer injects "fake" `page@pos` references into
tasks rendered via `widget.markdownBlock` or `widget.new` which was
causing broken links and unwanted interactivity on static task content.

The `task:stateChange` event is dispatched when toggling tasks from
widgets, ensuring Lua listeners (such as some custom completed timestamp
management) fire correctly regardless of where the toggle originates.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>

---------

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-13 13:32:26 +01:00
Zef Hemel 19d3328647 lint fixes 2026-03-13 09:24:52 +01:00
Zef Hemel 9581433cd3 Fixes #212: adds footnote support
Based on https://www.markdownlang.com/extended/footnotes.html

* Both "official" [^1] and [^1]: def
* And inline ^[My foot note]

Features:
* Properly parsed in markdown parser
* Syntax highlighting
* Live Preview to ... when on-hover preview of content, on-click moves
  cursor to definition
* Reference completion
* Invalid references are marked
2026-03-13 08:28:43 +01:00
Zef Hemel c2d42849a9 A few more format and type fixes 2026-03-10 09:42:48 +01:00