mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-02 10:55:53 +08:00
Merge pull request #1933 from TriliumNext/codemirror_find
fix(find): readonly code getSelection
This commit is contained in:
commit
5c8d3f9c51
@ -198,13 +198,8 @@ export default class FindWidget extends NoteContextAwareWidget {
|
||||
|
||||
let selectedText = "";
|
||||
if (this.note?.type === "code" && this.noteContext) {
|
||||
if (isReadOnly){
|
||||
const $content = await this.noteContext.getContentElement();
|
||||
selectedText = $content.find('.cm-matchhighlight').first().text();
|
||||
} else {
|
||||
const codeEditor = await this.noteContext.getCodeEditor();
|
||||
selectedText = codeEditor.getSelectedText();
|
||||
}
|
||||
} else {
|
||||
selectedText = window.getSelection()?.toString() || "";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user