Add logging for prompt manager position changes

This commit is contained in:
maver 2023-07-01 20:41:49 +02:00
parent 9558483669
commit 28217adac6
1 changed files with 8 additions and 0 deletions

View File

@ -959,6 +959,14 @@ PromptManagerModule.prototype.makeDraggable = function () {
const newIndex = originIndex < targetIndex ? (insertAfter ? targetIndex : targetIndex - 1) : (insertAfter ? targetIndex + 1 : targetIndex); const newIndex = originIndex < targetIndex ? (insertAfter ? targetIndex : targetIndex - 1) : (insertAfter ? targetIndex + 1 : targetIndex);
promptList.splice(newIndex, 0, entry); promptList.splice(newIndex, 0, entry);
if (power_user.console_log_prompts) {
// For debugging purpose, fetch the actual position instead of using calculations.
const targetDebug = promptList.findIndex(prompt => prompt.identifier === target.dataset.pmIdentifier);
const originDebug = promptList.findIndex(prompt => prompt.identifier === origin.dataset.pmIdentifier);
this.log(`Moved ${origin.dataset.pmIdentifier} from position ${originIndex + 1} to position ${originDebug + 1} ${direction} ${target.dataset.pmIdentifier}, which now has position ${targetDebug + 1}`);
}
this.saveServiceSettings(); this.saveServiceSettings();
}; };