fix(code/find): crashes at dialog shown

This commit is contained in:
Elian Doran
2025-05-12 18:24:36 +03:00
parent ac49c0f59b
commit f20232c077
3 changed files with 14 additions and 2 deletions

View File

@@ -104,6 +104,17 @@ export default class CodeMirror extends EditorView {
return this.state.doc.toString();
}
/**
* Returns the currently selected text.
*
* If there are multiple selections, all of them will be concatenated.
*/
getSelectedText() {
return this.state.selection.ranges
.map((range) => this.state.sliceDoc(range.from, range.to))
.join("");
}
setText(content: string) {
this.dispatch({
changes: {