Changeset 0.25.2 (#162)

This commit is contained in:
2026-03-08 22:36:56 +00:00
parent b3f8b747dd
commit 6c484fa7f8
13 changed files with 240 additions and 151 deletions

View File

@@ -135,10 +135,12 @@ function wikilinkAutocomplete(linkCompleter) {
options: results.map(r => ({
label: r.label || r.title,
apply: (view, completion, from, to) => {
// Replace query text with completed title + closing ]]
// Check if ]] already exists after cursor (from closeBrackets auto-close)
const afterCursor = view.state.doc.sliceString(to, to + 2);
const endPos = afterCursor === ']]' ? to + 2 : to;
const insert = completion.label + ']]';
view.dispatch({
changes: { from, to, insert },
changes: { from, to: endPos, insert },
selection: { anchor: from + insert.length },
});
},