Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 5c8d3f9

Browse files
authored
Merge pull request #1933 from TriliumNext/codemirror_find
fix(find): readonly code getSelection
2 parents d1607dc + 05f4419 commit 5c8d3f9

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

apps/client/src/widgets/find.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,8 @@ export default class FindWidget extends NoteContextAwareWidget {
198198

199199
let selectedText = "";
200200
if (this.note?.type === "code" && this.noteContext) {
201-
if (isReadOnly){
202-
const $content = await this.noteContext.getContentElement();
203-
selectedText = $content.find('.cm-matchhighlight').first().text();
204-
} else {
205-
const codeEditor = await this.noteContext.getCodeEditor();
206-
selectedText = codeEditor.getSelectedText();
207-
}
201+
const codeEditor = await this.noteContext.getCodeEditor();
202+
selectedText = codeEditor.getSelectedText();
208203
} else {
209204
selectedText = window.getSelection()?.toString() || "";
210205
}

0 commit comments

Comments
 (0)