Changeset ff3b8ce in Klonkt for src/assets/js


Ignore:
Timestamp:
07/19/2026 11:36:33 PM (7 weeks ago)
Author:
Robin <roboburr@…>
Branches:
main
Children:
8ed65a6
Parents:
e9c9ae1
git-author:
Robin <roboburr@…> (07/19/2026 11:36:10 PM)
git-committer:
Robin <roboburr@…> (07/19/2026 11:36:33 PM)
Message:

Polish: reply editor styled as a sibling of the post editor (klonkt-demo-3dp)

The rich reply editor worked but looked ad-hoc. This is a visual pass, no
behavior change:

  • Toolbar: text glyphs (B/I/link/list/quote/paperclip) replaced with the post editor's Feather SVG icons; 32px buttons, transparent border, 6px radius, hover only on hover-capable devices, and an is-active accent-filled state reflecting the caret's formatting (bold/italic/list) via queryCommandState.
  • Editor box: framed with a rule border and an accent focus ring, tidy paragraph/list/blockquote/link spacing.
  • Footer, language select, mentions chips and attachment chips restyled to the same rule/paper/accent tokens; the mobile full-screen top bar gets a divider.

Reuses the theme's --rule/--paper/--paper-2/--accent tokens so it tracks light
and dark. 97 tests green; browser-verified: 32px SVG buttons + separator, framed
editor (10px radius), bold shows is-active on selection, mobile full-screen top
bar order and z-index intact.

Co-Authored-By: Claude Opus 4.8 <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/assets/js/reply-editor.js

    re9c9ae1 rff3b8ce  
    107107      }
    108108    });
     109
     110    // Reflect the current formatting on the toolbar (bold/italic/list active),
     111    // like the post editor, while the caret is inside this editor.
     112    function syncToolbar() {
     113      if (document.activeElement !== ed) return;
     114      var map = { bold: 'bold', italic: 'italic', list: 'insertUnorderedList' };
     115      bar.querySelectorAll('button[data-cmd]').forEach(function (b) {
     116        var c = map[b.getAttribute('data-cmd')];
     117        if (!c) return;
     118        var on = false; try { on = document.queryCommandState(c); } catch (e) { on = false; }
     119        b.classList.toggle('is-active', on);
     120      });
     121    }
     122    document.addEventListener('selectionchange', syncToolbar);
     123    ed.addEventListener('keyup', syncToolbar);
     124    ed.addEventListener('mouseup', syncToolbar);
     125
    109126    if (fileInput) fileInput.addEventListener('change', function () {
    110127      uploadFiles(fileInput.files);
Note: See TracChangeset for help on using the changeset viewer.