mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into timed-wi
This commit is contained in:
@@ -4854,7 +4854,7 @@
|
|||||||
<div class="popup-content">
|
<div class="popup-content">
|
||||||
<h3 class="popup-header">text</h3>
|
<h3 class="popup-header">text</h3>
|
||||||
</div>
|
</div>
|
||||||
<textarea class="popup-input text_pole result-control" rows="1" data-result="1"></textarea>
|
<textarea class="popup-input text_pole result-control" rows="1" data-result="1" data-result-event="submit"></textarea>
|
||||||
<div class="popup-controls">
|
<div class="popup-controls">
|
||||||
<div class="popup-button-ok menu_button result-control" data-result="1" data-i18n="Delete">Delete</div>
|
<div class="popup-button-ok menu_button result-control" data-result="1" data-i18n="Delete">Delete</div>
|
||||||
<div class="popup-button-cancel menu_button result-control" data-result="0" data-i18n="Cancel">Cancel</div>
|
<div class="popup-button-cancel menu_button result-control" data-result="0" data-i18n="Cancel">Cancel</div>
|
||||||
|
@@ -69,7 +69,7 @@ const showPopupHelper = {
|
|||||||
const value = await popup.show();
|
const value = await popup.show();
|
||||||
return value ? String(value) : null;
|
return value ? String(value) : null;
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
export class Popup {
|
export class Popup {
|
||||||
/** @type {POPUP_TYPE} */ type;
|
/** @type {POPUP_TYPE} */ type;
|
||||||
@@ -188,6 +188,7 @@ export class Popup {
|
|||||||
case POPUP_TYPE.DISPLAY: {
|
case POPUP_TYPE.DISPLAY: {
|
||||||
this.controls.style.display = 'none';
|
this.controls.style.display = 'none';
|
||||||
this.closeButton.style.display = 'block';
|
this.closeButton.style.display = 'block';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
console.warn('Unknown popup type.', type);
|
console.warn('Unknown popup type.', type);
|
||||||
@@ -216,7 +217,7 @@ export class Popup {
|
|||||||
this.dlg.addEventListener('focusin', (evt) => { if (evt.target instanceof HTMLElement && evt.target != this.dlg) this.lastFocus = evt.target; });
|
this.dlg.addEventListener('focusin', (evt) => { if (evt.target instanceof HTMLElement && evt.target != this.dlg) this.lastFocus = evt.target; });
|
||||||
|
|
||||||
// Bind event listeners for all result controls to their defined event type
|
// Bind event listeners for all result controls to their defined event type
|
||||||
this.dlg.querySelectorAll(`[data-result]`).forEach(resultControl => {
|
this.dlg.querySelectorAll('[data-result]').forEach(resultControl => {
|
||||||
if (!(resultControl instanceof HTMLElement)) return;
|
if (!(resultControl instanceof HTMLElement)) return;
|
||||||
const result = Number(resultControl.dataset.result);
|
const result = Number(resultControl.dataset.result);
|
||||||
if (isNaN(result)) throw new Error('Invalid result control. Result must be a number. ' + resultControl.dataset.result);
|
if (isNaN(result)) throw new Error('Invalid result control. Result must be a number. ' + resultControl.dataset.result);
|
||||||
@@ -284,7 +285,7 @@ export class Popup {
|
|||||||
|
|
||||||
runAfterAnimation(this.dlg, () => {
|
runAfterAnimation(this.dlg, () => {
|
||||||
this.dlg.removeAttribute('opening');
|
this.dlg.removeAttribute('opening');
|
||||||
})
|
});
|
||||||
|
|
||||||
this.promise = new Promise((resolve) => {
|
this.promise = new Promise((resolve) => {
|
||||||
this.resolver = resolve;
|
this.resolver = resolve;
|
||||||
@@ -431,7 +432,7 @@ export class Popup {
|
|||||||
getTopmostModalLayer() {
|
getTopmostModalLayer() {
|
||||||
return getTopmostModalLayer();
|
return getTopmostModalLayer();
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
class PopupUtils {
|
class PopupUtils {
|
||||||
|
@@ -7,7 +7,6 @@ import { FILTER_TYPES, FilterHelper } from './filters.js';
|
|||||||
import { getTokenCountAsync } from './tokenizers.js';
|
import { getTokenCountAsync } from './tokenizers.js';
|
||||||
import { power_user } from './power-user.js';
|
import { power_user } from './power-user.js';
|
||||||
import { getTagKeyForEntity } from './tags.js';
|
import { getTagKeyForEntity } from './tags.js';
|
||||||
import { resolveVariable } from './variables.js';
|
|
||||||
import { debounce_timeout } from './constants.js';
|
import { debounce_timeout } from './constants.js';
|
||||||
import { getRegexedString, regex_placement } from './extensions/regex/engine.js';
|
import { getRegexedString, regex_placement } from './extensions/regex/engine.js';
|
||||||
import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';
|
import { SlashCommandParser } from './slash-commands/SlashCommandParser.js';
|
||||||
@@ -851,7 +850,7 @@ function registerWorldInfoSlashCommands() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function findBookEntryCallback(args, value) {
|
async function findBookEntryCallback(args, value) {
|
||||||
const file = resolveVariable(args.file);
|
const file = args.file;
|
||||||
const field = args.field || 'key';
|
const field = args.field || 'key';
|
||||||
|
|
||||||
const entries = await getEntriesFromFile(file);
|
const entries = await getEntriesFromFile(file);
|
||||||
@@ -895,7 +894,7 @@ function registerWorldInfoSlashCommands() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getEntryFieldCallback(args, uid) {
|
async function getEntryFieldCallback(args, uid) {
|
||||||
const file = resolveVariable(args.file);
|
const file = args.file;
|
||||||
const field = args.field || 'content';
|
const field = args.field || 'content';
|
||||||
|
|
||||||
const entries = await getEntriesFromFile(file);
|
const entries = await getEntriesFromFile(file);
|
||||||
@@ -930,7 +929,7 @@ function registerWorldInfoSlashCommands() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createEntryCallback(args, content) {
|
async function createEntryCallback(args, content) {
|
||||||
const file = resolveVariable(args.file);
|
const file = args.file;
|
||||||
const key = args.key;
|
const key = args.key;
|
||||||
|
|
||||||
const data = await loadWorldInfoData(file);
|
const data = await loadWorldInfoData(file);
|
||||||
@@ -959,8 +958,8 @@ function registerWorldInfoSlashCommands() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function setEntryFieldCallback(args, value) {
|
async function setEntryFieldCallback(args, value) {
|
||||||
const file = resolveVariable(args.file);
|
const file = args.file;
|
||||||
const uid = resolveVariable(args.uid);
|
const uid = args.uid;
|
||||||
const field = args.field || 'content';
|
const field = args.field || 'content';
|
||||||
|
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
|
Reference in New Issue
Block a user