diff --git a/assets/controllers/quill_controller.js b/assets/controllers/quill_controller.js index 2828c46..6f945f6 100644 --- a/assets/controllers/quill_controller.js +++ b/assets/controllers/quill_controller.js @@ -157,6 +157,30 @@ export default class extends Controller { imageTooltip.edit(prefill); }); + + // Nostr highlights + // Match common bech32 nostr URIs + const NOSTR_GLOBAL = /\bnostr:(?:note1|npub1|nprofile1|nevent1|naddr1|nrelay1|nsec1)[a-z0-9]+/gi; + + function highlightAll() { + const text = quill.getText(); // includes trailing \n + // Clear JUST the background attribute; leaves bold/italics/etc intact + quill.formatText(0, text.length, { background: false }, 'api'); + + for (const m of text.matchAll(NOSTR_GLOBAL)) { + quill.formatText(m.index, m[0].length, { background: 'rgba(168, 85, 247, 0.18)' }, 'api'); + } + } + + // 1) First load + highlightAll(); + + // 2) Keep it fresh on edits/paste + quill.on('text-change', (delta, oldDelta, source) => { + if (source === 'user') highlightAll(); + }); + + // Keep your hidden field synced as HTML const sync = () => { if (target) target.value = quill.root.innerHTML; }; quill.on('text-change', sync); diff --git a/assets/styles/02-layout/layout.css b/assets/styles/02-layout/layout.css index cddb45a..70128ed 100644 --- a/assets/styles/02-layout/layout.css +++ b/assets/styles/02-layout/layout.css @@ -20,7 +20,7 @@ body { margin: 0 auto; flex-grow: 1; display: grid; - grid-template-columns: 200px auto 200px; + grid-template-columns: 240px auto 350px; } nav, aside { diff --git a/assets/styles/03-components/article.css b/assets/styles/03-components/article.css index 70b0c61..43dc5cb 100644 --- a/assets/styles/03-components/article.css +++ b/assets/styles/03-components/article.css @@ -79,7 +79,7 @@ blockquote p { .heading-permalink { float: left; padding-right: 0; - margin-left: calc(var(--spacing-5) * -1); + margin-left: calc(var(--spacing-4) * -1); line-height: 1.2; color: var(--color-secondary); } diff --git a/assets/styles/03-components/form.css b/assets/styles/03-components/form.css index 7486941..474a2ba 100644 --- a/assets/styles/03-components/form.css +++ b/assets/styles/03-components/form.css @@ -79,6 +79,8 @@ input:focus, textarea:focus, select:focus { #editor { margin: 0; + min-height: 300px; + font-size: 120%; } button:disabled { diff --git a/src/Controller/ArticleController.php b/src/Controller/ArticleController.php index d97e626..ec37ee8 100644 --- a/src/Controller/ArticleController.php +++ b/src/Controller/ArticleController.php @@ -169,6 +169,15 @@ class ArticleController extends AbstractController $currentPubkey = $key->convertToHex($user->getUserIdentifier()); $recentArticles = $entityManager->getRepository(Article::class) ->findBy(['pubkey' => $currentPubkey, 'kind' => KindsEnum::LONGFORM], ['createdAt' => 'DESC'], 5); + // Collapse by slug, keep only latest revision + $recentArticles = array_reduce($recentArticles, function ($carry, $item) { + if (!isset($carry[$item->getSlug()])) { + $carry[$item->getSlug()] = $item; + } + return $carry; + }); + $recentArticles = array_values($recentArticles); + // get drafts $drafts = $entityManager->getRepository(Article::class) ->findBy(['pubkey' => $currentPubkey, 'kind' => KindsEnum::LONGFORM_DRAFT], ['createdAt' => 'DESC'], 5); diff --git a/templates/pages/article.html.twig b/templates/pages/article.html.twig index 464b158..49acad5 100644 --- a/templates/pages/article.html.twig +++ b/templates/pages/article.html.twig @@ -31,7 +31,7 @@
diff --git a/templates/pages/editor.html.twig b/templates/pages/editor.html.twig index 424c47f..b1dd41d 100644 --- a/templates/pages/editor.html.twig +++ b/templates/pages/editor.html.twig @@ -93,7 +93,7 @@ {% if is_granted('ROLE_USER') %}