Merge branch 'master' into next61

# Conflicts:
#	package-lock.json
#	package.json
#	src/public/app/components/note_context.js
#	src/public/app/services/open.js
#	src/public/app/widgets/buttons/note_actions.js
#	src/public/app/widgets/find_in_code.js
#	src/public/app/widgets/type_widgets/canvas.js
#	src/services/options.js
This commit is contained in:
zadam
2023-05-20 20:55:57 +02:00
18 changed files with 122 additions and 141 deletions

View File

@@ -146,20 +146,31 @@ export default class FindWidget extends NoteContextAwareWidget {
return;
}
this.handler = await this.getHandler();
const selectedText = window.getSelection().toString() || "";
this.$findBox.show();
this.$input.focus();
this.handler = await this.getHandler();
const isAlreadyVisible = this.$findBox.is(":visible");
if (isAlreadyVisible) {
if (selectedText) {
this.$input.val(selectedText);
}
if (this.$input.val()) {
await this.performFind();
}
this.$input.select();
} else {
this.$totalFound.text(0);
this.$currentFound.text(0);
const searchTerm = await this.handler.getInitialSearchTerm();
this.$input.val(searchTerm || "");
if (searchTerm !== "") {
this.$input.val(selectedText);
if (selectedText) {
this.$input.select();
await this.performFind();
}