Format slide texts in WhatsApp style
Slide descriptions support *bold*, _italic_, ~strikethrough~ and lists with "- " or "* " at the start of a line. FormatHelper renders them for the participant page and the PDF (escaping everything else), Format in plenario.js builds the same DOM for presenter and embed. Participant input stays plain text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3465f69bfc
commit
8d3d8d4341
12 files changed
+215
-8
No files matched your search
@@ -78,7 +78,7 @@ $bar = function (float $percent, bool $ok = false): string {
|
||||
</p>
|
||||
<h2><?= h($slide->question) ?></h2>
|
||||
<?php if ($slide->description) : ?>
|
||||
<p class="muted"><?= nl2br(h($slide->description)) ?></p>
|
||||
<div class="muted formatted"><?= $this->Format->text($slide->description) ?></div>
|
||||
<?php endif; ?>
|
||||
<p class="muted"><?= __n('{0} Person hat teilgenommen', '{0} Personen haben teilgenommen', $participants, $participants) ?></p>
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ $host = preg_replace('#^https?://#', '', $joinBaseUrl);
|
||||
<main class="stage__main">
|
||||
<p class="stage__status" data-status></p>
|
||||
<h1 class="stage__question" data-question><?= __('Lade …') ?></h1>
|
||||
<p class="stage__description" data-description></p>
|
||||
<div class="stage__description formatted" data-description></div>
|
||||
<div class="stage__media" data-media hidden></div>
|
||||
<div class="stage__results" data-results></div>
|
||||
</main>
|
||||
|
||||
@@ -40,7 +40,7 @@ $host = preg_replace('#^https?://#', '', $joinBaseUrl);
|
||||
<main class="stage__main">
|
||||
<p class="stage__status" data-status></p>
|
||||
<h1 class="stage__question" data-question><?= h($slide->question) ?></h1>
|
||||
<p class="stage__description" data-description></p>
|
||||
<div class="stage__description formatted" data-description></div>
|
||||
<div class="stage__media" data-media hidden></div>
|
||||
<div class="stage__results" data-results></div>
|
||||
</main>
|
||||
|
||||
@@ -66,7 +66,7 @@ $countdown = function (?int $remaining): string {
|
||||
<p class="eyebrow"><?= __('Video') ?></p>
|
||||
<h1><?= h($slide->question) ?></h1>
|
||||
<?php if ($slide->description) : ?>
|
||||
<div class="prose"><?= nl2br(h($slide->description)) ?></div>
|
||||
<div class="prose formatted"><?= $this->Format->text($slide->description) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($watchUrl !== null) : ?>
|
||||
<p class="video-link">
|
||||
@@ -87,7 +87,7 @@ $countdown = function (?int $remaining): string {
|
||||
<section class="card">
|
||||
<h1><?= h($slide->question) ?></h1>
|
||||
<?php if ($slide->description) : ?>
|
||||
<div class="prose"><?= nl2br(h($slide->description)) ?></div>
|
||||
<div class="prose formatted"><?= $this->Format->text($slide->description) ?></div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
@@ -95,7 +95,7 @@ $countdown = function (?int $remaining): string {
|
||||
<section class="card">
|
||||
<h1 class="question"><?= h($slide->question) ?></h1>
|
||||
<?php if ($slide->description) : ?>
|
||||
<p class="muted"><?= nl2br(h($slide->description)) ?></p>
|
||||
<div class="muted formatted"><?= $this->Format->text($slide->description) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($quiz !== null) : ?>
|
||||
|
||||
@@ -111,7 +111,9 @@ $optionsError = $slide->getError('options_text');
|
||||
'type' => 'textarea',
|
||||
'rows' => $slide->type === 'content' ? 6 : 2,
|
||||
'label' => $slide->type === 'content' ? __('Text') : __('Beschreibung (optional)'),
|
||||
'aria-describedby' => 'description-format',
|
||||
]) ?>
|
||||
<p class="hint" id="description-format"><?= __('Formatierung wie bei WhatsApp: *fett*, _kursiv_, ~durchgestrichen~, Aufzählung mit „- “ am Zeilenanfang.') ?></p>
|
||||
|
||||
<?php if ($slide->type === 'choice') : ?>
|
||||
<div class="input textarea<?= $optionsError ? ' error' : '' ?>">
|
||||
|
||||
@@ -48,6 +48,9 @@
|
||||
.stat { font-size: 12pt; font-weight: bold; }
|
||||
td.stars { color: #c27c00; letter-spacing: 1pt; }
|
||||
.empty { color: #5d6280; font-style: italic; }
|
||||
/* slide texts with *bold*, _italic_, ~strike~ and lists (FormatHelper) */
|
||||
.formatted { margin: 0 0 2mm; }
|
||||
.formatted ul { margin: 1mm 0; padding-left: 6mm; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in new issue
Block a user