Checkpoint current interactive fiction changes
This commit is contained in:
@@ -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, '<')
|
||||
.replace(/>/g, '>');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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');
|
||||
|
||||
Reference in New Issue
Block a user