import SpacedUpdate from "../../services/spaced_update.js";
import AbstractSearchAction from "./abstract_search_action.js";
import noteAutocompleteService from "../../services/note_autocomplete.js";
const TPL = `
|
|
`;
export default class MoveNoteSearchAction extends AbstractSearchAction {
static get actionName() { return "moveNote"; }
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;
}
}