Commit Graph
693 Commits
Author SHA1 Message Date
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
Zef Hemel 799e27a9b4 Enable biome based formatter and reformat 2026-03-10 09:38:59 +01:00
Zef Hemel cce5b669f6 Merge branch 'main' into to-node 2026-03-10 08:57:58 +01:00
Zef Hemel a59fb566ae Add table row support also to outline commands
As requested in #1051
2026-03-09 14:58:02 +01:00
Zef Hemel dbe9e702aa Thorough redo of the outline operation commands
Fixes #606 and #908 improves #1051,
2026-03-09 14:52:06 +01:00
Zef Hemel 6ad4878748 Fixes #1722 (clean completed tasks)
Refactors logic to be more testable. Now handles more scenarios.
2026-03-08 16:11:14 +01:00
Zef Hemel bbcd9ac6aa Introduce new noFloatingPromises lint rule and fix violiations 2026-03-08 15:49:45 +01:00
Zef Hemel 5c9dba30de Merge branch 'main' into to-node 2026-03-06 14:37:03 +01:00
Matouš Jan Fialka 81f5ec7f67 Fix table cell alignment for missing and misaligned cells
The table style is determined by the header row. After normalizing the
header (filling empty cells between consecutive delimiters), extract
two properties: the column count and whether the header starts with
a delimiter.

For each data row, normalization proceeds in three steps. First, fill in
empty cells between consecutive delimiters (this handles empty cells in
the middle of a row). Second, if the header has no leading delimiter but
the row does, insert an empty cell after the row's leading delimiter (this
corrects the one-position shift caused by the row having a leading pipe
that the header lacks. Third, if the row has fewer cells than the header
column count, pad with empty cells at the end (this handles rows that
are shorter than the header because trailing pipes or cells were
omitted).

The same normalization is applied both in the renderer and the indexer.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-06 14:20:48 +01:00
Zef Hemel d6424b714a Merge branch 'main' into to-node 2026-03-06 13:38:23 +01:00
Matouš Jan FialkaandGitHub b5fadf4dc2 Merge branch 'silverbulletmd:main' into fix-table-indexer-empty-cells 2026-03-06 08:58:08 +01:00
Matouš Jan Fialka 9b37060d9f Extract normalizer to helper shared by both parser and renderer
Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-06 08:45:16 +01:00
Zef HemelandGitHub eaa85a990a Merge pull request #1870 from mjf/fix-table-indexer-empty-cells
Fix table indexer shifting columns when cells are empty
2026-03-06 08:37:09 +01:00
Zef Hemel 9db8d822f7 Fixes #1850 2026-03-06 08:31:53 +01:00
Matouš Jan Fialka c4c0c64fb5 Fix table indexer shifting columns when cells are empty (final)
The Markdown parser omits `TableCell` nodes for empty cells, so
`collectNodesOfType` returns fewer cells than columns.

The indexer mapped cells to headers by array index, causing all cells
after an empty one to shift left.

The HTML renderer already solved this: its `TableRow` case walks the
children and injects empty `TableCell` nodes between consecutive
`TableDelimiter` nodes with no cell in between.

This patch extracts that same normalization logic into a reusable
`normalizeTableRow` helper and applies it to each row before collecting
cells.

The original index-based cell-to-header mapping then works correctly
without any positional arithmetic. I feel like this is more elegant
solution to the issue.

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-06 08:16:26 +01:00
Zef Hemel dbf275d75b Introduce biome as linter with lint fixes 2026-03-06 08:05:13 +01:00
Matouš Jan Fialka 9e4f5f7bc6 Fix table indexer shifting columns when cells are empty
For example, with the following table:

```markdown
| a   | b   | c   |
| --- | --- | --- |
| 1   |     | 3   |
| 1   | 2   | 3   |
| a   | b   | c   |
| a   | b   |     |
|     | b   | c   |
| x   |     |     |
|     |     | z   |
```

the following query results in dataset with shifted columns
when cells are empty:

```lua
from
  index.tag 'table'
where
  page == 'test'
order by
  pos asc
select {
  a, b, c
}
```

This is now fixed and gives correct results:

|0 |1 |2 |
|--|--|--|
|1 |  |3 |
|1 |2 |3 |
|a |b |c |
|a |b |  |
|  |b |c |
|x |  |  |
|  |  |z |

Signed-off-by: Matouš Jan Fialka <mjf@mjf.cz>
2026-03-06 07:56:21 +01:00
Zef Hemel 9d39c8b1b8 Merge branch 'main' into to-node 2026-03-05 16:26:16 +01:00
Zef Hemel 17418fd7ec Pull reported client version number from system.getVersion() 2026-03-05 15:07:25 +01:00
Zef Hemel 380b5d90ca More Deno cleanup 2026-02-27 16:25:34 +01:00
Zef Hemel 803c5c478d Merge remote-tracking branch 'origin/main' into to-node 2026-02-27 15:05:49 +01:00
Zef HemelandGitHub 0f3f963de0 Merge pull request #1833 from rktjmp/feat-upload-no-clobber
Dont clobber existing files when uploading
2026-02-26 09:28:27 +01:00
Oliver Marriott 274780e5e1 Match await flashNotification usage to existing code 2026-02-26 14:56:51 +11:00
Oliver Marriott ea590f8e27 Formatter 2026-02-26 14:27:25 +11:00
Oliver Marriott 9467e8af26 Convert arrow functions to regular function decls 2026-02-26 14:27:14 +11:00
rktjmpandGitHub f4bd2c3abc Trim user input from prompts where appropriate (#1854)
* Trim user input from prompts where appropriate

* Run formatter

* Use "page title" language instead of "page name" in notifications.

Existing language in prompt asks for a "page title".

* Use const for prefix inputs as they are never trimmed
2026-02-25 10:16:37 +01:00
Oliver Marriott db6f16fa6f Fix typing 2026-02-25 00:00:04 +11:00
Oliver Marriott 037e69c889 Add no-clobber behaviour to paste uploads 2026-02-25 00:00:04 +11:00
Oliver Marriott f22c1ce15c Check user input for null, trim otherwise 2026-02-25 00:00:04 +11:00
Oliver Marriott d8f0a7488b Prompt user before replacing files when using Upload file command 2026-02-25 00:00:04 +11:00
Zef Hemel 99bbb37ff0 Fix make check 2026-02-15 08:35:06 +01:00
Zef Hemel 02bd8ed362 Migration Deno -> Node.js
* First pass
* Now using vitest for tests
2026-02-14 22:08:35 +01:00
Zef Hemel ab9965a629 Revert removal of item's toPos 2026-02-12 11:06:20 +01:00
Zef Hemel dcf4f126e6 Fix docker builds 2026-02-06 14:49:20 +01:00
Zef Hemel 40895adc63 Enhance link indexing to support additional link types
* New "type" attribute for links (page, file, url)
* Now indexes external links as well
2026-02-05 09:24:38 +01:00
Zef Hemel 0773df31e2 Add validation and error handling for object indexing
- Introduced a new `validate` callback for `tag.define`
- Added `index.validateObjects` API to validate and transform objects before indexing.
- Updated relevant documentation and examples to reflect these changes.
2026-02-03 15:59:04 +01:00
Zef Hemel dbf95f7fe2 Fix lint 2026-02-03 09:50:25 +01:00
Zef Hemel 9057702557 Merge Client: Clean into Client: Wipe and remove Client: Clean
Client: Wipe now also deletes redundant other databases.

Related to #1798
2026-02-03 09:48:01 +01:00
Zef Hemel b8b1fb52bb Changes UI progress update logic
Introduced a maximum observed queue size to improve progress percentage calculation, no more "67" fallback value.

Part of #1798
2026-02-03 08:56:41 +01:00
Zef Hemel 9667916c9c Adds "Page: Create Under Cursor" command
Command that allows creating a new page based on the wiki link under the
cursor.
2026-02-02 17:00:56 +01:00
Zef Hemel 0da5d97284 Refactor navigation commands and enhance page renaming logic
* Modified renamePage function in refactor.ts to ensure navigation to the new page occurs after the index queue is processed, so that linked mentions reflect updated data once arriving there
2026-02-02 16:40:58 +01:00
Zef Hemel 13b17110eb Order Linked Mentions by page last modified (desc)
* Adds `pageLastModified` to `link` objects, and use it for Linked
  Mentions
2026-01-30 08:33:32 +01:00
Zef Hemel c2d7dfbdf8 Exclude .plug.js and .js.map files from document picker (messy). 2026-01-29 14:29:52 +01:00
Zef Hemel a018e7c1f5 Remove Plugs: Update keyboard shortcut
Part of slow deprecation of the plug manager (in favor of the newer
Library manager)
2026-01-29 14:29:18 +01:00