@astryxdesign/richtext 0.6.5-canary.f261d2f → 0.6.5-canary.f27f749
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 +2 -1
- package/dist/RichTextEditorAutoLinkPlugin.d.ts +10 -11
- package/dist/RichTextEditorAutoLinkPlugin.d.ts.map +1 -1
- package/dist/RichTextEditorAutoLinkPlugin.js +10 -11
- package/dist/RichTextEditorToolbar.d.ts.map +1 -1
- package/dist/RichTextEditorToolbar.js +2 -3
- package/package.json +3 -3
- package/src/RichTextEditorAutoLinkPlugin.tsx +10 -11
- package/src/RichTextEditorToolbar.tsx +2 -3
package/README.md
CHANGED
|
@@ -27,7 +27,8 @@ It ships to npm **only under the `@canary` dist-tag** — there is never a stabl
|
|
|
27
27
|
|
|
28
28
|
> Note: this package is the successor to the experimental `RichTextEditor` that
|
|
29
29
|
> used to live in `@astryxdesign/lab`; that code has moved here so it can be
|
|
30
|
-
> canaried independently
|
|
30
|
+
> canaried independently by an adopting application without a fresh package
|
|
31
|
+
> rollout.
|
|
31
32
|
|
|
32
33
|
## Status
|
|
33
34
|
|
|
@@ -18,22 +18,21 @@
|
|
|
18
18
|
* NOTE: Experimental `@astryxdesign/richtext` component (canary). `lexical` and
|
|
19
19
|
* `@lexical/*` are OPTIONAL peer dependencies — install them to use this.
|
|
20
20
|
*
|
|
21
|
-
* COMPATIBILITY:
|
|
22
|
-
*
|
|
23
|
-
* matcher
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `AutoLinkPlugin`, and EPS can substitute its own plugin in the same slot.
|
|
21
|
+
* COMPATIBILITY: the plugin is deliberately a thin pass-through so an
|
|
22
|
+
* application with its own link conventions can adopt it without forking. It
|
|
23
|
+
* uses the stock matcher shape (`createLinkMatcherWithRegExp` + `attributes`)
|
|
24
|
+
* and new-tab defaults, so a consumer supplies a richer matcher set — an
|
|
25
|
+
* application-specific identifier or ticket syntax, say — through the
|
|
26
|
+
* `matchers` prop without changing the contract. An application needing a
|
|
27
|
+
* hardened transform (expanded separators, code-block exclusion) substitutes
|
|
28
|
+
* its own plugin in the same slot; astryx stays on the upstream
|
|
29
|
+
* `AutoLinkPlugin`.
|
|
31
30
|
*/
|
|
32
31
|
import { type LinkMatcher } from '@lexical/react/LexicalAutoLinkPlugin';
|
|
33
32
|
/**
|
|
34
33
|
* Attributes written onto every auto-created link so it opens in a new tab.
|
|
35
34
|
* `rel="noopener noreferrer"` is required whenever `target="_blank"` is set, to
|
|
36
|
-
* prevent reverse-tabnabbing.
|
|
35
|
+
* prevent reverse-tabnabbing.
|
|
37
36
|
*/
|
|
38
37
|
export declare const NEW_TAB_LINK_ATTRIBUTES: {
|
|
39
38
|
readonly target: "_blank";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditorAutoLinkPlugin.d.ts","sourceRoot":"","sources":["../src/RichTextEditorAutoLinkPlugin.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"RichTextEditorAutoLinkPlugin.d.ts","sourceRoot":"","sources":["../src/RichTextEditorAutoLinkPlugin.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,sCAAsC,CAAC;AAG9C;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;CAG1B,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,WAAW,EAc9C,CAAC;AAEF,MAAM,WAAW,iCAAiC;IAChD;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACjE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,QAAgC,EAChC,QAAQ,GACT,EAAE,iCAAiC,+BAEnC;yBALe,4BAA4B"}
|
|
@@ -22,16 +22,15 @@
|
|
|
22
22
|
* NOTE: Experimental `@astryxdesign/richtext` component (canary). `lexical` and
|
|
23
23
|
* `@lexical/*` are OPTIONAL peer dependencies — install them to use this.
|
|
24
24
|
*
|
|
25
|
-
* COMPATIBILITY:
|
|
26
|
-
*
|
|
27
|
-
* matcher
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* `AutoLinkPlugin`, and EPS can substitute its own plugin in the same slot.
|
|
25
|
+
* COMPATIBILITY: the plugin is deliberately a thin pass-through so an
|
|
26
|
+
* application with its own link conventions can adopt it without forking. It
|
|
27
|
+
* uses the stock matcher shape (`createLinkMatcherWithRegExp` + `attributes`)
|
|
28
|
+
* and new-tab defaults, so a consumer supplies a richer matcher set — an
|
|
29
|
+
* application-specific identifier or ticket syntax, say — through the
|
|
30
|
+
* `matchers` prop without changing the contract. An application needing a
|
|
31
|
+
* hardened transform (expanded separators, code-block exclusion) substitutes
|
|
32
|
+
* its own plugin in the same slot; astryx stays on the upstream
|
|
33
|
+
* `AutoLinkPlugin`.
|
|
35
34
|
*/
|
|
36
35
|
import { AutoLinkPlugin, createLinkMatcherWithRegExp } from '@lexical/react/LexicalAutoLinkPlugin';
|
|
37
36
|
import { URL_MATCHER, EMAIL_MATCHER, sanitizeUrl } from "./linkUtils.js";
|
|
@@ -39,7 +38,7 @@ import { URL_MATCHER, EMAIL_MATCHER, sanitizeUrl } from "./linkUtils.js";
|
|
|
39
38
|
/**
|
|
40
39
|
* Attributes written onto every auto-created link so it opens in a new tab.
|
|
41
40
|
* `rel="noopener noreferrer"` is required whenever `target="_blank"` is set, to
|
|
42
|
-
* prevent reverse-tabnabbing.
|
|
41
|
+
* prevent reverse-tabnabbing.
|
|
43
42
|
*/
|
|
44
43
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
45
44
|
export const NEW_TAB_LINK_ATTRIBUTES = {
|
|
@@ -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;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,+
|
|
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"}
|
|
@@ -431,9 +431,8 @@ export function RichTextEditorToolbar({
|
|
|
431
431
|
setActiveFormats(formats);
|
|
432
432
|
|
|
433
433
|
// Link active state — a link is "active" when the caret/selection anchor
|
|
434
|
-
// sits inside a LinkNode (or its immediate parent is one)
|
|
435
|
-
//
|
|
436
|
-
// the implementation astryx aims to be swappable with.
|
|
434
|
+
// sits inside a LinkNode (or its immediate parent is one):
|
|
435
|
+
// `$isLinkNode(parent) || $isLinkNode(node)`.
|
|
437
436
|
const node = selection.anchor.getNode();
|
|
438
437
|
const parent = node.getParent();
|
|
439
438
|
const linkNode = $isLinkNode(node) ? node : $isLinkNode(parent) ? parent : null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/richtext",
|
|
3
3
|
"displayName": "Rich Text",
|
|
4
|
-
"version": "0.6.5-canary.
|
|
4
|
+
"version": "0.6.5-canary.f27f749",
|
|
5
5
|
"description": "Astryx rich text — a Lexical-based rich text editor and viewer. Published to npm only under the @canary dist-tag for early testing; never released as a stable (latest) version.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
7
7
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@stylexjs/stylex": ">=0.10.0",
|
|
53
|
-
"@astryxdesign/core": "0.6.5-canary.
|
|
53
|
+
"@astryxdesign/core": "0.6.5-canary.f27f749",
|
|
54
54
|
"react": ">=19.0.0",
|
|
55
55
|
"react-dom": ">=19.0.0",
|
|
56
56
|
"lexical": "^0.46.0",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
}
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@astryxdesign/cli": "0.6.5-canary.
|
|
104
|
+
"@astryxdesign/cli": "0.6.5-canary.f27f749",
|
|
105
105
|
"@babel/cli": "^7.29.7",
|
|
106
106
|
"@babel/core": "^7.29.7",
|
|
107
107
|
"@babel/preset-react": "^7.29.7",
|
|
@@ -22,16 +22,15 @@
|
|
|
22
22
|
* NOTE: Experimental `@astryxdesign/richtext` component (canary). `lexical` and
|
|
23
23
|
* `@lexical/*` are OPTIONAL peer dependencies — install them to use this.
|
|
24
24
|
*
|
|
25
|
-
* COMPATIBILITY:
|
|
26
|
-
*
|
|
27
|
-
* matcher
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* `AutoLinkPlugin`, and EPS can substitute its own plugin in the same slot.
|
|
25
|
+
* COMPATIBILITY: the plugin is deliberately a thin pass-through so an
|
|
26
|
+
* application with its own link conventions can adopt it without forking. It
|
|
27
|
+
* uses the stock matcher shape (`createLinkMatcherWithRegExp` + `attributes`)
|
|
28
|
+
* and new-tab defaults, so a consumer supplies a richer matcher set — an
|
|
29
|
+
* application-specific identifier or ticket syntax, say — through the
|
|
30
|
+
* `matchers` prop without changing the contract. An application needing a
|
|
31
|
+
* hardened transform (expanded separators, code-block exclusion) substitutes
|
|
32
|
+
* its own plugin in the same slot; astryx stays on the upstream
|
|
33
|
+
* `AutoLinkPlugin`.
|
|
35
34
|
*/
|
|
36
35
|
|
|
37
36
|
import {
|
|
@@ -44,7 +43,7 @@ import {URL_MATCHER, EMAIL_MATCHER, sanitizeUrl} from './linkUtils';
|
|
|
44
43
|
/**
|
|
45
44
|
* Attributes written onto every auto-created link so it opens in a new tab.
|
|
46
45
|
* `rel="noopener noreferrer"` is required whenever `target="_blank"` is set, to
|
|
47
|
-
* prevent reverse-tabnabbing.
|
|
46
|
+
* prevent reverse-tabnabbing.
|
|
48
47
|
*/
|
|
49
48
|
export const NEW_TAB_LINK_ATTRIBUTES = {
|
|
50
49
|
target: '_blank',
|
|
@@ -526,9 +526,8 @@ export function RichTextEditorToolbar({
|
|
|
526
526
|
setActiveFormats(formats);
|
|
527
527
|
|
|
528
528
|
// Link active state — a link is "active" when the caret/selection anchor
|
|
529
|
-
// sits inside a LinkNode (or its immediate parent is one)
|
|
530
|
-
//
|
|
531
|
-
// the implementation astryx aims to be swappable with.
|
|
529
|
+
// sits inside a LinkNode (or its immediate parent is one):
|
|
530
|
+
// `$isLinkNode(parent) || $isLinkNode(node)`.
|
|
532
531
|
const node = selection.anchor.getNode();
|
|
533
532
|
const parent = node.getParent();
|
|
534
533
|
const linkNode = $isLinkNode(node)
|