@haklex/rich-editor 0.0.11 → 0.0.13
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/{RichEditor-DHLA-bpl.js → RichEditor-DeAuc6CQ.js} +64 -249
- package/dist/{RichRenderer-BxR2eaIT.js → RichRenderer-CtBjK31O.js} +24 -16
- package/dist/components/RichEditor.d.ts +1 -1
- package/dist/components/RichEditor.d.ts.map +1 -1
- package/dist/components/RichRenderer.d.ts +1 -1
- package/dist/components/RichRenderer.d.ts.map +1 -1
- package/dist/editor.mjs +2 -2
- package/dist/index.mjs +3 -3
- package/dist/plugins/AutoFocusPlugin.d.ts.map +1 -1
- package/dist/renderer.mjs +1 -1
- package/dist/transformers/alert.d.ts.map +1 -1
- package/dist/transformers/container.d.ts.map +1 -1
- package/dist/transformers/footnote.d.ts +0 -6
- package/dist/transformers/footnote.d.ts.map +1 -1
- package/dist/transformers/grid-container.d.ts +3 -0
- package/dist/transformers/grid-container.d.ts.map +1 -0
- package/dist/transformers/insert.d.ts +1 -5
- package/dist/transformers/insert.d.ts.map +1 -1
- package/dist/transformers/katex.d.ts.map +1 -1
- package/dist/transformers/mention.d.ts.map +1 -1
- package/dist/transformers/rich-blocks.d.ts +2 -9
- package/dist/transformers/rich-blocks.d.ts.map +1 -1
- package/dist/transformers/spoiler.d.ts.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/{utils-CFAhGrxg.js → utils-DvP2uSr7.js} +3 -27
- package/package.json +4 -3
|
@@ -9,7 +9,7 @@ import { ListPlugin } from "@lexical/react/LexicalListPlugin";
|
|
|
9
9
|
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
10
10
|
import { TabIndentationPlugin } from "@lexical/react/LexicalTabIndentationPlugin";
|
|
11
11
|
import { TablePlugin } from "@lexical/react/LexicalTablePlugin";
|
|
12
|
-
import { V as $isAlertQuoteNode, W as RendererWrapper, X as AlertRenderer, Y as AlertQuoteNode, Z as $isBannerNode, _ as BannerRenderer, a0 as BannerNode, a1 as normalizeBannerType, a2 as $isCodeBlockNode, a3 as CodeBlockRenderer, a4 as CodeBlockNode, Q as useFootnoteDefinitions, s as FootnoteSectionNode, k as $isGridContainerNode, G as GridContainerNode, e as editorTheme, N as NESTED_EDITOR_NODES, b as builtinNodes, a5 as SpoilerNode, a6 as MentionNode, t as KaTeXInlineNode, K as KaTeXBlockNode, a7 as ImageNode, a8 as FootnoteNode, a9 as VideoNode, L as LinkCardNode, aa as DetailsNode, M as MermaidNode, ab as $createAlertQuoteNode, ac as $createImageNode, ad as $createKaTeXInlineNode, ae as $createKaTeXBlockNode, af as $createBannerNode, ag as $createDetailsNode, ah as $
|
|
12
|
+
import { V as $isAlertQuoteNode, W as RendererWrapper, X as AlertRenderer, Y as AlertQuoteNode, Z as $isBannerNode, _ as BannerRenderer, a0 as BannerNode, a1 as normalizeBannerType, a2 as $isCodeBlockNode, a3 as CodeBlockRenderer, a4 as CodeBlockNode, Q as useFootnoteDefinitions, s as FootnoteSectionNode, k as $isGridContainerNode, G as GridContainerNode, e as editorTheme, N as NESTED_EDITOR_NODES, b as builtinNodes, a5 as SpoilerNode, a6 as MentionNode, t as KaTeXInlineNode, K as KaTeXBlockNode, a7 as ImageNode, a8 as FootnoteNode, a9 as VideoNode, L as LinkCardNode, aa as DetailsNode, M as MermaidNode, ab as $createAlertQuoteNode, ac as $createImageNode, ad as $createKaTeXInlineNode, ae as $createKaTeXBlockNode, af as $createBannerNode, ag as $createDetailsNode, ah as $createFootnoteNode, j as $isFootnoteSectionNode, $ as $createFootnoteSectionNode, ai as $createMentionNode, aj as $createSpoilerNode, i as $createMermaidNode, d as clsx, C as ColorSchemeProvider, R as RendererConfigProvider, F as FootnotePlugin, g as getVariantClass } from "./utils-DvP2uSr7.js";
|
|
13
13
|
import { useCallback, createElement, useState, useEffect, useRef } from "react";
|
|
14
14
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
15
15
|
import { ContentEditable as ContentEditable$1 } from "@lexical/react/LexicalContentEditable";
|
|
@@ -20,8 +20,7 @@ import { createLinkMatcherWithRegExp, registerAutoLink } from "@lexical/link";
|
|
|
20
20
|
import { INSERT_HORIZONTAL_RULE_COMMAND, $createHorizontalRuleNode } from "@lexical/extension";
|
|
21
21
|
import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin";
|
|
22
22
|
import { CHECK_LIST, TRANSFORMERS } from "@lexical/markdown";
|
|
23
|
-
import { $
|
|
24
|
-
import { $isTableNode, $isTableRowNode, $isTableCellNode } from "@lexical/table";
|
|
23
|
+
import { GIT_ALERT_TRANSFORMER as GIT_ALERT_TRANSFORMER$1, CONTAINER_TRANSFORMER as CONTAINER_TRANSFORMER$1, FOOTNOTE_TRANSFORMER as FOOTNOTE_TRANSFORMER$1, FOOTNOTE_SECTION_TRANSFORMER as FOOTNOTE_SECTION_TRANSFORMER$1, KATEX_INLINE_TRANSFORMER as KATEX_INLINE_TRANSFORMER$1, KATEX_BLOCK_TRANSFORMER as KATEX_BLOCK_TRANSFORMER$1, MENTION_TRANSFORMER as MENTION_TRANSFORMER$1, SPOILER_TRANSFORMER as SPOILER_TRANSFORMER$1, INSERT_TRANSFORMER, IMAGE_BLOCK_TRANSFORMER, VIDEO_BLOCK_TRANSFORMER, CODE_BLOCK_NODE_TRANSFORMER, LINK_CARD_BLOCK_TRANSFORMER, MERMAID_BLOCK_TRANSFORMER, HORIZONTAL_RULE_BLOCK_TRANSFORMER, TABLE_BLOCK_TRANSFORMER } from "@haklex/rich-headless/transformers";
|
|
25
24
|
function AlertEditDecorator({
|
|
26
25
|
nodeKey,
|
|
27
26
|
alertType,
|
|
@@ -572,7 +571,12 @@ function AlertPlugin() {
|
|
|
572
571
|
function AutoFocusPlugin() {
|
|
573
572
|
const [editor] = useLexicalComposerContext();
|
|
574
573
|
useEffect(() => {
|
|
575
|
-
editor.
|
|
574
|
+
const root = editor.getRootElement();
|
|
575
|
+
if (root) {
|
|
576
|
+
root.focus({ preventScroll: true });
|
|
577
|
+
} else {
|
|
578
|
+
editor.focus();
|
|
579
|
+
}
|
|
576
580
|
}, [editor]);
|
|
577
581
|
return null;
|
|
578
582
|
}
|
|
@@ -685,25 +689,8 @@ const ALERT_TYPE_MAP = {
|
|
|
685
689
|
CAUTION: "caution"
|
|
686
690
|
};
|
|
687
691
|
const GIT_ALERT_TRANSFORMER = {
|
|
692
|
+
...GIT_ALERT_TRANSFORMER$1,
|
|
688
693
|
dependencies: [AlertQuoteNode],
|
|
689
|
-
export: (node) => {
|
|
690
|
-
if (!$isAlertQuoteNode(node)) {
|
|
691
|
-
if ($isQuoteNode(node)) {
|
|
692
|
-
const lines2 = node.getTextContent().split("\n");
|
|
693
|
-
return lines2.map((line) => `> ${line}`).join("\n");
|
|
694
|
-
}
|
|
695
|
-
return null;
|
|
696
|
-
}
|
|
697
|
-
const type = node.getAlertType();
|
|
698
|
-
const typeKey = Object.keys(ALERT_TYPE_MAP).find(
|
|
699
|
-
(key) => ALERT_TYPE_MAP[key] === type
|
|
700
|
-
);
|
|
701
|
-
const textContent = node.getTextContent();
|
|
702
|
-
const lines = textContent.split("\n");
|
|
703
|
-
const firstLine = `> [!${typeKey || "NOTE"}]`;
|
|
704
|
-
const restLines = lines.map((line) => `> ${line}`);
|
|
705
|
-
return [firstLine, ...restLines].join("\n");
|
|
706
|
-
},
|
|
707
694
|
regExp: /^>\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/,
|
|
708
695
|
replace: (parentNode, children, match) => {
|
|
709
696
|
const typeKey = match[1];
|
|
@@ -734,8 +721,7 @@ const GIT_ALERT_TRANSFORMER = {
|
|
|
734
721
|
const editorState = alertNode.getContentEditor().parseEditorState(content);
|
|
735
722
|
alertNode.getContentEditor().setEditorState(editorState);
|
|
736
723
|
parentNode.replace(alertNode);
|
|
737
|
-
}
|
|
738
|
-
type: "element"
|
|
724
|
+
}
|
|
739
725
|
};
|
|
740
726
|
const BANNER_TYPE_MAP = {
|
|
741
727
|
note: "note",
|
|
@@ -750,24 +736,8 @@ const BANNER_TYPE_MAP = {
|
|
|
750
736
|
caution: "caution"
|
|
751
737
|
};
|
|
752
738
|
const CONTAINER_TRANSFORMER = {
|
|
739
|
+
...CONTAINER_TRANSFORMER$1,
|
|
753
740
|
dependencies: [BannerNode, DetailsNode],
|
|
754
|
-
export: (node) => {
|
|
755
|
-
if ($isBannerNode(node)) {
|
|
756
|
-
const type = node.getBannerType();
|
|
757
|
-
const content = node.getTextContent();
|
|
758
|
-
return `::: ${type}
|
|
759
|
-
${content}
|
|
760
|
-
:::`;
|
|
761
|
-
}
|
|
762
|
-
if ($isDetailsNode(node)) {
|
|
763
|
-
const summary = node.getSummary();
|
|
764
|
-
const content = node.getTextContent();
|
|
765
|
-
return `::: details{summary="${summary}"}
|
|
766
|
-
${content}
|
|
767
|
-
:::`;
|
|
768
|
-
}
|
|
769
|
-
return null;
|
|
770
|
-
},
|
|
771
741
|
regExp: /^:::\s*(\w+)(?:\{([^}]*)\})?\s*$/,
|
|
772
742
|
replace: (parentNode, children, match) => {
|
|
773
743
|
const type = match[1];
|
|
@@ -820,31 +790,19 @@ ${content}
|
|
|
820
790
|
paragraph.append(child);
|
|
821
791
|
});
|
|
822
792
|
parentNode.replace(paragraph);
|
|
823
|
-
}
|
|
824
|
-
type: "element"
|
|
793
|
+
}
|
|
825
794
|
};
|
|
826
795
|
const FOOTNOTE_TRANSFORMER = {
|
|
796
|
+
...FOOTNOTE_TRANSFORMER$1,
|
|
827
797
|
dependencies: [FootnoteNode],
|
|
828
|
-
export: (node) => {
|
|
829
|
-
if (!$isFootnoteNode(node)) return null;
|
|
830
|
-
return `[^${node.getIdentifier()}]`;
|
|
831
|
-
},
|
|
832
|
-
importRegExp: /\[\^(\w+)\]/,
|
|
833
|
-
regExp: /\[\^(\w+)\]$/,
|
|
834
798
|
replace: (textNode, match) => {
|
|
835
799
|
const footnoteNode = $createFootnoteNode(match[1]);
|
|
836
800
|
textNode.replace(footnoteNode);
|
|
837
|
-
}
|
|
838
|
-
trigger: "]",
|
|
839
|
-
type: "text-match"
|
|
801
|
+
}
|
|
840
802
|
};
|
|
841
803
|
const FOOTNOTE_SECTION_TRANSFORMER = {
|
|
804
|
+
...FOOTNOTE_SECTION_TRANSFORMER$1,
|
|
842
805
|
dependencies: [FootnoteSectionNode],
|
|
843
|
-
export: (node) => {
|
|
844
|
-
if (!$isFootnoteSectionNode(node)) return null;
|
|
845
|
-
const definitions = node.getDefinitions();
|
|
846
|
-
return Object.entries(definitions).map(([id, content]) => `[^${id}]: ${content}`).join("\n");
|
|
847
|
-
},
|
|
848
806
|
regExp: /^\[\^(\w+)\]:\s+(.+)$/,
|
|
849
807
|
replace: (parentNode, _children, match) => {
|
|
850
808
|
const identifier = match[1];
|
|
@@ -862,145 +820,36 @@ const FOOTNOTE_SECTION_TRANSFORMER = {
|
|
|
862
820
|
}
|
|
863
821
|
const sectionNode = $createFootnoteSectionNode({ [identifier]: content });
|
|
864
822
|
parentNode.replace(sectionNode);
|
|
865
|
-
}
|
|
866
|
-
type: "element"
|
|
867
|
-
};
|
|
868
|
-
const INSERT_TRANSFORMER = {
|
|
869
|
-
format: ["underline"],
|
|
870
|
-
tag: "++",
|
|
871
|
-
type: "text-format"
|
|
823
|
+
}
|
|
872
824
|
};
|
|
873
825
|
const KATEX_INLINE_TRANSFORMER = {
|
|
826
|
+
...KATEX_INLINE_TRANSFORMER$1,
|
|
874
827
|
dependencies: [KaTeXInlineNode],
|
|
875
|
-
export: (node) => {
|
|
876
|
-
if (!$isKaTeXInlineNode(node)) return null;
|
|
877
|
-
return `$${node.getEquation()}$`;
|
|
878
|
-
},
|
|
879
|
-
importRegExp: /\$([^$\n]+)\$/,
|
|
880
|
-
regExp: /\$([^$\n]+)\$$/,
|
|
881
828
|
replace: (textNode, match) => {
|
|
882
829
|
const katexNode = $createKaTeXInlineNode(match[1]);
|
|
883
830
|
textNode.replace(katexNode);
|
|
884
|
-
}
|
|
885
|
-
trigger: "$",
|
|
886
|
-
type: "text-match"
|
|
831
|
+
}
|
|
887
832
|
};
|
|
888
833
|
const KATEX_BLOCK_TRANSFORMER = {
|
|
834
|
+
...KATEX_BLOCK_TRANSFORMER$1,
|
|
889
835
|
dependencies: [KaTeXBlockNode],
|
|
890
|
-
export: (node) => {
|
|
891
|
-
if (!$isKaTeXBlockNode(node)) return null;
|
|
892
|
-
return `$$${node.getEquation()}$$`;
|
|
893
|
-
},
|
|
894
|
-
importRegExp: /\$\$([^$]+)\$\$/,
|
|
895
|
-
regExp: /\$\$([^$]+)\$\$$/,
|
|
896
836
|
replace: (textNode, match) => {
|
|
897
837
|
const katexNode = $createKaTeXBlockNode(match[1]);
|
|
898
838
|
textNode.replace(katexNode);
|
|
899
|
-
}
|
|
900
|
-
trigger: "$",
|
|
901
|
-
type: "text-match"
|
|
839
|
+
}
|
|
902
840
|
};
|
|
903
841
|
const MENTION_TRANSFORMER = {
|
|
842
|
+
...MENTION_TRANSFORMER$1,
|
|
904
843
|
dependencies: [MentionNode],
|
|
905
|
-
export: (node) => {
|
|
906
|
-
if (!$isMentionNode(node)) return null;
|
|
907
|
-
const displayName = node.getDisplayName();
|
|
908
|
-
const base = `{${node.getPlatform()}@${node.getHandle()}}`;
|
|
909
|
-
return displayName ? `[${displayName}]${base}` : base;
|
|
910
|
-
},
|
|
911
|
-
importRegExp: /(?:\[([^\]]+)\])?\{(\w+)@(\w[\w.-]*)\}/,
|
|
912
|
-
regExp: /(?:\[([^\]]+)\])?\{(\w+)@(\w[\w.-]*)\}$/,
|
|
913
844
|
replace: (textNode, match) => {
|
|
914
845
|
const displayName = match[1] || void 0;
|
|
915
846
|
const mentionNode = $createMentionNode(match[2], match[3], displayName);
|
|
916
847
|
textNode.replace(mentionNode);
|
|
917
|
-
}
|
|
918
|
-
trigger: "}",
|
|
919
|
-
type: "text-match"
|
|
848
|
+
}
|
|
920
849
|
};
|
|
921
|
-
const NEVER_MATCH = /a^/;
|
|
922
850
|
function quoteAttr(value) {
|
|
923
851
|
return value.replaceAll('"', '\\"');
|
|
924
852
|
}
|
|
925
|
-
function escapeCell(value) {
|
|
926
|
-
return value.replaceAll("|", "\\|").replaceAll("\n", "<br/>");
|
|
927
|
-
}
|
|
928
|
-
function pickFence(content) {
|
|
929
|
-
const matches = content.match(/`+/g);
|
|
930
|
-
const maxLen = matches?.reduce((max, run) => Math.max(max, run.length), 0) ?? 0;
|
|
931
|
-
return "`".repeat(Math.max(3, maxLen + 1));
|
|
932
|
-
}
|
|
933
|
-
const IMAGE_BLOCK_TRANSFORMER = {
|
|
934
|
-
dependencies: [],
|
|
935
|
-
export: (node) => {
|
|
936
|
-
if (!$isImageNode(node)) return null;
|
|
937
|
-
const image = node.exportJSON();
|
|
938
|
-
const alt = image.altText || "";
|
|
939
|
-
const title = image.caption ? ` "${image.caption.replaceAll('"', '\\"')}"` : "";
|
|
940
|
-
return ``;
|
|
941
|
-
},
|
|
942
|
-
regExp: NEVER_MATCH,
|
|
943
|
-
replace: () => {
|
|
944
|
-
},
|
|
945
|
-
type: "element"
|
|
946
|
-
};
|
|
947
|
-
const VIDEO_BLOCK_TRANSFORMER = {
|
|
948
|
-
dependencies: [],
|
|
949
|
-
export: (node) => {
|
|
950
|
-
if (!$isVideoNode(node)) return null;
|
|
951
|
-
const video = node.exportJSON();
|
|
952
|
-
const attrs = [`src="${quoteAttr(video.src)}"`];
|
|
953
|
-
if (video.poster) attrs.push(`poster="${quoteAttr(video.poster)}"`);
|
|
954
|
-
if (video.width) attrs.push(`width=${video.width}`);
|
|
955
|
-
if (video.height) attrs.push(`height=${video.height}`);
|
|
956
|
-
return `<video ${attrs.join(" ")} controls></video>`;
|
|
957
|
-
},
|
|
958
|
-
regExp: NEVER_MATCH,
|
|
959
|
-
replace: () => {
|
|
960
|
-
},
|
|
961
|
-
type: "element"
|
|
962
|
-
};
|
|
963
|
-
const CODE_BLOCK_NODE_TRANSFORMER = {
|
|
964
|
-
dependencies: [],
|
|
965
|
-
export: (node) => {
|
|
966
|
-
if (!$isCodeBlockNode(node)) return null;
|
|
967
|
-
const codeBlock = node.exportJSON();
|
|
968
|
-
const fence = pickFence(codeBlock.code);
|
|
969
|
-
return `${fence}${codeBlock.language}
|
|
970
|
-
${codeBlock.code}
|
|
971
|
-
${fence}`;
|
|
972
|
-
},
|
|
973
|
-
regExp: NEVER_MATCH,
|
|
974
|
-
replace: () => {
|
|
975
|
-
},
|
|
976
|
-
type: "element"
|
|
977
|
-
};
|
|
978
|
-
const LINK_CARD_BLOCK_TRANSFORMER = {
|
|
979
|
-
dependencies: [],
|
|
980
|
-
export: (node) => {
|
|
981
|
-
if (!$isLinkCardNode(node)) return null;
|
|
982
|
-
const linkCard = node.exportJSON();
|
|
983
|
-
return linkCard.title ? `[${linkCard.title}](${linkCard.url})` : `<${linkCard.url}>`;
|
|
984
|
-
},
|
|
985
|
-
regExp: NEVER_MATCH,
|
|
986
|
-
replace: () => {
|
|
987
|
-
},
|
|
988
|
-
type: "element"
|
|
989
|
-
};
|
|
990
|
-
const MERMAID_BLOCK_TRANSFORMER = {
|
|
991
|
-
dependencies: [],
|
|
992
|
-
export: (node) => {
|
|
993
|
-
if (!$isMermaidNode(node)) return null;
|
|
994
|
-
const fence = pickFence(node.getDiagram());
|
|
995
|
-
return `${fence}mermaid
|
|
996
|
-
${node.getDiagram()}
|
|
997
|
-
${fence}`;
|
|
998
|
-
},
|
|
999
|
-
regExp: NEVER_MATCH,
|
|
1000
|
-
replace: () => {
|
|
1001
|
-
},
|
|
1002
|
-
type: "element"
|
|
1003
|
-
};
|
|
1004
853
|
const GRID_CONTAINER_BLOCK_TRANSFORMER = {
|
|
1005
854
|
dependencies: [],
|
|
1006
855
|
export: (node) => {
|
|
@@ -1017,61 +866,19 @@ ${content}
|
|
|
1017
866
|
${body}
|
|
1018
867
|
:::`;
|
|
1019
868
|
},
|
|
1020
|
-
regExp:
|
|
1021
|
-
replace: () => {
|
|
1022
|
-
},
|
|
1023
|
-
type: "element"
|
|
1024
|
-
};
|
|
1025
|
-
const HORIZONTAL_RULE_BLOCK_TRANSFORMER = {
|
|
1026
|
-
dependencies: [],
|
|
1027
|
-
export: (node) => {
|
|
1028
|
-
return node.getType() === "horizontalrule" ? "---" : null;
|
|
1029
|
-
},
|
|
1030
|
-
regExp: NEVER_MATCH,
|
|
1031
|
-
replace: () => {
|
|
1032
|
-
},
|
|
1033
|
-
type: "element"
|
|
1034
|
-
};
|
|
1035
|
-
const TABLE_BLOCK_TRANSFORMER = {
|
|
1036
|
-
dependencies: [],
|
|
1037
|
-
export: (node) => {
|
|
1038
|
-
if (!$isTableNode(node)) return null;
|
|
1039
|
-
const rows = node.getChildren().filter($isTableRowNode);
|
|
1040
|
-
if (rows.length === 0) return "| |\n| --- |";
|
|
1041
|
-
const tableRows = rows.map(
|
|
1042
|
-
(row) => row.getChildren().filter($isTableCellNode).map((cell) => escapeCell(cell.getTextContent()))
|
|
1043
|
-
);
|
|
1044
|
-
const header = tableRows[0];
|
|
1045
|
-
const separator = header.map(() => "---");
|
|
1046
|
-
const body = tableRows.slice(1);
|
|
1047
|
-
const lines = [
|
|
1048
|
-
`| ${header.join(" | ")} |`,
|
|
1049
|
-
`| ${separator.join(" | ")} |`,
|
|
1050
|
-
...body.map((cells) => `| ${cells.join(" | ")} |`)
|
|
1051
|
-
];
|
|
1052
|
-
return lines.join("\n");
|
|
1053
|
-
},
|
|
1054
|
-
regExp: NEVER_MATCH,
|
|
869
|
+
regExp: /a^/,
|
|
1055
870
|
replace: () => {
|
|
1056
871
|
},
|
|
1057
872
|
type: "element"
|
|
1058
873
|
};
|
|
1059
874
|
const SPOILER_TRANSFORMER = {
|
|
875
|
+
...SPOILER_TRANSFORMER$1,
|
|
1060
876
|
dependencies: [SpoilerNode],
|
|
1061
|
-
export: (node) => {
|
|
1062
|
-
if (!$isSpoilerNode(node)) return null;
|
|
1063
|
-
const textContent = node.getTextContent();
|
|
1064
|
-
return `||${textContent}||`;
|
|
1065
|
-
},
|
|
1066
|
-
importRegExp: /\|\|(.+?)\|\|/,
|
|
1067
|
-
regExp: /\|\|(.+?)\|\|$/,
|
|
1068
877
|
replace: (textNode, match) => {
|
|
1069
878
|
const spoilerNode = $createSpoilerNode();
|
|
1070
879
|
spoilerNode.append($createTextNode(match[1]));
|
|
1071
880
|
textNode.replace(spoilerNode);
|
|
1072
|
-
}
|
|
1073
|
-
trigger: "|",
|
|
1074
|
-
type: "text-match"
|
|
881
|
+
}
|
|
1075
882
|
};
|
|
1076
883
|
const ALL_TRANSFORMERS = [
|
|
1077
884
|
// Inline transformers
|
|
@@ -1209,6 +1016,7 @@ function RichEditor({
|
|
|
1209
1016
|
autoFocus = false,
|
|
1210
1017
|
className,
|
|
1211
1018
|
contentClassName,
|
|
1019
|
+
style,
|
|
1212
1020
|
actions,
|
|
1213
1021
|
onEditorReady,
|
|
1214
1022
|
extraNodes,
|
|
@@ -1229,40 +1037,47 @@ function RichEditor({
|
|
|
1229
1037
|
...initialValue ? { editorState: JSON.stringify(initialValue) } : {}
|
|
1230
1038
|
};
|
|
1231
1039
|
const variantClass = getVariantClass(variant, theme);
|
|
1232
|
-
return /* @__PURE__ */ jsx(PortalThemeProvider, { className: variantClass, children: /* @__PURE__ */ jsx(ColorSchemeProvider, { colorScheme: theme, children: /* @__PURE__ */ jsx(RendererConfigProvider, { config: rendererConfig, mode: "editor", children: /* @__PURE__ */ jsx(LexicalComposer, { initialConfig, children: /* @__PURE__ */ jsx(FootnotePlugin, { children: /* @__PURE__ */ jsxs(
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1040
|
+
return /* @__PURE__ */ jsx(PortalThemeProvider, { className: variantClass, children: /* @__PURE__ */ jsx(ColorSchemeProvider, { colorScheme: theme, children: /* @__PURE__ */ jsx(RendererConfigProvider, { config: rendererConfig, mode: "editor", children: /* @__PURE__ */ jsx(LexicalComposer, { initialConfig, children: /* @__PURE__ */ jsx(FootnotePlugin, { children: /* @__PURE__ */ jsxs(
|
|
1041
|
+
"div",
|
|
1042
|
+
{
|
|
1043
|
+
className: clsx("rich-editor", variantClass, className),
|
|
1044
|
+
style,
|
|
1045
|
+
children: [
|
|
1046
|
+
/* @__PURE__ */ jsx(
|
|
1047
|
+
RichTextPlugin,
|
|
1238
1048
|
{
|
|
1239
|
-
|
|
1240
|
-
|
|
1049
|
+
contentEditable: /* @__PURE__ */ jsx(
|
|
1050
|
+
ContentEditable,
|
|
1051
|
+
{
|
|
1052
|
+
className: contentClassName,
|
|
1053
|
+
placeholder
|
|
1054
|
+
}
|
|
1055
|
+
),
|
|
1056
|
+
ErrorBoundary: LexicalErrorBoundary
|
|
1241
1057
|
}
|
|
1242
1058
|
),
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
] }) }) }) }) }) });
|
|
1059
|
+
/* @__PURE__ */ jsx(HistoryPlugin, {}),
|
|
1060
|
+
/* @__PURE__ */ jsx(ListPlugin, {}),
|
|
1061
|
+
/* @__PURE__ */ jsx(LinkPlugin, {}),
|
|
1062
|
+
/* @__PURE__ */ jsx(TabIndentationPlugin, {}),
|
|
1063
|
+
/* @__PURE__ */ jsx(TablePlugin, {}),
|
|
1064
|
+
/* @__PURE__ */ jsx(MarkdownShortcutsPlugin, {}),
|
|
1065
|
+
/* @__PURE__ */ jsx(OnChangePlugin, { onChange, debounceMs }),
|
|
1066
|
+
/* @__PURE__ */ jsx(SubmitShortcutPlugin, { onSubmit }),
|
|
1067
|
+
/* @__PURE__ */ jsx(ImagePlugin, {}),
|
|
1068
|
+
/* @__PURE__ */ jsx(KaTeXPlugin, {}),
|
|
1069
|
+
/* @__PURE__ */ jsx(AlertPlugin, {}),
|
|
1070
|
+
/* @__PURE__ */ jsx(MermaidPlugin, {}),
|
|
1071
|
+
/* @__PURE__ */ jsx(HorizontalRulePlugin, {}),
|
|
1072
|
+
/* @__PURE__ */ jsx(CheckListPlugin, {}),
|
|
1073
|
+
/* @__PURE__ */ jsx(AutoLinkPlugin, {}),
|
|
1074
|
+
/* @__PURE__ */ jsx(EditorRefPlugin, { onEditorReady }),
|
|
1075
|
+
autoFocus && /* @__PURE__ */ jsx(AutoFocusPlugin, {}),
|
|
1076
|
+
children,
|
|
1077
|
+
actions && /* @__PURE__ */ jsx("div", { className: "rich-editor__actions", children: actions })
|
|
1078
|
+
]
|
|
1079
|
+
}
|
|
1080
|
+
) }) }) }) }) });
|
|
1266
1081
|
}
|
|
1267
1082
|
export {
|
|
1268
1083
|
ALL_TRANSFORMERS as A,
|
|
@@ -4,7 +4,7 @@ import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
|
4
4
|
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
5
5
|
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
6
6
|
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
7
|
-
import { a as allNodes, C as ColorSchemeProvider, R as RendererConfigProvider, e as editorTheme, F as FootnotePlugin, d as clsx, g as getVariantClass } from "./utils-
|
|
7
|
+
import { a as allNodes, C as ColorSchemeProvider, R as RendererConfigProvider, e as editorTheme, F as FootnotePlugin, d as clsx, g as getVariantClass } from "./utils-DvP2uSr7.js";
|
|
8
8
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
9
9
|
import { HeadingNode } from "@lexical/rich-text";
|
|
10
10
|
import { useEffect } from "react";
|
|
@@ -56,6 +56,7 @@ function RichRenderer({
|
|
|
56
56
|
variant = "article",
|
|
57
57
|
theme = "light",
|
|
58
58
|
className,
|
|
59
|
+
style,
|
|
59
60
|
as: Component = "div",
|
|
60
61
|
rendererConfig,
|
|
61
62
|
extraNodes
|
|
@@ -72,24 +73,31 @@ function RichRenderer({
|
|
|
72
73
|
console.error("[RichRenderer]", error);
|
|
73
74
|
}
|
|
74
75
|
};
|
|
75
|
-
return /* @__PURE__ */ jsx(PortalThemeProvider, { className: variantClass, children: /* @__PURE__ */ jsx(ColorSchemeProvider, { colorScheme: theme, children: /* @__PURE__ */ jsx(RendererConfigProvider, { config: rendererConfig, mode: "renderer", children: /* @__PURE__ */ jsx(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
return /* @__PURE__ */ jsx(PortalThemeProvider, { className: variantClass, children: /* @__PURE__ */ jsx(ColorSchemeProvider, { colorScheme: theme, children: /* @__PURE__ */ jsx(RendererConfigProvider, { config: rendererConfig, mode: "renderer", children: /* @__PURE__ */ jsx(
|
|
77
|
+
Component,
|
|
78
|
+
{
|
|
79
|
+
className: clsx("rich-content", variantClass, className),
|
|
80
|
+
style,
|
|
81
|
+
children: /* @__PURE__ */ jsx(LexicalComposer, { initialConfig, children: /* @__PURE__ */ jsxs(FootnotePlugin, { children: [
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
RichTextPlugin,
|
|
81
84
|
{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
contentEditable: /* @__PURE__ */ jsx(
|
|
86
|
+
ContentEditable,
|
|
87
|
+
{
|
|
88
|
+
className: "rich-content__body",
|
|
89
|
+
style: { outline: "none" },
|
|
90
|
+
"aria-placeholder": "",
|
|
91
|
+
placeholder: /* @__PURE__ */ jsx("span", { style: { display: "none" } })
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
ErrorBoundary: LexicalErrorBoundary
|
|
86
95
|
}
|
|
87
96
|
),
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
] }) }) }) }) }) });
|
|
97
|
+
/* @__PURE__ */ jsx(HeadingAnchorPlugin, {})
|
|
98
|
+
] }) })
|
|
99
|
+
}
|
|
100
|
+
) }) }) });
|
|
93
101
|
}
|
|
94
102
|
export {
|
|
95
103
|
RichRenderer as R
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RichEditorProps } from '../types';
|
|
2
|
-
export declare function RichEditor({ initialValue, onChange, variant, theme, placeholder, onSubmit, autoFocus, className, contentClassName, actions, onEditorReady, extraNodes, rendererConfig, debounceMs, children, }: RichEditorProps): import("react").JSX.Element;
|
|
2
|
+
export declare function RichEditor({ initialValue, onChange, variant, theme, placeholder, onSubmit, autoFocus, className, contentClassName, style, actions, onEditorReady, extraNodes, rendererConfig, debounceMs, children, }: RichEditorProps): import("react").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=RichEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichEditor.d.ts","sourceRoot":"","sources":["../../src/components/RichEditor.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI/C,wBAAgB,UAAU,CAAC,EACzB,YAAY,EACZ,QAAQ,EACR,OAAmB,EACnB,KAAe,EACf,WAAkC,EAClC,QAAQ,EACR,SAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,UAAU,EACV,cAAc,EACd,UAAU,EACV,QAAQ,GACT,EAAE,eAAe,+
|
|
1
|
+
{"version":3,"file":"RichEditor.d.ts","sourceRoot":"","sources":["../../src/components/RichEditor.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAI/C,wBAAgB,UAAU,CAAC,EACzB,YAAY,EACZ,QAAQ,EACR,OAAmB,EACnB,KAAe,EACf,WAAkC,EAClC,QAAQ,EACR,SAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,aAAa,EACb,UAAU,EACV,cAAc,EACd,UAAU,EACV,QAAQ,GACT,EAAE,eAAe,+BA+DjB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RichRendererProps } from '../types';
|
|
2
|
-
export declare function RichRenderer({ value, variant, theme, className, as: Component, rendererConfig, extraNodes, }: RichRendererProps): import("react").JSX.Element;
|
|
2
|
+
export declare function RichRenderer({ value, variant, theme, className, style, as: Component, rendererConfig, extraNodes, }: RichRendererProps): import("react").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=RichRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichRenderer.d.ts","sourceRoot":"","sources":["../../src/components/RichRenderer.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAGjD,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,OAAmB,EACnB,KAAe,EACf,SAAS,EACT,EAAE,EAAE,SAAiB,EACrB,cAAc,EACd,UAAU,GACX,EAAE,iBAAiB,+
|
|
1
|
+
{"version":3,"file":"RichRenderer.d.ts","sourceRoot":"","sources":["../../src/components/RichRenderer.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAGjD,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,OAAmB,EACnB,KAAe,EACf,SAAS,EACT,KAAK,EACL,EAAE,EAAE,SAAiB,EACrB,cAAc,EACd,UAAU,GACX,EAAE,iBAAiB,+BA6CnB"}
|
package/dist/editor.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R, a, c, g, s } from "./RichEditor-
|
|
2
|
-
import { a as a2, b, c as c2 } from "./utils-
|
|
1
|
+
import { R, a, c, g, s } from "./RichEditor-DeAuc6CQ.js";
|
|
2
|
+
import { a as a2, b, c as c2 } from "./utils-DvP2uSr7.js";
|
|
3
3
|
export {
|
|
4
4
|
R as RichEditor,
|
|
5
5
|
a as allEditNodes,
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A, F, I, b, d, e, f, R, a, c, g, s } from "./RichEditor-
|
|
2
|
-
import { R as R2 } from "./RichRenderer-
|
|
3
|
-
import { $, f as f2, h, i, j, k, l, m, n, o, A as A2, p, B, q, C, r, F as F2, s as s2, G, K, t, u, L, v, M, N, a as a2, w, b as b2, x, y, z, c as c2, D, E, H, I as I2, e as e2, g as g2, J, O, P, Q, S, T, U } from "./utils-
|
|
1
|
+
import { A, F, I, b, d, e, f, R, a, c, g, s } from "./RichEditor-DeAuc6CQ.js";
|
|
2
|
+
import { R as R2 } from "./RichRenderer-CtBjK31O.js";
|
|
3
|
+
import { $, f as f2, h, i, j, k, l, m, n, o, A as A2, p, B, q, C, r, F as F2, s as s2, G, K, t, u, L, v, M, N, a as a2, w, b as b2, x, y, z, c as c2, D, E, H, I as I2, e as e2, g as g2, J, O, P, Q, S, T, U } from "./utils-DvP2uSr7.js";
|
|
4
4
|
var richContent = "r8uj4t0";
|
|
5
5
|
var articleTheme = "_17pm0gw0";
|
|
6
6
|
var commentTheme = "_17pm0gw1";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoFocusPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/AutoFocusPlugin.tsx"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"AutoFocusPlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/AutoFocusPlugin.tsx"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,SAa9B"}
|
package/dist/renderer.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../src/transformers/alert.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../src/transformers/alert.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAiB3D,eAAO,MAAM,qBAAqB,EAAE,kBAsCnC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/transformers/container.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/transformers/container.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAqB3D,eAAO,MAAM,qBAAqB,EAAE,kBAiEnC,CAAA"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { ElementTransformer, TextMatchTransformer } from '@lexical/markdown';
|
|
2
|
-
/**
|
|
3
|
-
* Footnote reference transformer: [^1] → FootnoteNode
|
|
4
|
-
*/
|
|
5
2
|
export declare const FOOTNOTE_TRANSFORMER: TextMatchTransformer;
|
|
6
|
-
/**
|
|
7
|
-
* Footnote section transformer: [^id]: content → FootnoteSectionNode
|
|
8
|
-
*/
|
|
9
3
|
export declare const FOOTNOTE_SECTION_TRANSFORMER: ElementTransformer;
|
|
10
4
|
//# sourceMappingURL=footnote.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footnote.d.ts","sourceRoot":"","sources":["../../src/transformers/footnote.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"footnote.d.ts","sourceRoot":"","sources":["../../src/transformers/footnote.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,mBAAmB,CAAA;AAS1B,eAAO,MAAM,oBAAoB,EAAE,oBAOlC,CAAA;AAED,eAAO,MAAM,4BAA4B,EAAE,kBAuB1C,CAAA"}
|
|
@@ -0,0 +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,CAAA;AAS3D,eAAO,MAAM,gCAAgC,EAAE,kBAe9C,CAAA"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Insert text transformer: ++text++ → underline format
|
|
4
|
-
*/
|
|
5
|
-
export declare const INSERT_TRANSFORMER: TextFormatTransformer;
|
|
1
|
+
export { INSERT_TRANSFORMER } from '@haklex/rich-headless/transformers';
|
|
6
2
|
//# sourceMappingURL=insert.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../src/transformers/insert.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../src/transformers/insert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"katex.d.ts","sourceRoot":"","sources":["../../src/transformers/katex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"katex.d.ts","sourceRoot":"","sources":["../../src/transformers/katex.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAQ7D,eAAO,MAAM,wBAAwB,EAAE,oBAOtC,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,oBAOrC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mention.d.ts","sourceRoot":"","sources":["../../src/transformers/mention.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mention.d.ts","sourceRoot":"","sources":["../../src/transformers/mention.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAI7D,eAAO,MAAM,mBAAmB,EAAE,oBAQjC,CAAA"}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export declare const VIDEO_BLOCK_TRANSFORMER: ElementTransformer;
|
|
4
|
-
export declare const CODE_BLOCK_NODE_TRANSFORMER: ElementTransformer;
|
|
5
|
-
export declare const LINK_CARD_BLOCK_TRANSFORMER: ElementTransformer;
|
|
6
|
-
export declare const MERMAID_BLOCK_TRANSFORMER: ElementTransformer;
|
|
7
|
-
export declare const GRID_CONTAINER_BLOCK_TRANSFORMER: ElementTransformer;
|
|
8
|
-
export declare const HORIZONTAL_RULE_BLOCK_TRANSFORMER: ElementTransformer;
|
|
9
|
-
export declare const TABLE_BLOCK_TRANSFORMER: ElementTransformer;
|
|
1
|
+
export { GRID_CONTAINER_BLOCK_TRANSFORMER } from './grid-container';
|
|
2
|
+
export { CODE_BLOCK_NODE_TRANSFORMER, HORIZONTAL_RULE_BLOCK_TRANSFORMER, IMAGE_BLOCK_TRANSFORMER, LINK_CARD_BLOCK_TRANSFORMER, MERMAID_BLOCK_TRANSFORMER, TABLE_BLOCK_TRANSFORMER, VIDEO_BLOCK_TRANSFORMER, } from '@haklex/rich-headless/transformers';
|
|
10
3
|
//# sourceMappingURL=rich-blocks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-blocks.d.ts","sourceRoot":"","sources":["../../src/transformers/rich-blocks.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"rich-blocks.d.ts","sourceRoot":"","sources":["../../src/transformers/rich-blocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,EACjC,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,oCAAoC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spoiler.d.ts","sourceRoot":"","sources":["../../src/transformers/spoiler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"spoiler.d.ts","sourceRoot":"","sources":["../../src/transformers/spoiler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAK7D,eAAO,MAAM,mBAAmB,EAAE,oBAQjC,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface RichEditorProps {
|
|
|
13
13
|
autoFocus?: boolean;
|
|
14
14
|
className?: string;
|
|
15
15
|
contentClassName?: string;
|
|
16
|
+
style?: React.CSSProperties;
|
|
16
17
|
actions?: ReactNode;
|
|
17
18
|
onEditorReady?: (editor: LexicalEditor | null) => void;
|
|
18
19
|
extraNodes?: Array<Klass<LexicalNode>>;
|
|
@@ -25,6 +26,7 @@ export interface RichRendererProps {
|
|
|
25
26
|
variant?: RichEditorVariant;
|
|
26
27
|
theme?: ColorScheme;
|
|
27
28
|
className?: string;
|
|
29
|
+
style?: React.CSSProperties;
|
|
28
30
|
as?: React.ElementType;
|
|
29
31
|
rendererConfig?: RendererConfig;
|
|
30
32
|
extraNodes?: Array<Klass<LexicalNode>>;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,aAAa,EACb,WAAW,EACX,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAA;AAE9D,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAA;IACjD,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,KAAK,IAAI,CAAA;IACtD,UAAU,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;IACtC,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,qBAAqB,CAAA;IAC5B,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,UAAU,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;CACvC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,aAAa,EACb,WAAW,EACX,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAA;AAE9D,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAA;IACjD,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,KAAK,IAAI,CAAA;IACtD,UAAU,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;IACtC,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,qBAAqB,CAAA;IAC5B,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,UAAU,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAA;CACvC"}
|
|
@@ -259,9 +259,6 @@ class FootnoteNode extends DecoratorNode {
|
|
|
259
259
|
function $createFootnoteNode(identifier) {
|
|
260
260
|
return new FootnoteNode(identifier);
|
|
261
261
|
}
|
|
262
|
-
function $isFootnoteNode(node) {
|
|
263
|
-
return node instanceof FootnoteNode;
|
|
264
|
-
}
|
|
265
262
|
let katexModule = null;
|
|
266
263
|
let katexLoadPromise = null;
|
|
267
264
|
function loadKaTeX() {
|
|
@@ -441,9 +438,6 @@ class MentionNode extends DecoratorNode {
|
|
|
441
438
|
function $createMentionNode(platform, handle, displayName) {
|
|
442
439
|
return new MentionNode(platform, handle, displayName);
|
|
443
440
|
}
|
|
444
|
-
function $isMentionNode(node) {
|
|
445
|
-
return node instanceof MentionNode;
|
|
446
|
-
}
|
|
447
441
|
class SpoilerNode extends ElementNode {
|
|
448
442
|
static getType() {
|
|
449
443
|
return "spoiler";
|
|
@@ -503,9 +497,6 @@ class SpoilerNode extends ElementNode {
|
|
|
503
497
|
function $createSpoilerNode() {
|
|
504
498
|
return new SpoilerNode();
|
|
505
499
|
}
|
|
506
|
-
function $isSpoilerNode(node) {
|
|
507
|
-
return node instanceof SpoilerNode;
|
|
508
|
-
}
|
|
509
500
|
const NESTED_EDITOR_NODES = [
|
|
510
501
|
HeadingNode,
|
|
511
502
|
QuoteNode,
|
|
@@ -1147,9 +1138,6 @@ let DetailsNode = _DetailsNode;
|
|
|
1147
1138
|
function $createDetailsNode(summary, open = false) {
|
|
1148
1139
|
return new DetailsNode(summary, open);
|
|
1149
1140
|
}
|
|
1150
|
-
function $isDetailsNode(node) {
|
|
1151
|
-
return node instanceof DetailsNode;
|
|
1152
|
-
}
|
|
1153
1141
|
function FootnoteSectionRenderer({
|
|
1154
1142
|
definitions
|
|
1155
1143
|
}) {
|
|
@@ -1755,9 +1743,6 @@ let ImageNode = _ImageNode;
|
|
|
1755
1743
|
function $createImageNode(payload) {
|
|
1756
1744
|
return new ImageNode(payload);
|
|
1757
1745
|
}
|
|
1758
|
-
function $isImageNode(node) {
|
|
1759
|
-
return node instanceof ImageNode;
|
|
1760
|
-
}
|
|
1761
1746
|
const _KaTeXBlockNode = class _KaTeXBlockNode extends DecoratorNode {
|
|
1762
1747
|
constructor(equation, key) {
|
|
1763
1748
|
super(key);
|
|
@@ -2184,9 +2169,6 @@ let VideoNode = _VideoNode;
|
|
|
2184
2169
|
function $createVideoNode(payload) {
|
|
2185
2170
|
return new VideoNode(payload);
|
|
2186
2171
|
}
|
|
2187
|
-
function $isVideoNode(node) {
|
|
2188
|
-
return node instanceof VideoNode;
|
|
2189
|
-
}
|
|
2190
2172
|
const builtinNodes = [
|
|
2191
2173
|
HeadingNode,
|
|
2192
2174
|
QuoteNode,
|
|
@@ -2323,15 +2305,9 @@ export {
|
|
|
2323
2305
|
$createKaTeXBlockNode as ae,
|
|
2324
2306
|
$createBannerNode as af,
|
|
2325
2307
|
$createDetailsNode as ag,
|
|
2326
|
-
$
|
|
2327
|
-
$
|
|
2328
|
-
$
|
|
2329
|
-
$createMentionNode as ak,
|
|
2330
|
-
$isMentionNode as al,
|
|
2331
|
-
$isImageNode as am,
|
|
2332
|
-
$isVideoNode as an,
|
|
2333
|
-
$createSpoilerNode as ao,
|
|
2334
|
-
$isSpoilerNode as ap,
|
|
2308
|
+
$createFootnoteNode as ah,
|
|
2309
|
+
$createMentionNode as ai,
|
|
2310
|
+
$createSpoilerNode as aj,
|
|
2335
2311
|
builtinNodes as b,
|
|
2336
2312
|
customNodes as c,
|
|
2337
2313
|
clsx as d,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Core rich text editor based on Lexical",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,8 +25,9 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"thumbhash": "^0.1.1",
|
|
28
|
-
"@haklex/rich-editor-ui": "0.0.
|
|
29
|
-
"@haklex/rich-
|
|
28
|
+
"@haklex/rich-editor-ui": "0.0.13",
|
|
29
|
+
"@haklex/rich-headless": "0.0.13",
|
|
30
|
+
"@haklex/rich-style-token": "0.0.13"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@base-ui/react": "^1.1.0",
|