@astryxdesign/richtext 0.6.5-canary.eb0010b → 0.6.5-canary.efac39f
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/dist/CodeBlockHeaderPlugin.d.ts +7 -0
- package/dist/CodeBlockHeaderPlugin.d.ts.map +1 -0
- package/dist/CodeBlockHeaderPlugin.js +196 -0
- package/dist/RichTextEditor.d.ts.map +1 -1
- package/dist/RichTextEditor.js +7 -2
- package/dist/RichTextView.d.ts.map +1 -1
- package/dist/RichTextView.js +7 -1
- package/dist/TableColumnFloorPlugin.d.ts +12 -0
- package/dist/TableColumnFloorPlugin.d.ts.map +1 -0
- package/dist/TableColumnFloorPlugin.js +84 -0
- package/dist/TaskCheckboxPlugin.d.ts +7 -0
- package/dist/TaskCheckboxPlugin.d.ts.map +1 -0
- package/dist/TaskCheckboxPlugin.js +193 -0
- package/dist/editorTheme.d.ts.map +1 -1
- package/dist/editorTheme.js +225 -66
- package/dist/markdownCharacterReferences.d.ts +28 -0
- package/dist/markdownCharacterReferences.d.ts.map +1 -0
- package/dist/markdownCharacterReferences.js +314 -0
- package/dist/markdownListExport.d.ts.map +1 -1
- package/dist/markdownListExport.js +7 -2
- package/dist/markdownSource.d.ts +5 -7
- package/dist/markdownSource.d.ts.map +1 -1
- package/dist/markdownSource.js +90 -8
- package/dist/markdownTable.d.ts +5 -3
- package/dist/markdownTable.d.ts.map +1 -1
- package/dist/markdownTable.js +7 -4
- package/dist/markdownTaskList.d.ts +48 -0
- package/dist/markdownTaskList.d.ts.map +1 -0
- package/dist/markdownTaskList.js +166 -0
- package/dist/richtext.css +36 -2
- package/package.json +4 -4
- package/src/CodeBlockHeaderPlugin.test.tsx +100 -0
- package/src/CodeBlockHeaderPlugin.tsx +261 -0
- package/src/RichTextEditor.tsx +6 -0
- package/src/RichTextView.tsx +11 -0
- package/src/TableColumnFloorPlugin.test.tsx +49 -0
- package/src/TableColumnFloorPlugin.tsx +99 -0
- package/src/TaskCheckboxPlugin.tsx +242 -0
- package/src/__tests__/MarkdownParitySandbox.a11y.chromium.spec.ts +610 -5
- package/src/editorTheme.ts +107 -38
- package/src/markdownCharacterReferences.test.ts +202 -0
- package/src/markdownCharacterReferences.ts +339 -0
- package/src/markdownListExport.ts +6 -3
- package/src/markdownSource.test.tsx +112 -6
- package/src/markdownSource.ts +104 -9
- package/src/markdownTable.ts +7 -3
- package/src/markdownTaskList.test.tsx +445 -0
- package/src/markdownTaskList.ts +222 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type JSX } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Draws a header over each top-level code block and keeps it there as the
|
|
4
|
+
* document, the editor's size, or the window changes.
|
|
5
|
+
*/
|
|
6
|
+
export declare function CodeBlockHeaderPlugin(): JSX.Element;
|
|
7
|
+
//# sourceMappingURL=CodeBlockHeaderPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeBlockHeaderPlugin.d.ts","sourceRoot":"","sources":["../src/CodeBlockHeaderPlugin.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAsB,KAAK,GAAG,EAAC,MAAM,OAAO,CAAC;AA8JpD;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,GAAG,CAAC,OAAO,CA+EnD"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file CodeBlockHeaderPlugin.tsx
|
|
7
|
+
* @input Uses @lexical/react (composer context), @lexical/code (CodeNode),
|
|
8
|
+
* lexical, and core IconButton, Icon, useClipboard, and useTranslator.
|
|
9
|
+
* @output Exports CodeBlockHeaderPlugin, which draws core CodeBlock's header
|
|
10
|
+
* over every fenced code block: the language label and a copy button, or
|
|
11
|
+
* just the copy button in the corner when the block names no language.
|
|
12
|
+
* @position Rendered by RichTextEditor and RichTextView inside the positioned
|
|
13
|
+
* element that holds the content editable. The headers are siblings of the
|
|
14
|
+
* editable text, never inside it, so they are not part of the document and
|
|
15
|
+
* cannot be edited (spec:AST-061 FR8, DEC-4). The code block's theme class
|
|
16
|
+
* reserves the header's height, so the code sits where core Markdown's does.
|
|
17
|
+
*/
|
|
18
|
+
import * as stylex from '@stylexjs/stylex';
|
|
19
|
+
import { useEffect, useState } from 'react';
|
|
20
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
21
|
+
import { $isCodeNode } from '@lexical/code';
|
|
22
|
+
import { $getNodeByKey, $getRoot } from 'lexical';
|
|
23
|
+
import { Icon } from '@astryxdesign/core/Icon';
|
|
24
|
+
import { IconButton } from '@astryxdesign/core/IconButton';
|
|
25
|
+
import { useClipboard } from '@astryxdesign/core/hooks';
|
|
26
|
+
import { useTranslator } from '@astryxdesign/core/i18n';
|
|
27
|
+
import '@astryxdesign/core/theme/tokens.stylex';
|
|
28
|
+
import { fontWeightVars, spacingVars, typeScaleVars, typographyVars } from '@astryxdesign/core/theme/tokens.stylex';
|
|
29
|
+
|
|
30
|
+
/** Where one code block's header goes, in the container's coordinates. */
|
|
31
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
32
|
+
const styles = {
|
|
33
|
+
header: {
|
|
34
|
+
kVAEAm: "x10l6tqk",
|
|
35
|
+
k1xSpc: "x78zum5",
|
|
36
|
+
kGNEyG: "x6s0dn4",
|
|
37
|
+
kjj79g: "x1qughib",
|
|
38
|
+
k8WAf4: "xce4md1",
|
|
39
|
+
kg3NbH: "x1pzlopt",
|
|
40
|
+
kB7OPa: "x9f619",
|
|
41
|
+
$$css: true
|
|
42
|
+
},
|
|
43
|
+
corner: {
|
|
44
|
+
kVAEAm: "x10l6tqk",
|
|
45
|
+
k1xSpc: "x78zum5",
|
|
46
|
+
kjj79g: "x13a6bvl",
|
|
47
|
+
kmVPX3: "xlsj2fj",
|
|
48
|
+
kB7OPa: "x9f619",
|
|
49
|
+
kfzvcC: "x47corl",
|
|
50
|
+
$$css: true
|
|
51
|
+
},
|
|
52
|
+
cornerButton: {
|
|
53
|
+
kfzvcC: "x67bb7w",
|
|
54
|
+
$$css: true
|
|
55
|
+
},
|
|
56
|
+
copyButton: {
|
|
57
|
+
kMwMTN: "x1mjzq1q",
|
|
58
|
+
$$css: true
|
|
59
|
+
},
|
|
60
|
+
placement: (top, left, width) => [{
|
|
61
|
+
k87sOh: top != null ? "xjbys53" : top,
|
|
62
|
+
kbCHJM: left != null ? "xgq9j65" : left,
|
|
63
|
+
kzqmXN: width != null ? "x5lhr3w" : width,
|
|
64
|
+
$$css: true
|
|
65
|
+
}, {
|
|
66
|
+
"--x-top": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(top),
|
|
67
|
+
"--x-left": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(left),
|
|
68
|
+
"--x-width": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(width)
|
|
69
|
+
}]
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The language a header names, as core CodeBlock decides it: none for a fence
|
|
74
|
+
* without one, and none for exactly `plaintext`, which core Markdown gives a
|
|
75
|
+
* fence with no info string.
|
|
76
|
+
*/
|
|
77
|
+
function displayLanguageOf(language) {
|
|
78
|
+
return language == null || language === '' || language === PLAIN_TEXT ? null : language;
|
|
79
|
+
}
|
|
80
|
+
const PLAIN_TEXT = 'plaintext';
|
|
81
|
+
function samePlacements(a, b) {
|
|
82
|
+
return a.length === b.length && a.every((placement, index) => placement.key === b[index].key && placement.language === b[index].language && placement.top === b[index].top && placement.left === b[index].left && placement.width === b[index].width);
|
|
83
|
+
}
|
|
84
|
+
function CodeBlockHeader({
|
|
85
|
+
placement
|
|
86
|
+
}) {
|
|
87
|
+
const [editor] = useLexicalComposerContext();
|
|
88
|
+
const t = useTranslator();
|
|
89
|
+
const {
|
|
90
|
+
copy,
|
|
91
|
+
isCopied
|
|
92
|
+
} = useClipboard({
|
|
93
|
+
announce: t('@astryx.codeBlock.copied')
|
|
94
|
+
});
|
|
95
|
+
const copyButton = /*#__PURE__*/_jsx(IconButton, {
|
|
96
|
+
variant: "ghost",
|
|
97
|
+
size: "sm",
|
|
98
|
+
icon: /*#__PURE__*/_jsx(Icon, {
|
|
99
|
+
icon: isCopied ? 'check' : 'copy',
|
|
100
|
+
size: "sm",
|
|
101
|
+
color: "inherit"
|
|
102
|
+
}),
|
|
103
|
+
tooltip: t('@astryx.codeBlock.copyCode'),
|
|
104
|
+
label: isCopied ? t('@astryx.codeBlock.copied') : t('@astryx.codeBlock.copyCode'),
|
|
105
|
+
onClick: () => {
|
|
106
|
+
const code = editor.getEditorState().read(() => $getNodeByKey(placement.key)?.getTextContent() ?? '');
|
|
107
|
+
void copy(code);
|
|
108
|
+
},
|
|
109
|
+
xstyle: [styles.copyButton, placement.language == null && styles.cornerButton]
|
|
110
|
+
});
|
|
111
|
+
const position = styles.placement(placement.top, placement.left, placement.width);
|
|
112
|
+
if (placement.language == null) {
|
|
113
|
+
return /*#__PURE__*/_jsx("div", {
|
|
114
|
+
"data-richtext-code-header": "",
|
|
115
|
+
...stylex.props(styles.corner, position),
|
|
116
|
+
children: copyButton
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
120
|
+
"data-richtext-code-header": "",
|
|
121
|
+
...stylex.props(styles.header, position),
|
|
122
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
123
|
+
...{
|
|
124
|
+
className: "x141an7d x9m5x89 x1e4wzip x1ltkj2j x1mjzq1q xeuugli xb3r6kr xlyipyv xuxw1ft"
|
|
125
|
+
},
|
|
126
|
+
children: placement.language
|
|
127
|
+
}), copyButton]
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Draws a header over each top-level code block and keeps it there as the
|
|
133
|
+
* document, the editor's size, or the window changes.
|
|
134
|
+
*/
|
|
135
|
+
export function CodeBlockHeaderPlugin() {
|
|
136
|
+
const [editor] = useLexicalComposerContext();
|
|
137
|
+
const [placements, setPlacements] = useState([]);
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
let frame = 0;
|
|
140
|
+
const measure = () => {
|
|
141
|
+
frame = 0;
|
|
142
|
+
const root = editor.getRootElement();
|
|
143
|
+
const container = root?.parentElement;
|
|
144
|
+
if (root == null || container == null) {
|
|
145
|
+
setPlacements(current => current.length === 0 ? current : []);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const origin = container.getBoundingClientRect();
|
|
149
|
+
const next = editor.getEditorState().read(() => $getRoot().getChildren().filter($isCodeNode).flatMap(node => {
|
|
150
|
+
const element = editor.getElementByKey(node.getKey());
|
|
151
|
+
if (element == null) {
|
|
152
|
+
return [];
|
|
153
|
+
}
|
|
154
|
+
const box = element.getBoundingClientRect();
|
|
155
|
+
// Inside the block's border, so the header lines up with the
|
|
156
|
+
// padding the theme reserves for it.
|
|
157
|
+
return [{
|
|
158
|
+
key: node.getKey(),
|
|
159
|
+
language: displayLanguageOf(node.getLanguage()),
|
|
160
|
+
top: box.top - origin.top + element.clientTop,
|
|
161
|
+
left: box.left - origin.left + element.clientLeft,
|
|
162
|
+
width: element.clientWidth
|
|
163
|
+
}];
|
|
164
|
+
}));
|
|
165
|
+
setPlacements(current => samePlacements(current, next) ? current : next);
|
|
166
|
+
};
|
|
167
|
+
const schedule = () => {
|
|
168
|
+
if (frame === 0) {
|
|
169
|
+
frame = requestAnimationFrame(measure);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(schedule);
|
|
173
|
+
const unregisterRoot = editor.registerRootListener(root => {
|
|
174
|
+
observer?.disconnect();
|
|
175
|
+
if (root != null) {
|
|
176
|
+
observer?.observe(root);
|
|
177
|
+
}
|
|
178
|
+
schedule();
|
|
179
|
+
});
|
|
180
|
+
const unregisterUpdate = editor.registerUpdateListener(schedule);
|
|
181
|
+
window.addEventListener('resize', schedule);
|
|
182
|
+
schedule();
|
|
183
|
+
return () => {
|
|
184
|
+
cancelAnimationFrame(frame);
|
|
185
|
+
observer?.disconnect();
|
|
186
|
+
unregisterRoot();
|
|
187
|
+
unregisterUpdate();
|
|
188
|
+
window.removeEventListener('resize', schedule);
|
|
189
|
+
};
|
|
190
|
+
}, [editor]);
|
|
191
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
192
|
+
children: placements.map(placement => /*#__PURE__*/_jsx(CodeBlockHeader, {
|
|
193
|
+
placement: placement
|
|
194
|
+
}, placement.key))
|
|
195
|
+
});
|
|
196
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditor.d.ts","sourceRoot":"","sources":["../src/RichTextEditor.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAQL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AASf,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAyB,KAAK,SAAS,EAAC,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"RichTextEditor.d.ts","sourceRoot":"","sources":["../src/RichTextEditor.tsx"],"names":[],"mappings":"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"}
|
package/dist/RichTextEditor.js
CHANGED
|
@@ -49,6 +49,9 @@ import { MarkdownShortcutPlugin } from '@lexical/react/LexicalMarkdownShortcutPl
|
|
|
49
49
|
import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
|
|
50
50
|
import { TablePlugin } from '@lexical/react/LexicalTablePlugin';
|
|
51
51
|
import { HorizontalRuleExtension } from '@lexical/extension';
|
|
52
|
+
import { TableColumnFloorPlugin } from "./TableColumnFloorPlugin.js";
|
|
53
|
+
import { CodeBlockHeaderPlugin } from "./CodeBlockHeaderPlugin.js";
|
|
54
|
+
import { TaskCheckboxPlugin } from "./TaskCheckboxPlugin.js";
|
|
52
55
|
import { $generateHtmlFromNodes } from '@lexical/html';
|
|
53
56
|
import { DEFAULT_NODES } from "./editorNodes.js";
|
|
54
57
|
import { $exportMarkdownKeepingSource } from "./markdownSource.js";
|
|
@@ -350,12 +353,14 @@ export const RichTextEditor = /*#__PURE__*/forwardRef(function RichTextEditor({
|
|
|
350
353
|
}),
|
|
351
354
|
placeholder: null,
|
|
352
355
|
ErrorBoundary: LexicalErrorBoundary
|
|
353
|
-
}), /*#__PURE__*/_jsx(HistoryPlugin, {}), /*#__PURE__*/_jsx(ListPlugin, {}), /*#__PURE__*/_jsx(
|
|
356
|
+
}), /*#__PURE__*/_jsx(HistoryPlugin, {}), /*#__PURE__*/_jsx(ListPlugin, {}), /*#__PURE__*/_jsx(TaskCheckboxPlugin, {
|
|
357
|
+
isReadOnly: isReadOnly || isDisabled
|
|
358
|
+
}), /*#__PURE__*/_jsx(LinkPlugin, {}), /*#__PURE__*/_jsx(TablePlugin, {
|
|
354
359
|
hasCellMerge: false,
|
|
355
360
|
hasCellBackgroundColor: false,
|
|
356
361
|
hasTabHandler: false,
|
|
357
362
|
hasHorizontalScroll: true
|
|
358
|
-
}), /*#__PURE__*/_jsx(TabIndentationPlugin, {}), /*#__PURE__*/_jsx(TabFocusEscapePlugin, {}), hasMarkdownShortcuts && /*#__PURE__*/_jsx(MarkdownShortcutPlugin, {
|
|
363
|
+
}), /*#__PURE__*/_jsx(TableColumnFloorPlugin, {}), /*#__PURE__*/_jsx(CodeBlockHeaderPlugin, {}), /*#__PURE__*/_jsx(TabIndentationPlugin, {}), /*#__PURE__*/_jsx(TabFocusEscapePlugin, {}), hasMarkdownShortcuts && /*#__PURE__*/_jsx(MarkdownShortcutPlugin, {
|
|
359
364
|
transformers: markdownTransformers
|
|
360
365
|
}), hasAutoFocus && /*#__PURE__*/_jsx(AutoFocusOnMount, {}), onChange && /*#__PURE__*/_jsx(OnChangePlugin, {
|
|
361
366
|
onChange: onChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextView.d.ts","sourceRoot":"","sources":["../src/RichTextView.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAA8B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGlE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"RichTextView.d.ts","sourceRoot":"","sources":["../src/RichTextView.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAA8B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGlE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAalD,OAAO,KAAK,EAEV,KAAK,EACL,WAAW,EAEZ,MAAM,SAAS,CAAC;AAyCjB,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1C;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACtC;;;;OAIG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;CAC3B;AAyCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAyB,EACzB,YAAY,EACZ,aAAoB,EACpB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,iBAAiB,+BAqHnB;yBAhIe,YAAY"}
|
package/dist/RichTextView.js
CHANGED
|
@@ -28,6 +28,9 @@ import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
|
|
28
28
|
import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
|
|
29
29
|
import { TablePlugin } from '@lexical/react/LexicalTablePlugin';
|
|
30
30
|
import { TableScrollRegionPlugin } from "./TableScrollRegionPlugin.js";
|
|
31
|
+
import { TableColumnFloorPlugin } from "./TableColumnFloorPlugin.js";
|
|
32
|
+
import { CodeBlockHeaderPlugin } from "./CodeBlockHeaderPlugin.js";
|
|
33
|
+
import { TaskCheckboxPlugin } from "./TaskCheckboxPlugin.js";
|
|
31
34
|
import { defineExtension } from 'lexical';
|
|
32
35
|
// The same node set as the editor, so anything it writes renders here.
|
|
33
36
|
import { DEFAULT_NODES } from "./editorNodes.js";
|
|
@@ -35,6 +38,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
35
38
|
const styles = {
|
|
36
39
|
root: {
|
|
37
40
|
kzqmXN: "xh8yej3",
|
|
41
|
+
kVAEAm: "x1n2onr6",
|
|
38
42
|
$$css: true
|
|
39
43
|
}
|
|
40
44
|
};
|
|
@@ -225,12 +229,14 @@ export function RichTextView({
|
|
|
225
229
|
hasCellBackgroundColor: false,
|
|
226
230
|
hasTabHandler: false,
|
|
227
231
|
hasHorizontalScroll: true
|
|
228
|
-
}), /*#__PURE__*/_jsx(TableScrollRegionPlugin, {}), /*#__PURE__*/_jsx(RichTextPlugin, {
|
|
232
|
+
}), /*#__PURE__*/_jsx(TableScrollRegionPlugin, {}), /*#__PURE__*/_jsx(TableColumnFloorPlugin, {}), /*#__PURE__*/_jsx(RichTextPlugin, {
|
|
229
233
|
contentEditable: /*#__PURE__*/_jsx(ContentEditable, {
|
|
230
234
|
...VIEW_CONTENT_EDITABLE_PROPS
|
|
231
235
|
}),
|
|
232
236
|
placeholder: null,
|
|
233
237
|
ErrorBoundary: LexicalErrorBoundary
|
|
238
|
+
}), /*#__PURE__*/_jsx(CodeBlockHeaderPlugin, {}), /*#__PURE__*/_jsx(TaskCheckboxPlugin, {
|
|
239
|
+
isReadOnly: true
|
|
234
240
|
}), plugins]
|
|
235
241
|
})
|
|
236
242
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Each column's floor in `ch`, from the text length of every cell, header row
|
|
3
|
+
* first: the longest cell wraps to about two lines, the header reads on one
|
|
4
|
+
* line up to its cap, and every floor stays between the bounds.
|
|
5
|
+
*/
|
|
6
|
+
export declare function tableColumnFloors(rows: ReadonlyArray<ReadonlyArray<number>>): Array<number>;
|
|
7
|
+
/**
|
|
8
|
+
* Sets each top-level table's header cells to their column's floor after
|
|
9
|
+
* every update, so the floors follow edits.
|
|
10
|
+
*/
|
|
11
|
+
export declare function TableColumnFloorPlugin(): null;
|
|
12
|
+
//# sourceMappingURL=TableColumnFloorPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableColumnFloorPlugin.d.ts","sourceRoot":"","sources":["../src/TableColumnFloorPlugin.tsx"],"names":[],"mappings":"AA8BA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GACzC,KAAK,CAAC,MAAM,CAAC,CAiBf;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAsC7C"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file TableColumnFloorPlugin.tsx
|
|
7
|
+
* @input Uses @lexical/react (composer context), @lexical/table, and lexical.
|
|
8
|
+
* @output Exports TableColumnFloorPlugin, which gives each table column core
|
|
9
|
+
* Markdown's readable width floor, and tableColumnFloors, the rule itself.
|
|
10
|
+
* @position Rendered by RichTextEditor and RichTextView. Matches core
|
|
11
|
+
* Markdown's table column floors (spec:AST-061 FR4): automatic table layout
|
|
12
|
+
* already keeps every column at least as wide as its longest word, but a
|
|
13
|
+
* prose column's longest word is short, so a narrow table still wraps one
|
|
14
|
+
* word per line. The floor lets a column's longest cell wrap to about two
|
|
15
|
+
* lines instead, keeps a header label on one line up to a cap, and stays
|
|
16
|
+
* bounded so a table of short columns still fits; a wider table scrolls
|
|
17
|
+
* inside its wrapper. The floors are `ch` on content-box cells, so they
|
|
18
|
+
* follow the reader's font size and cell padding does not eat into them.
|
|
19
|
+
*/
|
|
20
|
+
import { useEffect } from 'react';
|
|
21
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
22
|
+
import { $isTableCellNode, $isTableNode, $isTableRowNode } from '@lexical/table';
|
|
23
|
+
import { $getRoot } from 'lexical';
|
|
24
|
+
const TABLE_COLUMN_MIN_CH = 4;
|
|
25
|
+
const TABLE_COLUMN_MAX_CH = 24;
|
|
26
|
+
const TABLE_COLUMN_TARGET_LINES = 2;
|
|
27
|
+
const TABLE_HEADER_ONE_LINE_MAX_CH = 20;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Each column's floor in `ch`, from the text length of every cell, header row
|
|
31
|
+
* first: the longest cell wraps to about two lines, the header reads on one
|
|
32
|
+
* line up to its cap, and every floor stays between the bounds.
|
|
33
|
+
*/
|
|
34
|
+
export function tableColumnFloors(rows) {
|
|
35
|
+
const [header, ...body] = rows;
|
|
36
|
+
if (header == null) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
return header.map((headerLength, column) => {
|
|
40
|
+
const longest = Math.max(headerLength, ...body.map(row => row[column] ?? 0));
|
|
41
|
+
const bodyFloor = Math.ceil(longest / TABLE_COLUMN_TARGET_LINES);
|
|
42
|
+
const headerFloor = Math.min(headerLength, TABLE_HEADER_ONE_LINE_MAX_CH);
|
|
43
|
+
return Math.min(TABLE_COLUMN_MAX_CH, Math.max(TABLE_COLUMN_MIN_CH, bodyFloor, headerFloor));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Sets each top-level table's header cells to their column's floor after
|
|
49
|
+
* every update, so the floors follow edits.
|
|
50
|
+
*/
|
|
51
|
+
export function TableColumnFloorPlugin() {
|
|
52
|
+
const [editor] = useLexicalComposerContext();
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
let frame = 0;
|
|
55
|
+
const apply = () => {
|
|
56
|
+
frame = 0;
|
|
57
|
+
editor.getEditorState().read(() => {
|
|
58
|
+
for (const table of $getRoot().getChildren().filter($isTableNode)) {
|
|
59
|
+
const rows = table.getChildren().filter($isTableRowNode).map(row => row.getChildren().filter($isTableCellNode));
|
|
60
|
+
const floors = tableColumnFloors(rows.map(cells => cells.map(cell => cell.getTextContentSize())));
|
|
61
|
+
rows[0]?.forEach((cell, column) => {
|
|
62
|
+
const element = editor.getElementByKey(cell.getKey());
|
|
63
|
+
const floor = `${floors[column]}ch`;
|
|
64
|
+
if (element != null && element.style.minWidth !== floor) {
|
|
65
|
+
element.style.minWidth = floor;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const schedule = () => {
|
|
72
|
+
if (frame === 0) {
|
|
73
|
+
frame = requestAnimationFrame(apply);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const unregister = editor.registerUpdateListener(schedule);
|
|
77
|
+
schedule();
|
|
78
|
+
return () => {
|
|
79
|
+
cancelAnimationFrame(frame);
|
|
80
|
+
unregister();
|
|
81
|
+
};
|
|
82
|
+
}, [editor]);
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type JSX } from 'react';
|
|
2
|
+
/** Marks a task item for the theme (editorTheme.ts). */
|
|
3
|
+
export declare const TASK_ATTRIBUTE = "data-richtext-task";
|
|
4
|
+
export declare function TaskCheckboxPlugin({ isReadOnly, }: {
|
|
5
|
+
readonly isReadOnly: boolean;
|
|
6
|
+
}): JSX.Element;
|
|
7
|
+
//# sourceMappingURL=TaskCheckboxPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskCheckboxPlugin.d.ts","sourceRoot":"","sources":["../src/TaskCheckboxPlugin.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAA6B,KAAK,GAAG,EAAC,MAAM,OAAO,CAAC;AA+B3D,wDAAwD;AACxD,eAAO,MAAM,cAAc,uBAAuB,CAAC;AAgDnD,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,GACX,EAAE;IACD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B,GAAG,GAAG,CAAC,OAAO,CAmId"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file TaskCheckboxPlugin.tsx
|
|
7
|
+
* @input Uses @lexical/react (composer context), @lexical/list, lexical, and
|
|
8
|
+
* core CheckboxInput.
|
|
9
|
+
* @output Exports TaskCheckboxPlugin, which draws a real checkbox beside every
|
|
10
|
+
* task list item: toggling it, or Mod+Enter in the item, checks the item in
|
|
11
|
+
* the editor, and it is read-only in RichTextView.
|
|
12
|
+
* @position Rendered by RichTextEditor and RichTextView inside the positioned
|
|
13
|
+
* element that holds the content editable, like core Markdown's task lists
|
|
14
|
+
* (spec:AST-061 FR5). A list item cannot take the checkbox role (Lexical's
|
|
15
|
+
* own checkbox lists give it one), and nothing can be added inside the
|
|
16
|
+
* editable text; so the item stays a list item, marked for the theme to
|
|
17
|
+
* make room, and the checkbox is a sibling of the editable text, positioned
|
|
18
|
+
* over the space at the start of the item. Plain items in the same list
|
|
19
|
+
* keep their markers. The item owns its checkbox (`aria-owns`), so
|
|
20
|
+
* assistive technology finds the checkbox and its state inside the item, in
|
|
21
|
+
* document order. The checkboxes take no tab stop of their own, which would
|
|
22
|
+
* come after the whole document: in the editor, Mod+Enter checks the item
|
|
23
|
+
* holding the caret, and in the view they are read-only.
|
|
24
|
+
*/
|
|
25
|
+
import * as stylex from '@stylexjs/stylex';
|
|
26
|
+
import { useEffect, useId, useState } from 'react';
|
|
27
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
28
|
+
import { $isListItemNode, $isListNode } from '@lexical/list';
|
|
29
|
+
import { $getNodeByKey, $getRoot } from 'lexical';
|
|
30
|
+
import { CheckboxInput } from '@astryxdesign/core/CheckboxInput';
|
|
31
|
+
import { $getTaskState, $setTaskState, registerTaskListEditing } from "./markdownTaskList.js";
|
|
32
|
+
|
|
33
|
+
/** Where one task item's checkbox goes, in the container's coordinates. */
|
|
34
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
35
|
+
const styles = {
|
|
36
|
+
checkbox: {
|
|
37
|
+
kVAEAm: "x10l6tqk",
|
|
38
|
+
$$css: true
|
|
39
|
+
},
|
|
40
|
+
placement: (top, left) => [{
|
|
41
|
+
k87sOh: top != null ? "xjbys53" : top,
|
|
42
|
+
kbCHJM: left != null ? "xgq9j65" : left,
|
|
43
|
+
$$css: true
|
|
44
|
+
}, {
|
|
45
|
+
"--x-top": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(top),
|
|
46
|
+
"--x-left": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(left)
|
|
47
|
+
}]
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** The width of core CheckboxInput's small control. */
|
|
51
|
+
const CHECKBOX_SIZE = 20;
|
|
52
|
+
|
|
53
|
+
/** Marks a task item for the theme (editorTheme.ts). */
|
|
54
|
+
export const TASK_ATTRIBUTE = 'data-richtext-task';
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Every bulleted list item with text of its own, in document order, and
|
|
58
|
+
* whether it is a task (markdownTaskList.ts).
|
|
59
|
+
*/
|
|
60
|
+
function $bulletItems() {
|
|
61
|
+
const items = [];
|
|
62
|
+
const visit = node => {
|
|
63
|
+
if (!$isListNode(node)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
for (const item of node.getChildren()) {
|
|
67
|
+
if (!$isListItemNode(item)) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const isWrapper = item.getChildrenSize() === 1 && $isListNode(item.getFirstChild());
|
|
71
|
+
if (!isWrapper && node.getListType() !== 'number') {
|
|
72
|
+
items.push({
|
|
73
|
+
item,
|
|
74
|
+
task: $getTaskState(item)
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
item.getChildren().forEach(visit);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
$getRoot().getChildren().forEach(visit);
|
|
81
|
+
return items;
|
|
82
|
+
}
|
|
83
|
+
function samePlacements(a, b) {
|
|
84
|
+
return a.length === b.length && a.every((placement, index) => placement.key === b[index].key && placement.checked === b[index].checked && placement.label === b[index].label && placement.top === b[index].top && placement.left === b[index].left);
|
|
85
|
+
}
|
|
86
|
+
export function TaskCheckboxPlugin({
|
|
87
|
+
isReadOnly
|
|
88
|
+
}) {
|
|
89
|
+
const [editor] = useLexicalComposerContext();
|
|
90
|
+
const idPrefix = useId();
|
|
91
|
+
const [placements, setPlacements] = useState([]);
|
|
92
|
+
|
|
93
|
+
// Enter and Mod+Enter in task items (markdownTaskList.ts).
|
|
94
|
+
useEffect(() => isReadOnly ? undefined : registerTaskListEditing(editor), [editor, isReadOnly]);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
let frame = 0;
|
|
97
|
+
const measure = () => {
|
|
98
|
+
frame = 0;
|
|
99
|
+
const root = editor.getRootElement();
|
|
100
|
+
const container = root?.parentElement;
|
|
101
|
+
if (root == null || container == null) {
|
|
102
|
+
setPlacements(current => current.length === 0 ? current : []);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const origin = container.getBoundingClientRect();
|
|
106
|
+
const next = editor.getEditorState().read(() => $bulletItems().flatMap(({
|
|
107
|
+
item,
|
|
108
|
+
task
|
|
109
|
+
}) => {
|
|
110
|
+
const element = editor.getElementByKey(item.getKey());
|
|
111
|
+
if (element == null) {
|
|
112
|
+
return [];
|
|
113
|
+
}
|
|
114
|
+
if (task == null) {
|
|
115
|
+
// A plain item keeps its marker and owns no checkbox.
|
|
116
|
+
element.removeAttribute(TASK_ATTRIBUTE);
|
|
117
|
+
element.removeAttribute('aria-owns');
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
// The checkbox below carries the item's state, so the item keeps
|
|
121
|
+
// the list item role Lexical replaces, and owns the checkbox. The
|
|
122
|
+
// attribute lets the theme drop its marker and make room.
|
|
123
|
+
element.setAttribute(TASK_ATTRIBUTE, '');
|
|
124
|
+
element.removeAttribute('role');
|
|
125
|
+
element.removeAttribute('aria-checked');
|
|
126
|
+
element.removeAttribute('tabindex');
|
|
127
|
+
element.setAttribute('aria-owns', `${idPrefix}-task-${item.getKey()}`);
|
|
128
|
+
const box = element.getBoundingClientRect();
|
|
129
|
+
const style = getComputedStyle(element);
|
|
130
|
+
const isRightToLeft = style.direction === 'rtl';
|
|
131
|
+
return [{
|
|
132
|
+
key: item.getKey(),
|
|
133
|
+
checked: task === 'checked',
|
|
134
|
+
label: item.getTextContent(),
|
|
135
|
+
top: box.top - origin.top + parseFloat(style.paddingTop || '0'),
|
|
136
|
+
left: (isRightToLeft ? box.right - CHECKBOX_SIZE : box.left) - origin.left
|
|
137
|
+
}];
|
|
138
|
+
}));
|
|
139
|
+
setPlacements(current => samePlacements(current, next) ? current : next);
|
|
140
|
+
};
|
|
141
|
+
const schedule = () => {
|
|
142
|
+
if (frame === 0) {
|
|
143
|
+
frame = requestAnimationFrame(measure);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(schedule);
|
|
147
|
+
const unregisterRoot = editor.registerRootListener(root => {
|
|
148
|
+
observer?.disconnect();
|
|
149
|
+
if (root != null) {
|
|
150
|
+
observer?.observe(root);
|
|
151
|
+
}
|
|
152
|
+
schedule();
|
|
153
|
+
});
|
|
154
|
+
const unregisterUpdate = editor.registerUpdateListener(schedule);
|
|
155
|
+
window.addEventListener('resize', schedule);
|
|
156
|
+
schedule();
|
|
157
|
+
return () => {
|
|
158
|
+
cancelAnimationFrame(frame);
|
|
159
|
+
observer?.disconnect();
|
|
160
|
+
unregisterRoot();
|
|
161
|
+
unregisterUpdate();
|
|
162
|
+
window.removeEventListener('resize', schedule);
|
|
163
|
+
};
|
|
164
|
+
}, [editor, idPrefix]);
|
|
165
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
166
|
+
children: placements.map(placement => /*#__PURE__*/_jsx("div", {
|
|
167
|
+
id: `${idPrefix}-task-${placement.key}`,
|
|
168
|
+
"data-richtext-task-checkbox": "",
|
|
169
|
+
...stylex.props(styles.checkbox, styles.placement(placement.top, placement.left)),
|
|
170
|
+
children: /*#__PURE__*/_jsx(CheckboxInput, {
|
|
171
|
+
ref: input => {
|
|
172
|
+
// No tab stop after the document; see the file header.
|
|
173
|
+
if (input != null) {
|
|
174
|
+
input.tabIndex = -1;
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
size: "sm",
|
|
178
|
+
label: placement.label,
|
|
179
|
+
isLabelHidden: true,
|
|
180
|
+
value: placement.checked,
|
|
181
|
+
isReadOnly: isReadOnly,
|
|
182
|
+
onChange: checked => {
|
|
183
|
+
editor.update(() => {
|
|
184
|
+
const node = $getNodeByKey(placement.key);
|
|
185
|
+
if ($isListItemNode(node)) {
|
|
186
|
+
$setTaskState(node, checked ? 'checked' : 'unchecked');
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
})
|
|
191
|
+
}, placement.key))
|
|
192
|
+
});
|
|
193
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editorTheme.d.ts","sourceRoot":"","sources":["../src/editorTheme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editorTheme.d.ts","sourceRoot":"","sources":["../src/editorTheme.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAwYhD;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,kBAAkB,CAqEtD"}
|