import { t } from "../../../services/i18n.js"; import SpacedUpdate from "../../../services/spaced_update.js"; import AbstractBulkAction from "../abstract_bulk_action.js"; import noteAutocompleteService from "../../../services/note_autocomplete.js"; const TPL = /*html*/`
${t("move_note.move_note")}
${t("move_note.to")}
`; export default class MoveNoteBulkAction extends AbstractBulkAction { static get actionName() { return "moveNote"; } static get actionTitle() { return t("move_note.move_note"); } doRender() { const $action = $(TPL); const $targetParentNote = $action.find(".target-parent-note"); noteAutocompleteService.initNoteAutocomplete($targetParentNote); $targetParentNote.setNote(this.actionDef.targetParentNoteId); $targetParentNote.on("autocomplete:closed", () => spacedUpdate.scheduleUpdate()); const spacedUpdate = new SpacedUpdate(async () => { await this.saveAction({ targetParentNoteId: $targetParentNote.getSelectedNoteId() }); }, 1000); $targetParentNote.on("input", () => spacedUpdate.scheduleUpdate()); return $action; } }