0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-05-07 20:58:40 +00:00

fix snippets

This commit is contained in:
Víctor Losada Hernández
2026-04-13 17:50:52 +02:00
parent 6c51e6b711
commit 150c9de6fb
2 changed files with 4 additions and 14 deletions
+3 -13
View File
@@ -355,21 +355,11 @@ const CodeEditor = forwardRef(
injectText : (text)=>{
const view = viewRef.current;
const changes = view.state.selection.ranges.map((range)=>({
from : range.from,
to : range.to,
insert : text
}));
const newRanges = view.state.selection.ranges.map((range)=>({
anchor : range.from + text.length
}));
view.dispatch({
changes,
selection : { ranges: newRanges }
});
view.dispatch(
view.state.replaceSelection(text)
);
view.focus();
},
getCursorPosition : ()=>viewRef.current.state.selection.main.head,