Changeset 0.25.2 (#162)
This commit is contained in:
@@ -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 },
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user