@astryxdesign/richtext 0.7.15-canary.gea16e8d → 0.7.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @astryxdesign/richtext
2
2
 
3
+ # 0.7.15
4
+
5
+ #### Fixes
6
+
7
+ - useLinkify and RichTextEditorAutoLinkPlugin: email detection now takes linear time. A long word with no email in it, such as a pasted hash or base64 string, no longer freezes the page for seconds. Valid email addresses link as before, with three exceptions. In the rich-text editor, an address directly after a period no longer links, and a quoted local part ends at the next quote. In useLinkify, a fragment glued to the end of an earlier address no longer links on its own. (#11306)
8
+ - RichTextEditor: importing Markdown no longer freezes the page on a block that has a backtick and, below its first line, a line with a `|`, a dash and a long run of spaces. The check for a table delimiter row now takes linear time; which lines count as delimiter rows is unchanged. (#11338)
9
+
10
+ #### Contributors
11
+
12
+ Thanks to everyone who contributed to this release:
13
+
14
+ - @ChenyangLi4288
15
+ - @cixzhang
16
+
17
+ ---
18
+
3
19
  # 0.7.14
4
20
 
5
21
  ---
@@ -1 +1 @@
1
- {"version":3,"file":"markdownCharacterReferences.d.ts","sourceRoot":"","sources":["../src/markdownCharacterReferences.ts"],"names":[],"mappings":"AAiCA,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAC;AAMjB;;;GAGG;AACH,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,GAC5B;IAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAC,GACrD;IAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAC,GAC5B;IAAC,QAAQ,CAAC,I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Q,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjD;AA2FD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CAwErE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,IAAI,CAgCN;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,GACf,iBAAiB,CA+EnB;AAmDD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,IAAI,CAsCN"}
@@ -741,8 +741,20 @@ function hasUnescapedPipe(text) {
741
741
  return false;
742
742
  }
743
743
 
744
- /** A GFM table's delimiter row: cells of hyphens with optional colons. */
745
- const TABLE_DELIMITER_ROW = /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/;
744
+ /**
745
+ * Test each cell on its own. One regex over the whole row backtracks in
746
+ * quadratic time on a long run of spaces.
747
+ */
748
+ function isTableDelimiterRow(line) {
749
+ let body = line.trim();
750
+ if (body.startsWith('|')) {
751
+ body = body.slice(1);
752
+ }
753
+ if (body.endsWith('|')) {
754
+ body = body.slice(0, -1);
755
+ }
756
+ return body.split('|').every(cell => /^:?-+:?$/.test(cell.trim()));
757
+ }
746
758
 
747
759
  /**
748
760
  * The ranges of `markdown` a code span must not start in: inline link
@@ -780,7 +792,7 @@ function tableRowRanges(markdown) {
780
792
  }
781
793
  for (let index = 1; index < lines.length; index++) {
782
794
  const line = lines[index];
783
- if (line.includes('|') && TABLE_DELIMITER_ROW.test(line) && lines[index - 1].includes('|')) {
795
+ if (line.includes('|') && isTableDelimiterRow(line) && lines[index - 1].includes('|')) {
784
796
  let end = index + 1;
785
797
  while (end < lines.length && lines[end].trim() !== '') {
786
798
  end++;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astryxdesign/richtext",
3
3
  "displayName": "Rich Text",
4
- "version": "0.7.15-canary.gea16e8d",
4
+ "version": "0.7.15",
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",
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@stylexjs/stylex": ">=0.10.0",
69
- "@astryxdesign/core": "0.7.15-canary.gea16e8d",
69
+ "@astryxdesign/core": "0.7.15",
70
70
  "react": ">=19.0.0",
71
71
  "react-dom": ">=19.0.0",
72
72
  "lexical": "^0.52.0",
@@ -125,8 +125,6 @@
125
125
  }
126
126
  },
127
127
  "devDependencies": {
128
- "@astryxdesign/a11y-spec": "0.7.15-canary.gea16e8d",
129
- "@astryxdesign/cli": "0.7.15-canary.gea16e8d",
130
128
  "@babel/cli": "^7.29.7",
131
129
  "@babel/core": "^7.29.7",
132
130
  "@babel/preset-react": "^7.29.7",
@@ -145,7 +143,9 @@
145
143
  "@lexical/utils": "^0.52.0",
146
144
  "@stylexjs/babel-plugin": "^0.19.1",
147
145
  "@testing-library/react": "^16.3.3",
148
- "lexical": "^0.52.0"
146
+ "lexical": "^0.52.0",
147
+ "@astryxdesign/a11y-spec": "0.0.0",
148
+ "@astryxdesign/cli": "0.7.15"
149
149
  },
150
150
  "scripts": {
151
151
  "build": "node ../../scripts/clean-dist.mjs && pnpm build:esm && tsc --project tsconfig.build.json && node ../../scripts/add-declaration-extensions.mjs && pnpm build:css && node ../../scripts/check-no-dev-jsx.mjs && node ../../scripts/check-fully-specified.mjs",
@@ -747,8 +747,20 @@ function hasUnescapedPipe(text: string): boolean {
747
747
  return false;
748
748
  }
749
749
 
750
- /** A GFM table's delimiter row: cells of hyphens with optional colons. */
751
- const TABLE_DELIMITER_ROW = /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/;
750
+ /**
751
+ * Test each cell on its own. One regex over the whole row backtracks in
752
+ * quadratic time on a long run of spaces.
753
+ */
754
+ function isTableDelimiterRow(line: string): boolean {
755
+ let body = line.trim();
756
+ if (body.startsWith('|')) {
757
+ body = body.slice(1);
758
+ }
759
+ if (body.endsWith('|')) {
760
+ body = body.slice(0, -1);
761
+ }
762
+ return body.split('|').every(cell => /^:?-+:?$/.test(cell.trim()));
763
+ }
752
764
 
753
765
  /**
754
766
  * The ranges of `markdown` a code span must not start in: inline link
@@ -795,7 +807,7 @@ function tableRowRanges(markdown: string): Array<readonly [number, number]> {
795
807
  const line = lines[index];
796
808
  if (
797
809
  line.includes('|') &&
798
- TABLE_DELIMITER_ROW.test(line) &&
810
+ isTableDelimiterRow(line) &&
799
811
  lines[index - 1].includes('|')
800
812
  ) {
801
813
  let end = index + 1;