@haklex/rich-editor 0.0.66 → 0.0.67
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/{SubmitShortcutPlugin-WQpet-vq.js → SubmitShortcutPlugin-BRK63XHl.js} +17 -18
- package/dist/index.mjs +1 -1
- package/dist/plugins/BlockIdPlugin.d.ts.map +1 -1
- package/dist/plugins-entry.mjs +1 -1
- package/dist/styles/article.css.d.ts.map +1 -1
- package/dist/transformers/footnote.d.ts.map +1 -1
- package/dist/transformers/grid-container.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -479,7 +479,7 @@ const FOOTNOTE_TRANSFORMER = {
|
|
|
479
479
|
const FOOTNOTE_SECTION_TRANSFORMER = {
|
|
480
480
|
...FOOTNOTE_SECTION_TRANSFORMER$1,
|
|
481
481
|
dependencies: [FootnoteSectionNode],
|
|
482
|
-
regExp: /^\[\^(\w+)\]
|
|
482
|
+
regExp: /^\[\^(\w+)\]:[\t ]+(\S.*)$/,
|
|
483
483
|
replace: (parentNode, _children, match) => {
|
|
484
484
|
const identifier = match[1];
|
|
485
485
|
const content = match[2];
|
|
@@ -571,7 +571,7 @@ ${content}
|
|
|
571
571
|
${body}
|
|
572
572
|
:::`;
|
|
573
573
|
},
|
|
574
|
-
regExp:
|
|
574
|
+
regExp: /\b\B/,
|
|
575
575
|
replace: () => {
|
|
576
576
|
},
|
|
577
577
|
type: "element"
|
|
@@ -649,8 +649,8 @@ function detectMarkdown(text) {
|
|
|
649
649
|
let score = 0;
|
|
650
650
|
if (/^#{1,6}\s+\S/m.test(text)) score += 5;
|
|
651
651
|
if (/^```[\w-]*$/m.test(text)) score += 5;
|
|
652
|
-
if (/\[
|
|
653
|
-
if (/!\[
|
|
652
|
+
if (/\[[^\]]+\]\([^)]+\)/.test(text)) score += 4;
|
|
653
|
+
if (/!\[[^\]]*\]\([^)]+\)/.test(text)) score += 5;
|
|
654
654
|
if (/^\|.+\|$/m.test(text) && /^\|[\s:|-]+\|$/m.test(text)) score += 5;
|
|
655
655
|
if (/^>\s*\[!(?:note|tip|warning|caution|important)\]/im.test(text)) score += 5;
|
|
656
656
|
if (/^[*-]\s+\[[ x]\]/m.test(text)) score += 4;
|
|
@@ -785,11 +785,12 @@ function hasDuplicateOrMissingId(children) {
|
|
|
785
785
|
return false;
|
|
786
786
|
}
|
|
787
787
|
function generateBlockId(used) {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
788
|
+
while (true) {
|
|
789
|
+
const id = nanoid(8);
|
|
790
|
+
if (!used.has(id)) {
|
|
791
|
+
return id;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
793
794
|
}
|
|
794
795
|
function pickKeeperKey(nodes, previousKeys) {
|
|
795
796
|
if (!nodes.length) return null;
|
|
@@ -845,15 +846,13 @@ function BlockIdPlugin() {
|
|
|
845
846
|
if (hasDuplicateOrMissingId(initialChildren)) {
|
|
846
847
|
normalizeRootBlockIds(editor, /* @__PURE__ */ new Map());
|
|
847
848
|
}
|
|
848
|
-
return editor.registerUpdateListener(
|
|
849
|
-
(
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
}
|
|
856
|
-
);
|
|
849
|
+
return editor.registerUpdateListener(({ tags, editorState, prevEditorState }) => {
|
|
850
|
+
if (tags.has(NORMALIZATION_TAG)) return;
|
|
851
|
+
const children = collectRootChildren(editorState);
|
|
852
|
+
if (!hasDuplicateOrMissingId(children)) return;
|
|
853
|
+
const previousIdIndex = buildPreviousIdIndex(prevEditorState);
|
|
854
|
+
normalizeRootBlockIds(editor, previousIdIndex);
|
|
855
|
+
});
|
|
857
856
|
}, [editor]);
|
|
858
857
|
return null;
|
|
859
858
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FootnotePlugin, O as OnChangePlugin, S as SubmitShortcutPlugin, E as EditorRefPlugin, a as AutoFocusPlugin, d as ImageUploadProvider, g as defaultImageUpload, C as CorePlugins, I as ImageUploadPlugin, L as LinkFaviconPlugin, c as BlockIdPlugin, f as blockIdState } from "./SubmitShortcutPlugin-
|
|
1
|
+
import { F as FootnotePlugin, O as OnChangePlugin, S as SubmitShortcutPlugin, E as EditorRefPlugin, a as AutoFocusPlugin, d as ImageUploadProvider, g as defaultImageUpload, C as CorePlugins, I as ImageUploadPlugin, L as LinkFaviconPlugin, c as BlockIdPlugin, f as blockIdState } from "./SubmitShortcutPlugin-BRK63XHl.js";
|
|
2
2
|
import { L } from "./LinkFavicon-B9SOaYCR.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { s as setResolvedEditNodes, a as allEditNodes } from "./node-registry-CSRSWJ0q.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockIdPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/BlockIdPlugin.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY,kDAEvB,
|
|
1
|
+
{"version":3,"file":"BlockIdPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/BlockIdPlugin.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY,kDAEvB,CAAC;AAwGH,wBAAgB,aAAa,SAsB5B"}
|
package/dist/plugins-entry.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, a, b, B, c, C, E, F, H, I, d, L, M, e, O, S, f, g, u } from "./SubmitShortcutPlugin-
|
|
1
|
+
import { A, a, b, B, c, C, E, F, H, I, d, L, M, e, O, S, f, g, u } from "./SubmitShortcutPlugin-BRK63XHl.js";
|
|
2
2
|
import { A as A2, I as I2, K, M as M2 } from "./MermaidPlugin-CIQbyjXF.js";
|
|
3
3
|
export {
|
|
4
4
|
A as ALL_TRANSFORMERS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"article.css.d.ts","sourceRoot":"","sources":["../../src/styles/article.css.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"article.css.d.ts","sourceRoot":"","sources":["../../src/styles/article.css.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,cAAc,QAAkD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footnote.d.ts","sourceRoot":"","sources":["../../src/transformers/footnote.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"footnote.d.ts","sourceRoot":"","sources":["../../src/transformers/footnote.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AASlF,eAAO,MAAM,oBAAoB,EAAE,oBAOlC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,kBAuB1C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-container.d.ts","sourceRoot":"","sources":["../../src/transformers/grid-container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"grid-container.d.ts","sourceRoot":"","sources":["../../src/transformers/grid-container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAU5D,eAAO,MAAM,gCAAgC,EAAE,kBAW9C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.67",
|
|
4
4
|
"description": "Core rich text editor based on Lexical",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"@base-ui/react": "^1.1.0",
|
|
49
49
|
"nanoid": "^5.1.6",
|
|
50
50
|
"thumbhash": "^0.1.1",
|
|
51
|
-
"@haklex/rich-editor-ui": "0.0.
|
|
52
|
-
"@haklex/rich-headless": "0.0.
|
|
53
|
-
"@haklex/rich-style-token": "0.0.
|
|
51
|
+
"@haklex/rich-editor-ui": "0.0.67",
|
|
52
|
+
"@haklex/rich-headless": "0.0.67",
|
|
53
|
+
"@haklex/rich-style-token": "0.0.67"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@lexical/code": "^0.41.0",
|