fix: Append panel directly to body for proper flexbox layout

- Changed from $('#sheld').after/before() to $('body').append()
- Panel is now a direct child of body element
- Works better with SillyTavern's main flexbox layout
- CSS handles all positioning (no more DOM position logic)
This commit is contained in:
Spicy_Marinara
2025-10-14 14:10:02 +02:00
parent 0926390205
commit d98ecce5c3
+5 -9
View File
@@ -299,14 +299,10 @@ async function initUI() {
// Load the HTML template using SillyTavern's template system // Load the HTML template using SillyTavern's template system
const templateHtml = await renderExtensionTemplateAsync(extensionName, 'template'); const templateHtml = await renderExtensionTemplateAsync(extensionName, 'template');
// Add to the appropriate container based on position // Append panel to body - positioning handled by CSS
if (extensionSettings.panelPosition === 'right') { $('body').append(templateHtml);
// Add as a sidebar next to the chat area (sheld)
$('#sheld').after(templateHtml); // Cache UI elements
} else {
// Add above the chat area
$('#sheld').before(templateHtml);
} // Cache UI elements
$panelContainer = $('#rpg-companion-panel'); $panelContainer = $('#rpg-companion-panel');
$userStatsContainer = $('#rpg-user-stats'); $userStatsContainer = $('#rpg-user-stats');
$infoBoxContainer = $('#rpg-info-box'); $infoBoxContainer = $('#rpg-info-box');
@@ -1105,7 +1101,7 @@ function generateTrackerInstructions(includeHtmlPrompt = true, includeContinuati
instructions += '```\n'; instructions += '```\n';
instructions += 'Present Characters\n'; instructions += 'Present Characters\n';
instructions += '---\n'; instructions += '---\n';
instructions += `[Present Character's Emoji (do not include ${userName}; state "Unavailable" if no NPCs are present in the scene)]: [Name, Visible Physical State (up to three traits), Observable Demeanor Cue (one trait)] | [Enemy/Neutral/Friend/Lover] | [Internal Monologue (in first person POV, up to three sentences long)]\n`; instructions += `[Present Character's Emoji (do not include ${userName}; state "Unavailable" if no major characters are present in the scene)]: [Name, Visible Physical State (up to three traits), Observable Demeanor Cue (one trait)] | [Enemy/Neutral/Friend/Lover] | [Internal Monologue (in first person POV, up to three sentences long)]\n`;
instructions += '```\n\n'; instructions += '```\n\n';
} }