Commit Graph

11 Commits

Author SHA1 Message Date
evilchili
c61b8e2f8b wip; tests passing 2026-05-15 14:34:20 -07:00
gsb
24560a4d21 bug fixes and wysiwyg behaviour improvements 2026-04-30 22:47:26 +00:00
gsb
d41716c8b2 Reimplement as a tokenizer with GFM parity 2026-04-30 07:09:19 +00:00
gsb
005db2f431 Add integration tests 2026-04-29 22:15:19 +00:00
gsb
3e8d3388f6 Add Selenium integration test framework 2026-04-29 22:15:02 +00:00
gsb
1198791505 Add collaboration support
Real-time collaboration through consumer-provided transport and
presence interfaces. Also includes a sample backend app.
2026-04-29 22:15:02 +00:00
gsb
1f523cbc0f Implement Toolbar 2026-04-29 07:11:31 +00:00
gsb
4237a3f6a2 Add support for wysiwyg markdown preview 2026-04-29 05:01:51 +00:00
gsb
86d59877f1 feat: Add macro support
New: macros.ts with MacroDef, parseBlockMacro, matchInlineMacro,
buildMacroTags, processInlineMacros.

Macro syntax:
  @user                     — bare, no args
  @user()                   — empty parens, same as bare
  @npc(Goblin King)         — self-closing with args
  @style(box center         — block: no closing paren on first line
  Content here.             — content on subsequent lines
  )                         — closing paren on its own line

Unknown macro names now render as an error:
  <span class="ribbit-error">Unknown macro: @bogus</span>

The verbatim keyword causes the contents to render as literals and also
preserves line breaks.
2026-04-29 03:03:58 +00:00
gsb
f76ebbf2e5 feat: Add typed event system with on/off/emit
New events with structured payloads:

  change({ markdown, html })
    Fires on every content edit.

  save({ markdown, html })
    Fires when editor.save() is called. Consumer handles persistence.

  modeChange({ current, previous })
    Fires on VIEW/EDIT/WYSIWYG transitions.

  themeChange({ current, previous })
    Fires when themes.set() switches the active theme.

  ready({ markdown, html, mode, theme })
    Fires after editor.run() completes first render.

Events can be registered in the constructor via the 'on' setting
or at any time via editor.on(event, callback) / editor.off().

202/202 tests passing.
2026-04-29 01:35:06 +00:00
gsb
ac7a698c4f Add themes support
Usage:

  const editor = new RibbitEditor({
    themes: [
        { name: 'dark', features: { sourceMode: false } },
        { name: 'minimal', tags: minimalTags },
    ],
    currentTheme: 'dark',
  });

The built-in theme is 'ribbit-default' and is always available.
Additional themes from the themes array are registered on top.
2026-04-29 01:20:55 +00:00