@puckeditor/core 0.21.0-canary.d1c0d6a2
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 +114 -0
- package/dist/Editor-32UYWE6W.mjs +204 -0
- package/dist/Editor-IQP25PUX.css +404 -0
- package/dist/Render-3OV4N4MT.css +102 -0
- package/dist/Render-FXZX6NFH.mjs +55 -0
- package/dist/actions-BkBoKAc5.d.mts +838 -0
- package/dist/actions-BkBoKAc5.d.ts +838 -0
- package/dist/chunk-3VQHXASI.mjs +33 -0
- package/dist/chunk-6KNQXLQR.mjs +708 -0
- package/dist/chunk-AOEDIUVK.mjs +11 -0
- package/dist/chunk-GVKHZNTR.mjs +53 -0
- package/dist/chunk-K562SEXI.mjs +1813 -0
- package/dist/chunk-KN3XDS7U.mjs +528 -0
- package/dist/chunk-M6W7YEVX.mjs +95 -0
- package/dist/chunk-MEL7FUSF.mjs +63 -0
- package/dist/chunk-NYGQH27S.mjs +445 -0
- package/dist/chunk-PSLS3ZEH.mjs +8074 -0
- package/dist/chunk-Q3TJ2VYO.mjs +436 -0
- package/dist/chunk-REWRIUGR.mjs +156 -0
- package/dist/chunk-V2IQTPPK.mjs +111 -0
- package/dist/chunk-V5I7CVLT.mjs +103 -0
- package/dist/chunk-Y2EFNT5P.mjs +108 -0
- package/dist/full-2GJTAAZE.css +301 -0
- package/dist/full-4OS3O57Y.mjs +93 -0
- package/dist/index-bqD1SEOb.d.mts +118 -0
- package/dist/index-lt1zf5WR.d.ts +118 -0
- package/dist/index.css +2629 -0
- package/dist/index.d.mts +309 -0
- package/dist/index.d.ts +309 -0
- package/dist/index.js +14177 -0
- package/dist/index.mjs +78 -0
- package/dist/internal.d.mts +27 -0
- package/dist/internal.d.ts +27 -0
- package/dist/internal.js +927 -0
- package/dist/internal.mjs +13 -0
- package/dist/loaded-DCQVLO7I.mjs +57 -0
- package/dist/loaded-JGRO7BH7.mjs +57 -0
- package/dist/loaded-KKVJE5KH.mjs +60 -0
- package/dist/loaded-RVWBFK7L.css +87 -0
- package/dist/no-external.css +2631 -0
- package/dist/no-external.d.mts +21 -0
- package/dist/no-external.d.ts +21 -0
- package/dist/no-external.js +14180 -0
- package/dist/no-external.mjs +83 -0
- package/dist/rsc.css +102 -0
- package/dist/rsc.d.mts +27 -0
- package/dist/rsc.d.ts +27 -0
- package/dist/rsc.js +1445 -0
- package/dist/rsc.mjs +130 -0
- package/dist/walk-tree-CRRDqx6_.d.mts +29 -0
- package/dist/walk-tree-CS7sEpfG.d.ts +29 -0
- package/package.json +137 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/* css-module:/home/runner/work/puck/puck/packages/core/components/RichTextEditor/styles.module.css/#css-module-data */
|
|
2
|
+
._RichTextEditor_z25h4_1 .ProseMirror {
|
|
3
|
+
white-space: pre-wrap;
|
|
4
|
+
word-wrap: break-word;
|
|
5
|
+
cursor: text;
|
|
6
|
+
outline: none;
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
._RichTextEditor_z25h4_1 .rich-text * {
|
|
10
|
+
white-space: pre-wrap;
|
|
11
|
+
user-select: auto;
|
|
12
|
+
-webkit-user-select: auto;
|
|
13
|
+
}
|
|
14
|
+
._RichTextEditor_z25h4_1 .rich-text blockquote {
|
|
15
|
+
margin: 1em 0;
|
|
16
|
+
padding: 0 1em;
|
|
17
|
+
border-left: 4px solid var(--puck-color-grey-09);
|
|
18
|
+
}
|
|
19
|
+
._RichTextEditor_z25h4_1 .rich-text code {
|
|
20
|
+
background-color: var(--puck-color-grey-11);
|
|
21
|
+
padding: 4px 8px;
|
|
22
|
+
border-radius: 4px;
|
|
23
|
+
}
|
|
24
|
+
._RichTextEditor_z25h4_1 .rich-text p:empty::before {
|
|
25
|
+
content: "\a0";
|
|
26
|
+
}
|
|
27
|
+
._RichTextEditor_z25h4_1 .rich-text pre code {
|
|
28
|
+
display: block;
|
|
29
|
+
padding: 8px 12px;
|
|
30
|
+
}
|
|
31
|
+
._RichTextEditor_z25h4_1 .rich-text > *:first-child,
|
|
32
|
+
._RichTextEditor_z25h4_1 .ProseMirror > *:first-child,
|
|
33
|
+
._RichTextEditor_z25h4_1 .rich-text * p:first-of-type {
|
|
34
|
+
margin-top: 0;
|
|
35
|
+
}
|
|
36
|
+
._RichTextEditor_z25h4_1 .rich-text > *:last-child,
|
|
37
|
+
._RichTextEditor_z25h4_1 .ProseMirror > *:last-child,
|
|
38
|
+
._RichTextEditor_z25h4_1 .rich-text * p:last-of-type {
|
|
39
|
+
margin-bottom: 0;
|
|
40
|
+
}
|
|
41
|
+
._RichTextEditor--editor_z25h4_50 {
|
|
42
|
+
background: var(--puck-color-white);
|
|
43
|
+
border-width: 1px;
|
|
44
|
+
border-style: solid;
|
|
45
|
+
border-color: var(--puck-color-grey-09);
|
|
46
|
+
border-radius: 4px;
|
|
47
|
+
box-sizing: border-box;
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
font-family: inherit;
|
|
51
|
+
font-size: var(--puck-font-size-xxs);
|
|
52
|
+
resize: vertical;
|
|
53
|
+
text-align: initial;
|
|
54
|
+
transition: border-color 50ms ease-in;
|
|
55
|
+
width: 100%;
|
|
56
|
+
max-width: 100%;
|
|
57
|
+
min-height: 128px;
|
|
58
|
+
}
|
|
59
|
+
._RichTextEditor--editor_z25h4_50 .rich-text {
|
|
60
|
+
flex-grow: 1;
|
|
61
|
+
}
|
|
62
|
+
._RichTextEditor--editor_z25h4_50 .rich-text:not(:has(.ProseMirror)),
|
|
63
|
+
._RichTextEditor--editor_z25h4_50 .rich-text .ProseMirror {
|
|
64
|
+
height: 100%;
|
|
65
|
+
padding: 12px 15px;
|
|
66
|
+
}
|
|
67
|
+
._RichTextEditor--editor_z25h4_50 .rich-text ul,
|
|
68
|
+
._RichTextEditor--editor_z25h4_50 .rich-text ol {
|
|
69
|
+
padding-left: 24px;
|
|
70
|
+
}
|
|
71
|
+
._RichTextEditor--editor_z25h4_50 .rich-text li {
|
|
72
|
+
line-height: 1.5;
|
|
73
|
+
}
|
|
74
|
+
._RichTextEditor--editor_z25h4_50 .rich-text p {
|
|
75
|
+
margin-block: 12px;
|
|
76
|
+
}
|
|
77
|
+
._RichTextEditor--editor_z25h4_50 .rich-text ul {
|
|
78
|
+
list-style: disc;
|
|
79
|
+
}
|
|
80
|
+
._RichTextEditor--editor_z25h4_50 .rich-text ol {
|
|
81
|
+
list-style: decimal;
|
|
82
|
+
}
|
|
83
|
+
._RichTextEditor--editor_z25h4_50:focus-within {
|
|
84
|
+
border-color: var(--puck-color-grey-05);
|
|
85
|
+
outline: 2px solid var(--puck-color-azure-05);
|
|
86
|
+
transition: none;
|
|
87
|
+
}
|
|
88
|
+
._RichTextEditor--editor_z25h4_50._RichTextEditor--disabled_z25h4_107 {
|
|
89
|
+
background: var(--puck-color-grey-11);
|
|
90
|
+
}
|
|
91
|
+
._RichTextEditor_z25h4_1:not(:focus-within):not(._RichTextEditor--isActive_z25h4_111) .ProseMirror ::selection {
|
|
92
|
+
background-color: transparent;
|
|
93
|
+
}
|
|
94
|
+
._RichTextEditor-menu_z25h4_117 {
|
|
95
|
+
border-bottom: 1px solid var(--puck-color-grey-10);
|
|
96
|
+
position: sticky;
|
|
97
|
+
top: 0;
|
|
98
|
+
z-index: 1;
|
|
99
|
+
}
|
|
100
|
+
._RichTextEditor--disabled_z25h4_107 ._RichTextEditor-menu_z25h4_117 {
|
|
101
|
+
border-bottom: 1px solid var(--puck-color-grey-09);
|
|
102
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PuckRichText
|
|
3
|
+
} from "./chunk-V5I7CVLT.mjs";
|
|
4
|
+
import {
|
|
5
|
+
styles_module_default
|
|
6
|
+
} from "./chunk-AOEDIUVK.mjs";
|
|
7
|
+
import {
|
|
8
|
+
get_class_name_factory_default
|
|
9
|
+
} from "./chunk-Y2EFNT5P.mjs";
|
|
10
|
+
import {
|
|
11
|
+
init_react_import
|
|
12
|
+
} from "./chunk-M6W7YEVX.mjs";
|
|
13
|
+
|
|
14
|
+
// components/RichTextEditor/components/Render.tsx
|
|
15
|
+
init_react_import();
|
|
16
|
+
import { generateHTML, generateJSON } from "@tiptap/html";
|
|
17
|
+
import { useMemo } from "react";
|
|
18
|
+
import { jsx } from "react/jsx-runtime";
|
|
19
|
+
var getClassName = get_class_name_factory_default("RichTextEditor", styles_module_default);
|
|
20
|
+
function RichTextRender({
|
|
21
|
+
content,
|
|
22
|
+
field
|
|
23
|
+
}) {
|
|
24
|
+
const { tiptap = {}, options } = field;
|
|
25
|
+
const { extensions = [] } = tiptap;
|
|
26
|
+
const loadedExtensions = useMemo(
|
|
27
|
+
() => [PuckRichText.configure(options), ...extensions],
|
|
28
|
+
[field, extensions]
|
|
29
|
+
);
|
|
30
|
+
const normalized = useMemo(() => {
|
|
31
|
+
if (typeof content === "object" && (content == null ? void 0 : content.type) === "doc") {
|
|
32
|
+
return content;
|
|
33
|
+
}
|
|
34
|
+
if (typeof content === "string") {
|
|
35
|
+
const isHtml = /<\/?[a-z][\s\S]*>/i.test(content);
|
|
36
|
+
if (isHtml) {
|
|
37
|
+
return generateJSON(content, loadedExtensions);
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
type: "doc",
|
|
41
|
+
content: [
|
|
42
|
+
{ type: "paragraph", content: [{ type: "text", text: content }] }
|
|
43
|
+
]
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return { type: "doc", content: [] };
|
|
47
|
+
}, [content, loadedExtensions]);
|
|
48
|
+
const html = useMemo(() => {
|
|
49
|
+
return generateHTML(normalized, loadedExtensions);
|
|
50
|
+
}, [normalized, loadedExtensions]);
|
|
51
|
+
return /* @__PURE__ */ jsx("div", { className: getClassName(), children: /* @__PURE__ */ jsx("div", { className: "rich-text", dangerouslySetInnerHTML: { __html: html } }) });
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
RichTextRender
|
|
55
|
+
};
|