-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathindex.html
More file actions
368 lines (346 loc) · 14.7 KB
/
Copy pathindex.html
File metadata and controls
368 lines (346 loc) · 14.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Haoran Yu & Jisuanke Team">
<meta
name="description"
content="Record and replay CodeMirror 6 editing sessions with a stable v2 API and a wire format shared with the maintained CodeMirror 5 line."
>
<meta name="theme-color" content="#020617">
<meta property="og:type" content="website">
<meta property="og:title" content="CodeMirror Record">
<meta
property="og:description"
content="Record a CodeMirror session, move it as JSON, and replay the timeline."
>
<meta property="og:url" content="https://codemirror-record.haoranyu.com/">
<meta
property="og:image"
content="https://codemirror-record.haoranyu.com/assets/project-artwork.png"
>
<meta property="og:image:alt" content="CodeMirror Record project artwork">
<meta name="twitter:card" content="summary_large_image">
<link rel="canonical" href="https://codemirror-record.haoranyu.com/">
<link rel="icon" href="data:,">
<title>CodeMirror Record — Record and replay CodeMirror 6</title>
<link rel="stylesheet" href="./demo/style.css">
<link rel="stylesheet" href="./homepage.css">
</head>
<body class="home-page">
<a class="skip-link" href="#main-content">Skip to the main content</a>
<header class="site-header">
<div class="page-shell header-content">
<a class="brand" href="./">CodeMirror Record</a>
<div class="header-navigation">
<nav class="primary-navigation" aria-label="Primary navigation">
<a href="#workflow">How it works</a>
<a href="#quick-start">Quick start</a>
<a href="./migration/">Migration</a>
<a
href="https://github.com/Jisuanke/CodeMirror-Record"
target="_blank"
rel="noreferrer"
>GitHub</a>
<a class="nav-cta" href="./demo/#demo-workbench">Try the demo</a>
</nav>
</div>
</div>
</header>
<main id="main-content">
<section class="hero page-shell" aria-labelledby="page-title">
<div class="hero-copy">
<p class="eyebrow">CodeMirror 6 · stable v2</p>
<h1 id="page-title">Record editing activity.<br>Replay the timeline.</h1>
<p class="hero-summary">
Version 2 is the default CodeMirror 6 recorder and player. CodeMirror 5
stays maintained on version 1, with the same <code>CodeRecord</code>,
<code>CodePlay</code>, and portable JSON recording contract.
</p>
<div class="hero-actions">
<a class="button button-primary" href="./demo/#demo-workbench">
Try the interactive demo
</a>
<a class="text-link" href="#quick-start">Read the quick start</a>
</div>
<div class="home-install-stack" aria-label="Install commands by editor version">
<div class="home-install">
<span>CM6 · default</span>
<code>npm install codemirror-record@^2 @codemirror/state@^6 @codemirror/view@^6</code>
</div>
<div class="home-install">
<span>CM5</span>
<code>npm install codemirror-record@^1 codemirror@^5</code>
</div>
</div>
<p class="version-notice">
Using CodeMirror 5.x?
<a href="./v1/">Try CodeMirror Record version 1 instead.</a>
</p>
<p class="home-release-note">
Moving an existing application? Follow the
<a href="./migration/">CM5 → CM6 migration runbook</a> and keep stored
recording strings unchanged.
</p>
</div>
<figure class="home-hero-visual">
<div class="home-hero-visual-header">
<span>
<span class="status-dot" aria-hidden="true"></span>
Cross-version recording seam
</span>
<span>one contract</span>
</div>
<div class="home-hero-stage">
<div class="home-hero-artwork" aria-hidden="true">
<img
src="./assets/project-artwork.png"
alt=""
width="1280"
height="640"
fetchpriority="high"
>
</div>
<div class="home-session-readout">
<p>Release tracks</p>
<ol>
<li>
<span class="track-version">v1</span>
<span><b>CM5 adapter</b><small>record + play · maintenance</small></span>
</li>
<li>
<span class="track-version">wire</span>
<span><b>JSON contract</b><small>ordered operation stream</small></span>
</li>
<li>
<span class="track-version">v2</span>
<span><b>CM6 adapter</b><small>record + play · transaction-native</small></span>
</li>
</ol>
</div>
</div>
<figcaption aria-label="CodeMirror 5 and 6 share one recording contract">
<span>CM5 recorder / player</span>
<span class="home-flow-line" aria-hidden="true"></span>
<span>shared JSON</span>
<span class="home-flow-line" aria-hidden="true"></span>
<span>CM6 recorder / player</span>
</figcaption>
</figure>
</section>
<section class="workflow-section" id="workflow" aria-labelledby="workflow-title">
<div class="page-shell">
<div class="section-heading">
<p class="eyebrow">How it works</p>
<h2 id="workflow-title">One session, four explicit steps</h2>
<p>
Recording and playback remain separate. The JSON string is the
bridge, so your application decides when and where a session moves.
</p>
</div>
<ol class="workflow-steps" aria-label="CodeMirror Record workflow">
<li class="workflow-step is-complete">
<span class="step-number">01</span>
<div>
<h3>Record</h3>
<p>Attach <code>CodeRecord</code> and call <code>listen()</code>.</p>
</div>
</li>
<li class="workflow-step is-complete">
<span class="step-number">02</span>
<div>
<h3>Capture</h3>
<p><code>getRecords()</code> drains pending activity into JSON.</p>
</div>
</li>
<li class="workflow-step is-complete">
<span class="step-number">03</span>
<div>
<h3>Load</h3>
<p>Pass a non-empty records string to <code>addOperations()</code>.</p>
</div>
</li>
<li class="workflow-step is-active" aria-current="step">
<span class="step-number">04</span>
<div>
<h3>Replay</h3>
<p>Play, pause, seek, and adjust the timeline speed.</p>
</div>
</li>
</ol>
</div>
</section>
<section class="home-capabilities page-shell" aria-labelledby="capabilities-title">
<div class="home-section-heading">
<p class="eyebrow">What gets recorded</p>
<h2 id="capabilities-title">The editor state your replay needs</h2>
<p>
CodeMirror Record keeps the payload compact while preserving the
interaction details that make a coding session understandable.
</p>
</div>
<div class="home-feature-grid">
<article class="home-feature-card">
<span class="feature-index">01</span>
<h3>Editor activity</h3>
<p>Capture text changes, directed selections, and cursor movement in either editor generation.</p>
<code>CM5 events · CM6 transactions</code>
</article>
<article class="home-feature-card">
<span class="feature-index">02</span>
<h3>Application activity</h3>
<p>Add JSON-serializable events that happen outside the editor.</p>
<code>recordExtraActivity()</code>
</article>
<article class="home-feature-card">
<span class="feature-index">03</span>
<h3>Playback control</h3>
<p>Pause, seek, change speed, and subscribe to player lifecycle events.</p>
<code>play · pause · seek · end</code>
</article>
</div>
<aside class="home-demo-callout" aria-labelledby="demo-callout-title">
<div>
<p class="eyebrow">Interactive playground</p>
<h2 id="demo-callout-title">See the data move</h2>
<p>
Use the current CM6 workbench to edit code, inspect the recorded JSON,
load it, and replay the same sequence in a second editor.
</p>
</div>
<div class="home-demo-actions">
<a class="button button-accent" href="./demo/#demo-workbench">
Open the playground
</a>
<span>Record <b aria-hidden="true">→</b> JSON <b aria-hidden="true">→</b> Replay</span>
</div>
</aside>
</section>
<section class="integration-section" id="quick-start" aria-labelledby="quick-start-title">
<div class="page-shell integration-grid">
<div class="integration-copy">
<p class="eyebrow">Quick start</p>
<h2 id="quick-start-title">Wire the round trip in a few calls</h2>
<p>
Start both editors with the same document. Capture only after the
user has interacted with the recording editor, then guard against an
empty batch before loading it.
</p>
<div class="home-link-list">
<a href="https://github.com/Jisuanke/CodeMirror-Record#api">
Read the complete API and data format
<span aria-hidden="true">→</span>
</a>
<a href="https://www.npmjs.com/package/codemirror-record">
View the package on npm
<span aria-hidden="true">→</span>
</a>
<a href="./migration/">
Migrate a CodeMirror 5 integration
<span aria-hidden="true">→</span>
</a>
</div>
</div>
<div class="code-sample">
<div class="code-sample-header">
<span>quick-start.js</span>
<span>CodeMirror 6 · v2</span>
</div>
<pre tabindex="0"><code>import {CodeRecord, CodePlay} from 'codemirror-record';
const recorder = new CodeRecord(recordView);
const player = new CodePlay(playView, {
maxDelay: 3000,
speed: 1,
});
recorder.listen();
function replayPendingOperations() {
const records = recorder.getRecords();
if (JSON.parse(records).length === 0) return;
player.addOperations(records);
player.play();
}</code></pre>
</div>
</div>
</section>
<section class="home-versions page-shell" id="versions" aria-labelledby="versions-title">
<div class="home-section-heading">
<p class="eyebrow">Choose the editor seam</p>
<h2 id="versions-title">Two package majors. One recording contract.</h2>
<p>
The editor adapters differ because CodeMirror 6 replaced the CM5 event
model with transactions. Stored sessions stay on the established wire format.
</p>
</div>
<div class="version-rail-grid">
<article class="version-rail version-rail-current">
<header>
<span>CodeMirror 6</span>
<span class="track-status">Stable default</span>
</header>
<h3>Package v2</h3>
<p>Transaction-native recording and atomic playback for an <code>EditorView</code>.</p>
<code class="version-command">codemirror-record@^2</code>
<dl>
<div><dt>Branch</dt><dd>main</dd></div>
<div><dt>npm tags</dt><dd>latest · cm6</dd></div>
</dl>
</article>
<div class="wire-seam" role="note" aria-label="Verified bidirectional recording compatibility">
<span>Verified interoperability</span>
<strong>v1 JSON wire</strong>
<p>Every published v1.x release is exercised with operations, selections, timing, and extras in both directions.</p>
</div>
<article class="version-rail version-rail-maintenance">
<header>
<span>CodeMirror 5</span>
<span class="track-status">Maintained</span>
</header>
<h3>Package v1</h3>
<p>The established event-based adapter remains available for existing applications.</p>
<code class="version-command">codemirror-record@^1</code>
<dl>
<div><dt>Branch</dt><dd>v1</dd></div>
<div><dt>npm tag</dt><dd>cm5</dd></div>
</dl>
<a
class="version-doc-link"
href="https://github.com/Jisuanke/CodeMirror-Record/tree/v1#api"
>Read the maintained CM5 API →</a>
</article>
</div>
<p class="version-release-note">
Existing <code>^1</code> installations do not cross the major-version line.
Real CM5 and CM6 recorders and players pass the full two-way package matrix;
recorded JSON does not require a schema migration.
<a href="./migration/">Read the migration runbook</a> or
<a href="https://github.com/Jisuanke/CodeMirror-Record/blob/main/docs/RELEASING.md">inspect the release policy</a>.
</p>
</section>
<section class="home-final-cta" aria-labelledby="final-cta-title">
<div class="page-shell">
<p class="eyebrow">Ready for the full round trip?</p>
<h2 id="final-cta-title">Record an edit. Inspect the JSON. Replay the timeline.</h2>
<div class="hero-actions">
<a class="button button-primary" href="./demo/#demo-workbench">
Try the interactive demo
</a>
<a
class="button button-secondary"
href="https://github.com/Jisuanke/CodeMirror-Record#api"
>
Read the API
</a>
</div>
</div>
</section>
</main>
<footer class="site-footer">
<div class="page-shell">
<span>CodeMirror Record · MIT License</span>
<span data-author-credit>Haoran Yu & Jisuanke Team</span>
<span>One recording contract for CodeMirror 5 and 6.</span>
</div>
</footer>
</body>
</html>