Commit Graph

26 Commits

Author SHA1 Message Date
evilchili
38af541c5d wip 2026-05-15 16:52:04 -07:00
evilchili
80c34a1483 fix dev server 2026-05-15 15:18:31 -07:00
evilchili
c61b8e2f8b wip; tests passing 2026-05-15 14:34:20 -07:00
evilchili
9748d12ede wip 2026-05-15 12:27:22 -07:00
evilchili
2bbb0ba25f wip 2026-05-15 11:57:10 -07:00
gsb
818ee418d5 docs: Styled source editor design plan
Design document for replacing the WYSIWYG innerHTML rebuild
approach with a styled-source model where the editor always
contains markdown text with CSS styling. No mode conversions
during editing, no innerHTML rebuild, no round-trip bugs.
2026-04-30 22:49:09 +00:00
gsb
bfc20f56bf Add dev server with livereload
npm run dev starts a dev server on port 8080 serving the test
page and ribbit dist files. Watches src/ and test/integration/
for changes, rebuilds automatically, and notifies connected
browsers to reload via EventSource on port 8081.

The test page includes a livereload script that auto-reloads
when the dev server signals a rebuild.
2026-04-30 22:47:26 +00:00
gsb
24560a4d21 bug fixes and wysiwyg behaviour improvements 2026-04-30 22:47:26 +00:00
gsb
5b2bd94388 Add @block macros to Flask example 2026-04-30 07:09:33 +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
2e28598243 Two build targets — core and full
dist/ribbit/ribbit-core.js    — editor without extra features
dist/ribbit/ribbit.js         — editor with all features

Added a theme feature flag for vim keybindings
2026-04-29 07:57:40 +00:00
gsb
3368e719fd Vim keybindings for source edit mode
VimHandler activates in source (edit) mode only. Two modes:
- Insert: standard typing, Esc enters normal mode
- Normal: vim navigation and editing, i/a/o/O enter insert

Normal mode commands:
  h/j/k/l: cursor movement
  w/b: word forward/back
  0/$: line start/end
  gg/G: document start/end
  i/a/o/O: enter insert mode
  x: delete char
  dd: delete line
  u: undo
  Ctrl+r: redo
2026-04-29 07:37:09 +00:00
gsb
8bef75e59f Add keyboard shortcuts to all toolbar buttons 2026-04-29 07:23:10 +00:00
gsb
1f523cbc0f Implement Toolbar 2026-04-29 07:11:31 +00:00
gsb
98719ec8cd Use data- attributes to preserve macro configs 2026-04-29 05:19:17 +00:00
gsb
2b88d2c10b Reimplement tests 2026-04-29 05:02:25 +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
df49ce7545 Single ribbit namespace instead of window globals
Use esbuild --global-name=ribbit to expose a single namespace.
2026-04-29 01:40:18 +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
gsb
5983ce50fd Initial commit of ribbit library
Zero-dependency WYSIWYG markdown editor for the browser, extracted
from the ttfrog wiki engine. Initial commit.
2026-04-28 23:30:53 +00:00
5dc50c3c75 Initial commit 2026-04-28 16:21:33 -07:00