bayan-api / src /js /editor.js

Commit History

  1. Update extension UI, app pipeline and model loaders

    9c49fff

  1. feat(extension): update icons, fix logo in ui, and improve content script positioning/observers

    e58b76f

  1. chore: revert frontend UI changes to 7aa0d90 to fix layout blowout

    078df28
  2. fix: format toolbar wrapping and ignore all button logic

    9751dc0

  1. UI/UX: Add Quran standalone tab, summarize textarea, floating selection bar, fix clear editor, remove duplicate button

    1f8ed9d

  1. Audit fixes: narrow FIX-35 suffixes, raise FIX-37 threshold, remove duplicate sort⁠

    417db6e
  2. FIX-32b: Add missing reverse sort in applyAllSuggestions⁠

    1502667
  3. FIX-33/34/35: Fix infinite loop — grammar corruption + spelling conflict⁠

    03cd504
  4. FIX-32: Fix word duplication bug in website frontend⁠

    f1671d1

  1. feat: Complete ALL plan items — gradient tokens, nav scroll glow, focus rings, dropdown keyboard nav, color reset, network delay indicator

    7dcbabe
  2. fix: Correct toast types (warning/error) + analyze API error toast + cleanup

    b201fcd
  3. fix: unified undo/redo - toolbar+keyboard use same stack, works with typing+formatting+Quran apply

    cc7b377
  4. fix: Ctrl+Z/Y undo/redo works with Arabic keyboard (e.code instead of e.key)

    bb8d753
  5. fix: placeholder no longer shows over quran-applied text

    6285a1c
  6. fix: tooltip shows original→correction format instead of confusing label

    1052ad6
  7. UI: nav logo, bayyinah hover, quran icon, hero autocomplete shadow, clean tooltip, fix punctuation dup + hamza كان

    20a34f1
  8. Full UI/UX modernization: fix hero examples, pricing beta, Apply All cursor/format fix, design polish

    90d59e9

  1. feat: P1-P3 all 8 items - ta marbuta fix, UI feedback, caching, rate limiting, unit tests

    918deb4
  2. revert: remove auto re-analyze after apply - causes grammar/punctuation cycle⁠

    8fe9501
  3. fix: prevent analyze loop - skip redundant API calls when text unchanged

    5a4cea7
  4. fix: instant re-analyze after apply (direct analyzeText call, no debounce)

    bd81b49
  5. feat: P1-P3 improvements + auto re-analyze after apply⁠

    a2f1290
  6. fix: QA sweep — 6 issues resolved (sidebar chips, corrected field, input sanitization, punc cap, docs, tests)⁠

    10ec354
  7. fix: Tooltip shows no correction buttons for grammar/punctuation — empty array is truthy in JS

    1afad28
  8. fix: Grammar retry on rate-limit + cursor position after correction⁠

    a52b4fe
  9. feat: Pipeline Hardening v3.3 — stage ownership, punctuation safety, UUID migration⁠

    a1c20fd

  1. feat: Complete UI/UX audit — all 20 fixes implemented Critical: - #1 Text duplication on consecutive apply (re-index spans) ✅ - #2 Apply All button (remove confirm() dialog, direct apply) ✅ - #3 Backend suggestion categorization (noted, minor) ✅ UX Fixes: - #4 Toolbar RTL verified correct ✅ - #5 Punctuation highlight: blinking insertion marker instead of bg ✅ - #6 Document title truncation with ellipsis ✅ - #7 Sidebar scrollable (score circle visible) ✅ - #8 Empty editor placeholder RTL alignment ✅ Design: - #9 Hero CTA button contrast (border 0.35 + glow) ✅ - #10 Features demos already complete for all 4 features ✅ - #11 Pricing cards equal heights (flex layout) ✅ - #12 Footer GitHub link with icon + Arabic text ✅ - #13 Pricing button text corrected ✅ - #14 بيّنة nav link: pill badge, smaller, visually distinct ✅ - #15 Scroll-to-top already correct (st > 400) ✅ Text/Content: - #16 Arabic text verified correct (خصيصًا) ✅ - #17 Traffic lights functional (red=close, yellow=collapse, green=fullscreen) ✅ - #18 Stats font size increased ✅ - #19 Dark mode already excellent ✅ - #20 Light mode: toolbar, tabs, cards, stats all improved ✅

    23b1721
  2. fix: UI/UX audit fixes (10 items addressed) Critical: - Fix text duplication on consecutive suggestion apply (re-index spans) - Suggestion list now updates after apply (counters + cards refresh) UX Fixes: - Sidebar scrollable (score circle always accessible) - Suggestions max-height reduced: 420→320px - Stat items: larger font + better contrast in dark mode Text: - Pricing: 'الترقية للاحترافي' → 'الترقية للخطة الاحترافية' Undo/Redo: - formatUndo/Redo now use custom stack (unified) - Formatting commands save undo state before applying - Typing tracked via debounced pushUndoStateDebounced

    9eaed94
  3. fix: Strip HTML formatting on paste into editor - Added paste event handler that converts clipboard to plain text - Prevents rich text styling (colors, opacity, fonts) from being carried over - Preserves paragraph structure with line breaks - Fixes ghost formatting when pasting from chat or web pages

    df46576
  4. fix: Re-index suggestion spans after dismiss (keep as-is) - After filtering dismissed suggestion from array, span data-suggestion-id indices became stale - Adjacent error words became unclickable because findSuggestionById used wrong index - Now re-indexes all remaining spans to match updated array positions

    383cd0a
  5. fix: Undo/Redo inside editor only + auto-focus after corrections - Moved listener back to editor element (capture:true) as user requested - Added editor.focus() after applySuggestionAtOffsets (line 432) - Added editor.focus() after applyAlternativeCorrection (line 474) - Added editor.focus() after dismissSuggestion (line 518) - After any correction/dismiss, editor auto-focuses so Ctrl+Z works immediately

    31e6b78
  6. fix: Undo/Redo now works after spelling corrections - Moved keydown listener from editor to document with capture:true - Uses stopImmediatePropagation to prevent browser native undo - Auto-focuses editor after undo/redo - Works even when tooltip click steals focus from editor

    0940035
  7. fix: Use capture phase on editor for Ctrl+Z/Y to intercept before browser native undo - Listener now on editor element with capture:true instead of document - Added stopPropagation to prevent browser native undo from also firing - Ensures corrections/dismissals can be properly undone

    50ae2d7
  8. feat: Add custom Undo/Redo for corrections and dismissals - Ctrl+Z undoes correction/dismiss (restores previous editor state) - Ctrl+Y or Ctrl+Shift+Z redoes - pushUndoState() called before every applyCorrection, applyAlternative, dismissSuggestion, applyAll - 50-level undo stack - Only intercepts when custom stack has entries (falls through to browser native otherwise)

    0f88e4f
  9. fix: Use Arabic numerals for word goal percentage

    d1caf7b
  10. audit-v5: Complete ALL remaining green items - #8: Nav logo uses favicon.svg + clickable to home - #9: CTA button arrow indicator - #12: Word count goal (localStorage bayan_word_goal) - #13: Export summary as .txt file - #14: Character limit warning (already existed) - #15: Auto-save indicator in toolbar - #16: 404 page with Arabic numerals - #17: Loading skeleton animation for suggestions

    1bc4049
  11. audit-v4: 10 fixes and improvements - FIX: Footer replaced with multi-column layout (Product + Resources) - FIX: cta_primary config now matches button text - FIX: Enterprise 'contact sales' button navigates to editor - FIX: Mock editor 'الكتابه' now has spelling-error class (3 errors) - FIX: Status bar updated to '٣ إملائي' - FIX: Scroll-to-top fallback to window.scrollY - FIX: Remove @view-transition experimental CSS - FIX: Remove injected Cloudflare challenge script - ADD: Toast on applyCorrection + applyAllSuggestions - ADD: confirm() on applyAllSuggestions - ADD: Smart empty state (no text vs no errors) - ADD: Toggle switch HTML for summary checkbox

    5f053cc
  12. audit-v2: Major UI overhaul — 12 improvements - HERO: Fix broken stats HTML, real Arabic errors in mock editor - HERO: Floating card shows actual correction (الصحيحه→الصحيحة) - HERO: Status bar matches shown errors (2 spelling, 1 grammar, 2 punctuation) - CSS: Custom gradient range slider (replaces browser default) - CSS: Toast notification system with animations - CSS: Scroll-to-top button with fade-in on scroll - JS: Toast notifications for copy actions - JS: Scroll-to-top button logic - PRICING: 'إضافة المتصفح'→'تصدير PDF و Word' (real feature) - EDITOR: copyText uses toast instead of button text change

    7db066a
  13. audit: Fix 15+ issues across entire website - BUGS: Fix copySummary event.target crash, viewbox→viewBox SVGs - HERO: Replace fake stats (10M/99%/50K) with real features (3 types/instant/free) - HERO: 'شاهد العرض التوضيحي'→'استكشف الميزات' with onclick - HERO: Fix mock editor hardcoded light colors→CSS variables - HERO: animate-pulse→animate-fade-in on floating card - PRICING: All 3 buttons now have onclick (go to editor) - FOOTER: Replace dead #links with working page navigation - EDITOR: Confirm dialog before clearing content - CODE: Remove empty style tag and old comments

    bb9cb5f
  14. feat: Remove indent buttons + dismissed words whitelist - Remove indent/outdent buttons from toolbar (keep lists) - 'إبقاء كما هي' now saves word to localStorage whitelist - Whitelisted words are filtered out from future analysis - Persists across page reloads via bayan_dismissed_words key

    158da8f
  15. fix: Lists, indent, and keep button - Change white-space from pre-wrap to normal (fixes lists + indent) - Redesign keep button: centered, cleaner, separated from corrections - Keep button always renders last with clear 'إبقاء كما هي' label - Blockquote/list styling for RTL editor

    55ce477
  16. fix: Critical editor bugs - Dropdowns now visible (remove overflow:hidden from editor-shell) - Font/size/color menus z-index 200 (above editor) - Selection collapses after formatting (no more blue highlight) - Spelling overlay uses textContent for consistent offsets - Correction preserves formatting (replaces inside parent node) - Alt correction same fix - Fallback finds span by matching original text

    189a51b
  17. feat: 12 UI improvements batch - 1. Editor surface flush (no margin/border, Google Docs style) - 2. Custom styled summary slider (gradient thumb) - 3. Empty states with icons for suggestions - 4. Enhanced status bar (chars, sentences, reading time) - 5. Mobile scrollable formatting toolbar - 6. Summary word count + compression ratio - 7. Document search bar with filter - 8. Text color + highlight color pickers - 9. Lists (bullet/ordered) + indent/outdent + clear format - 10. Animated sun/moon theme toggle - 11. Summary bullet points mode toggle - 12. Print styles (only editor content)

    ecec9e1
  18. feat: Rich text formatting toolbar + formatting-preserving renderer - Bold, Italic, Underline, Strikethrough, Alignment, Undo/Redo - Font family and font size dropdowns - New DOM-level overlay renderer (preserves formatting during analysis) - Apply/dismiss corrections keep original formatting

    120440f
  19. fix: Remove 'Apply All' button - conflicts with spelling+grammar pipeline

    7f0ddc6
  20. fix: Prevent overlapping spelling+grammar suggestions from duplicating text - Backend: Skip grammar suggestions that overlap with existing spelling ranges - Frontend: applyAllSuggestions skips overlapping ranges to prevent duplication

    02d51b7

  1. perf: Reduce debounce from 1500ms to 1000ms for faster response

    4540c4b
  2. fix: Increase analyze debounce to 1.5s to prevent text overwrite while typing - Debounce 500ms -> 1500ms - Abort in-flight requests when user starts typing again - Double-check no new input before running analysis

    9a1be04
  3. feat: Show 3 spelling alternatives + keep-as-is option - Backend: Generate alternatives via EditDistanceCorrector - Tooltip: Multiple clickable correction buttons - Sidebar cards: Alt chips for each suggestion - Dismiss button removes error highlight (keep original word)

    3f8001b

  1. authDone Ready for deployment

    bb51619