@astryxdesign/richtext 0.7.5-canary.dcdb356 → 0.7.5-canary.e4b225e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ RichText supports one Lexical minor at a time, named by its `lexical` and
|
|
|
36
36
|
`@lexical/*` peer ranges. Those are **optional** peer dependencies, so your
|
|
37
37
|
package manager does not add them: install them at that minor alongside
|
|
38
38
|
richtext. See the RFC:
|
|
39
|
-
[
|
|
39
|
+
[meta/astryx#3899](https://github.com/meta/astryx/issues/3899).
|
|
40
40
|
|
|
41
41
|
## Install
|
|
42
42
|
|
package/astryx.integration.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/richtext",
|
|
3
3
|
"displayName": "Rich Text",
|
|
4
|
-
"version": "0.7.5-canary.
|
|
4
|
+
"version": "0.7.5-canary.e4b225e",
|
|
5
5
|
"description": "Astryx rich text — a Lexical-based rich text editor and viewer, styled with Astryx design tokens.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"homepage": "https://github.com/
|
|
8
|
+
"homepage": "https://github.com/meta/astryx#readme",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/
|
|
11
|
+
"url": "git+https://github.com/meta/astryx.git",
|
|
12
12
|
"directory": "packages/richtext"
|
|
13
13
|
},
|
|
14
14
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/
|
|
15
|
+
"url": "https://github.com/meta/astryx/issues"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [
|
|
18
18
|
"astryx",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@stylexjs/stylex": ">=0.10.0",
|
|
56
|
-
"@astryxdesign/core": "0.7.5-canary.
|
|
56
|
+
"@astryxdesign/core": "0.7.5-canary.e4b225e",
|
|
57
57
|
"react": ">=19.0.0",
|
|
58
58
|
"react-dom": ">=19.0.0",
|
|
59
59
|
"lexical": "^0.52.0",
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
}
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
|
-
"@astryxdesign/a11y-spec": "0.7.5-canary.
|
|
116
|
-
"@astryxdesign/cli": "0.7.5-canary.
|
|
115
|
+
"@astryxdesign/a11y-spec": "0.7.5-canary.e4b225e",
|
|
116
|
+
"@astryxdesign/cli": "0.7.5-canary.e4b225e",
|
|
117
117
|
"@babel/cli": "^7.29.7",
|
|
118
118
|
"@babel/core": "^7.29.7",
|
|
119
119
|
"@babel/preset-react": "^7.29.7",
|
|
@@ -450,6 +450,71 @@ test('side by side: a list of task and plain items keeps each task checkbox and
|
|
|
450
450
|
expect(errors).toEqual([]);
|
|
451
451
|
});
|
|
452
452
|
|
|
453
|
+
// spec:AST-061 FR11: however wide a numbered list's counters grow, from `99.`
|
|
454
|
+
// to `100.` or from `i.` to `viii.` two lists down, each item's text, and each
|
|
455
|
+
// nested list's, starts in the same place on both surfaces.
|
|
456
|
+
test('side by side: wide counters start the text where RichText starts it', async ({
|
|
457
|
+
page,
|
|
458
|
+
}) => {
|
|
459
|
+
const errors = await openStory(page, STORY.sideBySide, DESKTOP);
|
|
460
|
+
await waitForDocument(page, MARKDOWN);
|
|
461
|
+
await waitForDocument(page, RICH_TEXT);
|
|
462
|
+
const textStarts = (surface: string) =>
|
|
463
|
+
page.evaluate(selector => {
|
|
464
|
+
const block = document.querySelector(
|
|
465
|
+
`${selector} [data-parity-block="list-ordered-wide"]`,
|
|
466
|
+
);
|
|
467
|
+
const origin = block?.getBoundingClientRect().left ?? 0;
|
|
468
|
+
const starts: Array<[string, number]> = [];
|
|
469
|
+
for (const item of block?.querySelectorAll('li') ?? []) {
|
|
470
|
+
// The item's own first text; RichText holds a nested list in an item
|
|
471
|
+
// of its own, which has none.
|
|
472
|
+
const walker = document.createTreeWalker(item, NodeFilter.SHOW_TEXT);
|
|
473
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
474
|
+
if (!node.textContent?.trim()) {
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
if (node.parentElement?.closest('li') === item) {
|
|
478
|
+
const range = document.createRange();
|
|
479
|
+
range.selectNodeContents(node);
|
|
480
|
+
starts.push([
|
|
481
|
+
node.textContent.trim(),
|
|
482
|
+
range.getBoundingClientRect().left - origin,
|
|
483
|
+
]);
|
|
484
|
+
}
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return starts;
|
|
489
|
+
}, surface);
|
|
490
|
+
const markdown = await textStarts(MARKDOWN);
|
|
491
|
+
const richText = new Map(await textStarts(RICH_TEXT));
|
|
492
|
+
expect(markdown.map(([text]) => text)).toEqual([
|
|
493
|
+
'Wide step ninety-eight',
|
|
494
|
+
'Wide step ninety-nine',
|
|
495
|
+
'Lettered step a',
|
|
496
|
+
'Roman step i',
|
|
497
|
+
'Roman step ii',
|
|
498
|
+
'Roman step iii',
|
|
499
|
+
'Roman step iv',
|
|
500
|
+
'Roman step v',
|
|
501
|
+
'Roman step vi',
|
|
502
|
+
'Roman step vii',
|
|
503
|
+
'Roman step viii',
|
|
504
|
+
'Wide step one hundred',
|
|
505
|
+
]);
|
|
506
|
+
expect([...richText.keys()].sort()).toEqual(
|
|
507
|
+
markdown.map(([text]) => text).sort(),
|
|
508
|
+
);
|
|
509
|
+
for (const [text, start] of markdown) {
|
|
510
|
+
expect(
|
|
511
|
+
Math.abs((richText.get(text) ?? Number.NaN) - start),
|
|
512
|
+
`text of ${text}`,
|
|
513
|
+
).toBeLessThanOrEqual(1);
|
|
514
|
+
}
|
|
515
|
+
expect(errors).toEqual([]);
|
|
516
|
+
});
|
|
517
|
+
|
|
453
518
|
// spec:AST-061 FR5: each task item has one real checkbox where core
|
|
454
519
|
// Markdown's is, the item stays a list item, and every list row has one
|
|
455
520
|
// marker.
|