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.
52 lines
1.7 KiB
HTML
52 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Ribbit Integration Test Page</title>
|
|
<link rel="stylesheet" href="/ribbit/themes/ribbit-default/theme.css">
|
|
<style>
|
|
body { font-family: sans-serif; margin: 20px; }
|
|
#ribbit { border: 1px solid #ccc; padding: 20px; min-height: 200px; }
|
|
.ribbit-toolbar { background: #f5f5f5; border: 1px solid #ccc; padding: 4px; margin-bottom: 8px; }
|
|
.ribbit-toolbar ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
|
|
.ribbit-toolbar button { padding: 4px 8px; border: 1px solid #ddd; border-radius: 3px; background: white; cursor: pointer; font-size: 12px; }
|
|
.ribbit-toolbar button.active { background: #d0d0ff; }
|
|
.ribbit-toolbar button.disabled { opacity: 0.3; }
|
|
.ribbit-toolbar .spacer { width: 12px; }
|
|
.ribbit-dropdown { position: absolute; background: white; border: 1px solid #ccc; padding: 4px; }
|
|
.ribbit-dropdown button { display: block; width: 100%; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<article id="ribbit">**bold** and *italic* and `code`
|
|
|
|
## Heading
|
|
|
|
- list item 1
|
|
- list item 2
|
|
|
|
> a blockquote
|
|
|
|
| A | B |
|
|
|---|---|
|
|
| 1 | 2 |
|
|
</article>
|
|
|
|
<script src="/ribbit/ribbit.js"></script>
|
|
<script>
|
|
const editor = new ribbit.Editor({
|
|
on: {
|
|
ready: () => { window.__ribbitReady = true; },
|
|
},
|
|
});
|
|
editor.run();
|
|
window.__ribbitEditor = editor;
|
|
</script>
|
|
<script>
|
|
// Livereload — connects to dev server's EventSource endpoint.
|
|
// Silently fails if the dev server isn't running.
|
|
try { new EventSource('http://localhost:8081').onmessage = () => location.reload(); } catch(e) {}
|
|
</script>
|
|
</body>
|
|
</html>
|