findwidget in read only notes WIP

This commit is contained in:
zadam
2022-05-25 23:38:06 +02:00
parent 37cb5f5e9a
commit f250b72563
13 changed files with 148 additions and 62 deletions

View File

@@ -0,0 +1,36 @@
// ck-find-result and ck-find-result_selected are the styles ck-editor
// uses for highlighting matches, use the same one on CodeMirror
// for consistency
import libraryLoader from "../services/library_loader.js";
import utils from "../services/utils.js";
const FIND_RESULT_SELECTED_CSS_CLASSNAME = "ck-find-result_selected";
const FIND_RESULT_CSS_CLASSNAME = "ck-find-result";
export default class FindInHtml {
constructor(parent) {
/** @property {FindWidget} */
this.parent = parent;
}
async getInitialSearchTerm() {
return ""; // FIXME
}
async performFind(searchTerm, matchCase, wholeWord) {
await libraryLoader.requireLibrary(libraryLoader.MARKJS);
const $content = await this.parent.noteContext.getContentElement();
$content.markRegExp(new RegExp(utils.escapeRegExp(searchTerm), "gi"));
}
async findNext(direction, currentFound, nextFound) {
}
async cleanup(totalFound, currentFound) {
}
async close() {
}
}