mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
feat: render actual elements in markdown cheatsheet instead of labels
Replace text labels (h1, bold, italic) with rendered HTML in the Rendu column: headings, strong, em, del, code, links, blockquote, lists, hr, sup, small
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
hx-target="#toast-region">
|
||||
</aside>
|
||||
|
||||
<!-- Markdown cheatsheet container (filled by HTMX on demand) -->
|
||||
<div id="md-cheatsheet-container"></div>
|
||||
|
||||
<?php foreach ($extraJs ?? [] as $js): ?>
|
||||
<script src="<?= App::assetV($js) ?>"></script>
|
||||
<?php endforeach; ?>
|
||||
@@ -30,6 +33,19 @@ document.body.addEventListener('htmx:afterSettle', function (e) {
|
||||
if (warn) { warn.setAttribute('tabindex', '-1'); warn.focus(); }
|
||||
}
|
||||
});
|
||||
|
||||
// Markdown cheatsheet: close on backdrop click, remove stale dialogs before new one arrives
|
||||
document.body.addEventListener('htmx:beforeRequest', function(e) {
|
||||
if (e.detail.requestConfig && e.detail.requestConfig.path === '/admin/markdown-cheatsheet-fragment.php') {
|
||||
var old = document.getElementById('md-cheatsheet-dialog');
|
||||
if (old) old.remove();
|
||||
}
|
||||
});
|
||||
document.body.addEventListener('click', function(e) {
|
||||
if (e.target.tagName === 'DIALOG' && e.target.id === 'md-cheatsheet-dialog') {
|
||||
e.target.close();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user