Checkpoint current interactive fiction changes

This commit is contained in:
2026-06-03 12:59:43 +02:00
parent 61127c0a92
commit bccefd2a68
11 changed files with 342 additions and 895 deletions
+17 -4
View File
@@ -11,7 +11,7 @@ class UIDisplayHandlerModule extends BaseModule {
super('ui-display-handler', 'UI Display Handler');
// Module dependencies
this.dependencies = ['layout-renderer', 'playback-coordinator', 'game-config', 'localization', 'story-history', 'sentence-queue', 'persistence-manager'];
this.dependencies = ['layout-renderer', 'playback-coordinator', 'game-config', 'localization', 'story-history', 'sentence-queue', 'persistence-manager', 'markup-parser'];
// DOM elements
this.container = null;
@@ -146,7 +146,8 @@ class UIDisplayHandlerModule extends BaseModule {
'displayNextNotification',
'queueTerminalNotification',
'flushTerminalNotifications',
'closeNotification'
'closeNotification',
'renderInlineMarkup'
]);
console.log('UIDisplayHandler: Constructor initialized');
@@ -906,8 +907,8 @@ class UIDisplayHandlerModule extends BaseModule {
}
modal.dataset.kind = next.kind;
title.textContent = next.title;
message.textContent = next.message;
title.innerHTML = this.renderInlineMarkup(next.title);
message.innerHTML = this.renderInlineMarkup(next.message);
if (okButton) {
okButton.textContent = this.t('popup.ok');
setTimeout(() => okButton.focus(), 0);
@@ -928,6 +929,17 @@ class UIDisplayHandlerModule extends BaseModule {
this.notificationActive = false;
setTimeout(() => this.displayNextNotification(), 0);
}
renderInlineMarkup(text) {
const markupParser = this.getModule('markup-parser');
if (markupParser && typeof markupParser.markdownToHtml === 'function') {
return markupParser.markdownToHtml(String(text || ''));
}
return String(text || '')
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}
/**
* Measure text width using canvas
@@ -1470,6 +1482,7 @@ class UIDisplayHandlerModule extends BaseModule {
handleHistoryWheel(event) {
if (!event.target?.closest?.('#page_right') || !this.pageRight) return;
if (event.target?.closest?.('.story-choices')) return;
event.preventDefault();
event.stopPropagation();
this.handleManualScrollStart('wheel');