@astryxdesign/richtext 0.6.5-canary.a9c080d → 0.6.5-canary.aa0134e
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/RichTextEditor.d.ts +0 -10
- package/dist/RichTextEditor.d.ts.map +1 -1
- package/dist/RichTextEditor.js +1 -6
- package/dist/RichTextEditorToolbar.d.ts.map +1 -1
- package/dist/RichTextEditorToolbar.js +3 -11
- package/dist/RichTextView.d.ts +1 -11
- package/dist/RichTextView.d.ts.map +1 -1
- package/dist/RichTextView.js +1 -9
- package/dist/editorTheme.d.ts.map +1 -1
- package/dist/editorTheme.js +0 -7
- package/dist/markdownCharacterReferences.d.ts +3 -58
- package/dist/markdownCharacterReferences.d.ts.map +1 -1
- package/dist/markdownCharacterReferences.js +10 -392
- package/dist/markdownExtensionNode.d.ts +6 -30
- package/dist/markdownExtensionNode.d.ts.map +1 -1
- package/dist/markdownExtensionNode.js +9 -128
- package/dist/markdownSource.d.ts.map +1 -1
- package/dist/markdownSource.js +25 -58
- package/dist/markdownTable.d.ts +1 -4
- package/dist/markdownTable.d.ts.map +1 -1
- package/dist/markdownTable.js +4 -9
- package/package.json +4 -4
- package/src/RichTextEditor.doc.mjs +1 -7
- package/src/RichTextEditor.tsx +0 -18
- package/src/RichTextEditorToolbar.tsx +2 -15
- package/src/RichTextView.tsx +0 -21
- package/src/__tests__/MarkdownParitySandbox.a11y.chromium.spec.ts +10 -123
- package/src/editorTheme.ts +2 -7
- package/src/markdownCharacterReferences.ts +15 -371
- package/src/markdownExtensionNode.ts +8 -169
- package/src/markdownExtensions.test.ts +2 -97
- package/src/markdownSource.ts +25 -80
- package/src/markdownTable.ts +3 -19
- package/dist/MarkdownExtensionsPlugin.d.ts +0 -17
- package/dist/MarkdownExtensionsPlugin.d.ts.map +0 -1
- package/dist/MarkdownExtensionsPlugin.js +0 -185
- package/dist/markdownCodeFence.d.ts +0 -4
- package/dist/markdownCodeFence.d.ts.map +0 -1
- package/dist/markdownCodeFence.js +0 -153
- package/dist/markdownLink.d.ts +0 -5
- package/dist/markdownLink.d.ts.map +0 -1
- package/dist/markdownLink.js +0 -82
- package/src/MarkdownExtensionsPlugin.test.tsx +0 -279
- package/src/MarkdownExtensionsPlugin.tsx +0 -289
- package/src/__tests__/MarkdownPlugins.a11y.chromium.spec.ts +0 -372
- package/src/markdownAngleDestinations.test.ts +0 -134
- package/src/markdownCodeFence.test.ts +0 -181
- package/src/markdownCodeFence.ts +0 -193
- package/src/markdownEscapes.test.ts +0 -234
- package/src/markdownExtensionSelection.test.ts +0 -102
- package/src/markdownLink.ts +0 -86
- package/src/markdownRefusedLinks.test.tsx +0 -193
package/dist/RichTextEditor.d.ts
CHANGED
|
@@ -26,7 +26,6 @@ import { type ReactNode } from 'react';
|
|
|
26
26
|
import { type FieldStatusVariant } from '@astryxdesign/core/Field';
|
|
27
27
|
import type { BaseProps } from '@astryxdesign/core';
|
|
28
28
|
import { type SizeValue } from '@astryxdesign/core/utils';
|
|
29
|
-
import type { RichTextMarkdownExtension } from './markdownExtensions';
|
|
30
29
|
import { type Transformer } from '@lexical/markdown';
|
|
31
30
|
export type { Transformer } from '@lexical/markdown';
|
|
32
31
|
import { type EditorState, type Klass, type LexicalEditor, type LexicalNode } from 'lexical';
|
|
@@ -202,15 +201,6 @@ export interface RichTextEditorProps extends Omit<BaseProps, 'onChange' | 'defau
|
|
|
202
201
|
* the serialization APIs added in later phases.
|
|
203
202
|
*/
|
|
204
203
|
transformers?: ReadonlyArray<Transformer>;
|
|
205
|
-
/**
|
|
206
|
-
* Markdown plugins whose nodes this surface draws, each adopted with
|
|
207
|
-
* `createRichTextExtension` (spec:AST-064). A plugin node renders exactly as
|
|
208
|
-
* core `Markdown` renders it, and one whose plugin is not given here shows
|
|
209
|
-
* its source. Pass the extensions the content was converted with. Create
|
|
210
|
-
* them in a client module: they hold the plugins' functions, so they are not
|
|
211
|
-
* serializable props.
|
|
212
|
-
*/
|
|
213
|
-
markdownExtensions?: ReadonlyArray<RichTextMarkdownExtension>;
|
|
214
204
|
/** Whether to automatically focus the editor on mount. @default false */
|
|
215
205
|
hasAutoFocus?: boolean;
|
|
216
206
|
/**
|
|
@@ -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;AAqBhF,OAAO,
|
|
1
|
+
{"version":3,"file":"RichTextEditor.d.ts","sourceRoot":"","sources":["../src/RichTextEditor.tsx"],"names":[],"mappings":"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"}
|
package/dist/RichTextEditor.js
CHANGED
|
@@ -53,7 +53,6 @@ import { TextSemanticsExtension } from "./textSemantics.js";
|
|
|
53
53
|
import { TableColumnFloorPlugin } from "./TableColumnFloorPlugin.js";
|
|
54
54
|
import { CodeBlockHeaderPlugin } from "./CodeBlockHeaderPlugin.js";
|
|
55
55
|
import { CodeSyntaxPlugin } from "./CodeSyntaxPlugin.js";
|
|
56
|
-
import { MarkdownExtensionsPlugin } from "./MarkdownExtensionsPlugin.js";
|
|
57
56
|
import { TaskCheckboxPlugin } from "./TaskCheckboxPlugin.js";
|
|
58
57
|
import { $generateHtmlFromNodes } from '@lexical/html';
|
|
59
58
|
import { DEFAULT_NODES } from "./editorNodes.js";
|
|
@@ -225,7 +224,6 @@ export const RichTextEditor = /*#__PURE__*/forwardRef(function RichTextEditor({
|
|
|
225
224
|
plugins,
|
|
226
225
|
hasMarkdownShortcuts = true,
|
|
227
226
|
transformers = DEFAULT_TRANSFORMERS,
|
|
228
|
-
markdownExtensions,
|
|
229
227
|
hasAutoFocus = false,
|
|
230
228
|
tabEscapeHint = DEFAULT_TAB_ESCAPE_HINT,
|
|
231
229
|
maxLength,
|
|
@@ -365,10 +363,7 @@ export const RichTextEditor = /*#__PURE__*/forwardRef(function RichTextEditor({
|
|
|
365
363
|
hasCellBackgroundColor: false,
|
|
366
364
|
hasTabHandler: false,
|
|
367
365
|
hasHorizontalScroll: true
|
|
368
|
-
}), /*#__PURE__*/_jsx(TableColumnFloorPlugin, {}), /*#__PURE__*/_jsx(CodeBlockHeaderPlugin, {}), /*#__PURE__*/_jsx(CodeSyntaxPlugin, {}),
|
|
369
|
-
extensions: markdownExtensions,
|
|
370
|
-
transformers: markdownTransformers
|
|
371
|
-
}) : null, /*#__PURE__*/_jsx(TabIndentationPlugin, {}), /*#__PURE__*/_jsx(TabFocusEscapePlugin, {}), hasMarkdownShortcuts && /*#__PURE__*/_jsx(MarkdownShortcutPlugin, {
|
|
366
|
+
}), /*#__PURE__*/_jsx(TableColumnFloorPlugin, {}), /*#__PURE__*/_jsx(CodeBlockHeaderPlugin, {}), /*#__PURE__*/_jsx(CodeSyntaxPlugin, {}), /*#__PURE__*/_jsx(TabIndentationPlugin, {}), /*#__PURE__*/_jsx(TabFocusEscapePlugin, {}), hasMarkdownShortcuts && /*#__PURE__*/_jsx(MarkdownShortcutPlugin, {
|
|
372
367
|
transformers: markdownTransformers
|
|
373
368
|
}), hasAutoFocus && /*#__PURE__*/_jsx(AutoFocusOnMount, {}), onChange && /*#__PURE__*/_jsx(OnChangePlugin, {
|
|
374
369
|
onChange: onChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditorToolbar.d.ts","sourceRoot":"","sources":["../src/RichTextEditorToolbar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RichTextEditorToolbar.d.ts","sourceRoot":"","sources":["../src/RichTextEditorToolbar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAgHf;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;CAgBrB,CAAC;AAwOX,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IAClD;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACnE;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,KAAyB,EACzB,aAAkC,EAClC,IAAW,EACX,OAAc,EACd,YAAY,EACZ,iBAAwB,EACxB,UAAU,GACX,EAAE,0BAA0B,+BA6d5B;yBAree,qBAAqB"}
|
|
@@ -51,9 +51,8 @@ import { Button } from '@astryxdesign/core/Button';
|
|
|
51
51
|
import { Stack } from '@astryxdesign/core/Stack';
|
|
52
52
|
import { HStack, Layout, LayoutContent, LayoutFooter } from '@astryxdesign/core/Layout';
|
|
53
53
|
import { getExtendedIcon } from '@astryxdesign/core/Icon';
|
|
54
|
-
import { FORMAT_TEXT_COMMAND, UNDO_COMMAND, REDO_COMMAND, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, SELECTION_CHANGE_COMMAND, KEY_DOWN_COMMAND, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_NORMAL, IS_APPLE, isExactShortcutMatch, $getSelection, $
|
|
54
|
+
import { FORMAT_TEXT_COMMAND, UNDO_COMMAND, REDO_COMMAND, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, SELECTION_CHANGE_COMMAND, KEY_DOWN_COMMAND, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_NORMAL, IS_APPLE, isExactShortcutMatch, $getSelection, $isRangeSelection, $setSelection, $createParagraphNode, $createTextNode } from 'lexical';
|
|
55
55
|
import { sanitizeUrl } from "./linkUtils.js";
|
|
56
|
-
import { $selectedExtensionNodesOnly } from "./markdownExtensionNode.js";
|
|
57
56
|
|
|
58
57
|
/** Block types exposed by the toolbar's format selector. */
|
|
59
58
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -420,23 +419,16 @@ export function RichTextEditorToolbar({
|
|
|
420
419
|
const [linkError, setLinkError] = useState('');
|
|
421
420
|
const $syncToolbar = useCallback(() => {
|
|
422
421
|
const selection = $getSelection();
|
|
423
|
-
if (!$isRangeSelection(selection)
|
|
422
|
+
if (!$isRangeSelection(selection)) {
|
|
424
423
|
return;
|
|
425
424
|
}
|
|
426
425
|
const formats = new Set();
|
|
427
|
-
// A selection of Markdown plugin nodes alone — a range around them, or
|
|
428
|
-
// a node selection from a click — shows their formats. Any other node
|
|
429
|
-
// selection, such as a rule, has none.
|
|
430
|
-
const nodesOnly = $selectedExtensionNodesOnly(selection);
|
|
431
426
|
for (const fmt of ['bold', 'italic', 'underline', 'strikethrough', 'code']) {
|
|
432
|
-
if (
|
|
427
|
+
if (selection.hasFormat(fmt)) {
|
|
433
428
|
formats.add(fmt);
|
|
434
429
|
}
|
|
435
430
|
}
|
|
436
431
|
setActiveFormats(formats);
|
|
437
|
-
if (!$isRangeSelection(selection)) {
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
432
|
|
|
441
433
|
// Link active state — a link is "active" when the caret/selection anchor
|
|
442
434
|
// sits inside a LinkNode (or its immediate parent is one):
|
package/dist/RichTextView.d.ts
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { type ReactNode } from 'react';
|
|
17
17
|
import type { BaseProps } from '@astryxdesign/core';
|
|
18
|
-
import type { RichTextMarkdownExtension } from './markdownExtensions';
|
|
19
18
|
import type { Klass, LexicalNode } from 'lexical';
|
|
20
19
|
export interface RichTextViewProps extends BaseProps {
|
|
21
20
|
/**
|
|
@@ -28,15 +27,6 @@ export interface RichTextViewProps extends BaseProps {
|
|
|
28
27
|
* the nodes used to author `value` so custom node types deserialize.
|
|
29
28
|
*/
|
|
30
29
|
nodes?: ReadonlyArray<Klass<LexicalNode>>;
|
|
31
|
-
/**
|
|
32
|
-
* Markdown plugins whose nodes this surface draws, each adopted with
|
|
33
|
-
* `createRichTextExtension` (spec:AST-064). A plugin node renders exactly as
|
|
34
|
-
* core `Markdown` renders it, and one whose plugin is not given here shows
|
|
35
|
-
* its source. Pass the extensions the content was converted with. Create
|
|
36
|
-
* them in a client module: they hold the plugins' functions, so they are not
|
|
37
|
-
* serializable props.
|
|
38
|
-
*/
|
|
39
|
-
markdownExtensions?: ReadonlyArray<RichTextMarkdownExtension>;
|
|
40
30
|
/**
|
|
41
31
|
* Additional read-only plugins to render inside the composer (e.g. hover
|
|
42
32
|
* cards, decorators).
|
|
@@ -76,7 +66,7 @@ export interface RichTextViewProps extends BaseProps {
|
|
|
76
66
|
* <RichTextView value={storedEditorStateJSON} />
|
|
77
67
|
* ```
|
|
78
68
|
*/
|
|
79
|
-
export declare function RichTextView({ value, nodes,
|
|
69
|
+
export declare function RichTextView({ value, nodes, plugins, namespace, onParseError, errorFallback, xstyle, className, style, ...rest }: RichTextViewProps): import("react").JSX.Element;
|
|
80
70
|
export declare namespace RichTextView {
|
|
81
71
|
var displayName: string;
|
|
82
72
|
}
|
|
@@ -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;AAclD,OAAO,KAAK,
|
|
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;AAclD,OAAO,KAAK,EAEV,KAAK,EACL,WAAW,EAEZ,MAAM,SAAS,CAAC;AA0CjB,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,+BAwHnB;yBAnIe,YAAY"}
|
package/dist/RichTextView.js
CHANGED
|
@@ -31,7 +31,6 @@ import { TableScrollRegionPlugin } from "./TableScrollRegionPlugin.js";
|
|
|
31
31
|
import { TableColumnFloorPlugin } from "./TableColumnFloorPlugin.js";
|
|
32
32
|
import { CodeBlockHeaderPlugin } from "./CodeBlockHeaderPlugin.js";
|
|
33
33
|
import { CodeSyntaxPlugin } from "./CodeSyntaxPlugin.js";
|
|
34
|
-
import { MarkdownExtensionsPlugin } from "./MarkdownExtensionsPlugin.js";
|
|
35
34
|
import { TaskCheckboxPlugin } from "./TaskCheckboxPlugin.js";
|
|
36
35
|
import { defineExtension } from 'lexical';
|
|
37
36
|
import { TextSemanticsExtension } from "./textSemantics.js";
|
|
@@ -72,9 +71,6 @@ const VIEW_CONTENT_EDITABLE_PROPS = {
|
|
|
72
71
|
'aria-readonly': undefined,
|
|
73
72
|
role: null
|
|
74
73
|
};
|
|
75
|
-
|
|
76
|
-
/** The view imports and exports no Markdown, so it uses no transformers. */
|
|
77
|
-
const NO_TRANSFORMERS = [];
|
|
78
74
|
/**
|
|
79
75
|
* Keeps the rendered content in sync with the `value` prop after mount.
|
|
80
76
|
*
|
|
@@ -135,7 +131,6 @@ function SyncValuePlugin({
|
|
|
135
131
|
export function RichTextView({
|
|
136
132
|
value,
|
|
137
133
|
nodes,
|
|
138
|
-
markdownExtensions,
|
|
139
134
|
plugins,
|
|
140
135
|
namespace = 'astryx-view',
|
|
141
136
|
onParseError,
|
|
@@ -244,10 +239,7 @@ export function RichTextView({
|
|
|
244
239
|
}),
|
|
245
240
|
placeholder: null,
|
|
246
241
|
ErrorBoundary: LexicalErrorBoundary
|
|
247
|
-
}), /*#__PURE__*/_jsx(CodeBlockHeaderPlugin, {}), /*#__PURE__*/_jsx(CodeSyntaxPlugin, {}),
|
|
248
|
-
extensions: markdownExtensions,
|
|
249
|
-
transformers: NO_TRANSFORMERS
|
|
250
|
-
}) : null, /*#__PURE__*/_jsx(TaskCheckboxPlugin, {
|
|
242
|
+
}), /*#__PURE__*/_jsx(CodeBlockHeaderPlugin, {}), /*#__PURE__*/_jsx(CodeSyntaxPlugin, {}), /*#__PURE__*/_jsx(TaskCheckboxPlugin, {
|
|
251
243
|
isReadOnly: true
|
|
252
244
|
}), plugins]
|
|
253
245
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editorTheme.d.ts","sourceRoot":"","sources":["../src/editorTheme.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAsXhD;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,kBAAkB,
|
|
1
|
+
{"version":3,"file":"editorTheme.d.ts","sourceRoot":"","sources":["../src/editorTheme.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAsXhD;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,kBAAkB,CAwDtD"}
|
package/dist/editorTheme.js
CHANGED
|
@@ -236,9 +236,6 @@ export function sharedEditorTheme() {
|
|
|
236
236
|
const className = style => stylex.props(style).className ?? '';
|
|
237
237
|
return {
|
|
238
238
|
paragraph: block(editorTheme.paragraph),
|
|
239
|
-
// A Markdown plugin's block node is spaced and measured as a paragraph,
|
|
240
|
-
// as core Markdown spaces its block (RichTextExtensionNode reads it).
|
|
241
|
-
markdownExtensionBlock: block(editorTheme.paragraph),
|
|
242
239
|
heading: {
|
|
243
240
|
h1: block(editorTheme.h1),
|
|
244
241
|
h2: block(editorTheme.h2),
|
|
@@ -291,10 +288,6 @@ export function sharedEditorTheme() {
|
|
|
291
288
|
hrSelected: {
|
|
292
289
|
className: "xak0ai5 x9ssot5 x19bwoy8 x1eqjuhu"
|
|
293
290
|
}.className,
|
|
294
|
-
// MarkdownExtensionsPlugin puts it on a selected plugin node.
|
|
295
|
-
markdownExtensionSelected: {
|
|
296
|
-
className: "xak0ai5 x9ssot5 x19bwoy8 x1eqjuhu"
|
|
297
|
-
}.className,
|
|
298
291
|
table: block(editorTheme.table),
|
|
299
292
|
// Lexical stamps rows and cells `dir="auto"` too, which would set a cell
|
|
300
293
|
// of English text left-to-right inside a right-to-left document.
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
import { type ElementNode } from 'lexical';
|
|
2
|
-
/**
|
|
3
|
-
* What a stand-in replaced: a reference as written, an escaped `&`, or a
|
|
4
|
-
* backslash-escaped character.
|
|
5
|
-
*/
|
|
2
|
+
/** What a stand-in replaced: a reference as written, or an escaped `&`. */
|
|
6
3
|
type StandIn = {
|
|
7
4
|
readonly kind: 'reference';
|
|
8
5
|
readonly source: string;
|
|
9
6
|
} | {
|
|
10
7
|
readonly kind: 'ampersand';
|
|
11
|
-
} | {
|
|
12
|
-
readonly kind: 'escape';
|
|
13
|
-
readonly character: string;
|
|
14
|
-
} | {
|
|
15
|
-
readonly kind: 'backslash';
|
|
16
|
-
} | {
|
|
17
|
-
readonly kind: 'literal';
|
|
18
|
-
readonly text: string;
|
|
19
8
|
};
|
|
20
9
|
export interface ProtectedMarkdown {
|
|
21
10
|
/** The source with stand-ins in place of references. */
|
|
@@ -23,49 +12,6 @@ export interface ProtectedMarkdown {
|
|
|
23
12
|
/** What each stand-in replaced. */
|
|
24
13
|
readonly standIns: ReadonlyMap<string, StandIn>;
|
|
25
14
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Returns `markdown` with every backslash escape outside code — a backslash
|
|
28
|
-
* before ASCII punctuation — replaced by a private-use stand-in for the
|
|
29
|
-
* escaped character, and every backslash in code by a stand-in for itself,
|
|
30
|
-
* which Lexical would otherwise drop from a code span — except before `|`,
|
|
31
|
-
* which a table reads before its code. A backslash before anything else
|
|
32
|
-
* outside code stays as written. One pass over the source.
|
|
33
|
-
*/
|
|
34
|
-
export declare function protectBackslashEscapes(markdown: string): ProtectedMarkdown;
|
|
35
|
-
/**
|
|
36
|
-
* Whether core Markdown refuses a link to `url`, a destination already
|
|
37
|
-
* decoded: the probe writes it back with every special character escaped.
|
|
38
|
-
* A URL that cannot be written back is refused.
|
|
39
|
-
*/
|
|
40
|
-
export declare function coreRefusesUrl(url: string): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Returns `markdown` with each inline link whose destination core Markdown
|
|
43
|
-
* refuses — `javascript:` and the like — kept from becoming a link
|
|
44
|
-
* (spec:AST-061 FR7). Where core shows the link as its source text, exactly
|
|
45
|
-
* as written, the whole source becomes one stand-in that comes back as that
|
|
46
|
-
* text. Where core reads no link there at all (its link text holds brackets
|
|
47
|
-
* of its own), only the `(` that opens the destination becomes a stand-in,
|
|
48
|
-
* so the text around it reads as core reads it, marks included. Brackets and
|
|
49
|
-
* parentheses pair by nesting, so link text holding brackets is found whole.
|
|
50
|
-
* Linear in the source: pairs come from one pass, and a destination inside a
|
|
51
|
-
* found link is not probed again. Run first, on the source as written;
|
|
52
|
-
* `$unwrapRefusedLinks` catches any link the editor still makes.
|
|
53
|
-
*/
|
|
54
|
-
export declare function protectRefusedLinks(markdown: string): ProtectedMarkdown;
|
|
55
|
-
/**
|
|
56
|
-
* Takes every link under `node` whose URL core Markdown refuses out of its
|
|
57
|
-
* link, leaving its text in place, so no form of link text or destination
|
|
58
|
-
* the source pass did not find can store or draw an unsafe URL.
|
|
59
|
-
*/
|
|
60
|
-
export declare function $unwrapRefusedLinks(node: ElementNode): void;
|
|
61
|
-
/**
|
|
62
|
-
* Returns `markdown` with every parenthesis inside an inline link
|
|
63
|
-
* destination — between the destination's own parentheses, balanced, as core
|
|
64
|
-
* Markdown and CommonMark read them — replaced by a private-use stand-in for
|
|
65
|
-
* itself, outside code. Run after protectBackslashEscapes, so an escaped
|
|
66
|
-
* parenthesis is already a stand-in and never counts toward the balance.
|
|
67
|
-
*/
|
|
68
|
-
export declare function protectLinkDestinationParentheses(markdown: string): ProtectedMarkdown;
|
|
69
15
|
/**
|
|
70
16
|
* Returns `markdown` with every character reference outside code replaced by
|
|
71
17
|
* a private-use stand-in that occurs nowhere else in it, and the escaped `&`
|
|
@@ -74,9 +20,8 @@ export declare function protectLinkDestinationParentheses(markdown: string): Pro
|
|
|
74
20
|
export declare function protectCharacterReferences(markdown: string): ProtectedMarkdown;
|
|
75
21
|
/**
|
|
76
22
|
* Replaces the stand-ins under `node` with the characters their references
|
|
77
|
-
* name
|
|
78
|
-
*
|
|
79
|
-
* link titles. One pass over the text.
|
|
23
|
+
* name — or, in code Lexical read as code, with the references as written —
|
|
24
|
+
* in text, link destinations, and link titles. One pass over the text.
|
|
80
25
|
*/
|
|
81
26
|
export declare function $restoreCharacterReferences(node: ElementNode, standIns: ReadonlyMap<string, StandIn>): void;
|
|
82
27
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdownCharacterReferences.d.ts","sourceRoot":"","sources":["../src/markdownCharacterReferences.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"markdownCharacterReferences.d.ts","sourceRoot":"","sources":["../src/markdownCharacterReferences.ts"],"names":[],"mappings":"AAsBA,OAAO,EAGL,KAAK,WAAW,EAEjB,MAAM,SAAS,CAAC;AAGjB,2EAA2E;AAC3E,KAAK,OAAO,GACR;IAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAC,GACrD;IAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAC,CAAC;AAEjC,MAAM,WAAW,iBAAiB;IAChC,wDAAwD;IACxD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mCAAmC;IACnC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjD;AAyID;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,GACf,iBAAiB,CA+EnB;AA6BD;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,IAAI,CAsCN"}
|