@sps-woodland/rich-text-editor 8.50.2 → 8.51.0
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 +15 -1
- package/lib/index.d.ts +1 -3
- package/lib/index.js +146 -4
- package/lib/index.umd.cjs +5 -74
- package/lib/style.css +1 -1
- package/package.json +9 -24
- package/vite.config.mjs +5 -14
- package/global.d.ts +0 -4
- package/lib/RTELinkModal.d.ts +0 -12
- package/lib/RichTextEditor.css.d.ts +0 -14
- package/lib/RichTextEditor.d.ts +0 -7
- package/lib/browser-ponyfill-D7tZnTg2-CJbu-7nl.js +0 -366
- package/lib/hooks/useHtmlToMd.d.ts +0 -1
- package/lib/hooks/useMdToHtml.d.ts +0 -1
- package/lib/hooks/useRTEContent.d.ts +0 -13
- package/lib/hooks/useRTEObserver.d.ts +0 -5
- package/lib/hooks/useRTESelectionListener.d.ts +0 -6
- package/lib/hooks/useRTEToolbarButtons.d.ts +0 -14
- package/lib/icons/index.d.ts +0 -11
- package/lib/index-C7zTOoex.js +0 -20142
- package/lib/toolbar-button/RTEToolbarButton.css.d.ts +0 -15
- package/lib/toolbar-button/RTEToolbarButton.d.ts +0 -10
- package/lib/utils/utils.d.ts +0 -2
package/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
## [@sps-woodland/rich-text-editor](https://github.com/SPSCommerce/woodland/tree/master/packages/@sps-woodland/rich-text-editor#readme)
|
|
2
2
|
|
|
3
|
-
SPS Woodland Design System rich text editor component
|
|
3
|
+
SPS Woodland Design System rich text editor component.
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
// Preferred (mono-package, tree-shakes per component)
|
|
9
|
+
import { RichTextEditor } from "@sps-woodland/core/rich-text-editor";
|
|
10
|
+
import "@sps-woodland/core/rich-text-editor/style.css";
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// Still supported, re-exports from @sps-woodland/core
|
|
15
|
+
import { RichTextEditor } from "@sps-woodland/rich-text-editor";
|
|
16
|
+
import "@sps-woodland/rich-text-editor/style.css";
|
|
17
|
+
```
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,6 +1,148 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RichTextEditor as t } from "@sps-woodland/core/rich-text-editor";
|
|
2
|
+
export * from "@sps-woodland/core/rich-text-editor";
|
|
3
|
+
import { code as e } from "@spscommerce/utils";
|
|
4
|
+
import * as o from "react";
|
|
5
|
+
const r = {
|
|
6
|
+
description: () => /* @__PURE__ */ o.createElement("p", null, "Placeholder for Rich Text Editor guidelines"),
|
|
7
|
+
components: [t],
|
|
8
|
+
examples: {
|
|
9
|
+
general: {
|
|
10
|
+
label: "General Usage",
|
|
11
|
+
description: "Coming Soon"
|
|
12
|
+
},
|
|
13
|
+
basic: {
|
|
14
|
+
label: "Basic Usage",
|
|
15
|
+
examples: {
|
|
16
|
+
basic: {
|
|
17
|
+
react: e`
|
|
18
|
+
import { RichTextEditor } from "@sps-woodland/rich-text-editor";
|
|
19
|
+
import { useSpsForm, SpsLabel } from "@spscommerce/ds-react";
|
|
20
|
+
|
|
21
|
+
function Component() {
|
|
22
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
23
|
+
text: "",
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const mdChangeHandler = ({ md }) => {
|
|
27
|
+
updateForm({ ...formValue, text: md });
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<SpsLabel for={formMeta.fields.text}>Markdown</SpsLabel>
|
|
33
|
+
<RichTextEditor
|
|
34
|
+
md={formValue.text}
|
|
35
|
+
onChange={(event) => mdChangeHandler(event)}
|
|
36
|
+
/>
|
|
37
|
+
{JSON.stringify(formValue)}
|
|
38
|
+
</>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
`
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
markdown: {
|
|
46
|
+
label: "Using Markdown",
|
|
47
|
+
examples: {
|
|
48
|
+
markdown: {
|
|
49
|
+
react: e`
|
|
50
|
+
import { RichTextEditor } from "@sps-woodland/rich-text-editor";
|
|
51
|
+
import { useSpsForm, SpsLabel } from "@spscommerce/ds-react";
|
|
52
|
+
|
|
53
|
+
function Component() {
|
|
54
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
55
|
+
text: "**bold text** _italic text_",
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const mdChangeHandler = ({ md }) => {
|
|
59
|
+
updateForm({ ...formValue, text: md });
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<>
|
|
64
|
+
<SpsLabel for={formMeta.fields.text}>Markdown</SpsLabel>
|
|
65
|
+
<RichTextEditor
|
|
66
|
+
md={formValue.text}
|
|
67
|
+
onChange={(event) => mdChangeHandler(event)}
|
|
68
|
+
/>
|
|
69
|
+
{JSON.stringify(formValue)}
|
|
70
|
+
</>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
`
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
html: {
|
|
78
|
+
label: "Using HTML",
|
|
79
|
+
examples: {
|
|
80
|
+
html: {
|
|
81
|
+
react: e`
|
|
82
|
+
import { RichTextEditor } from "@sps-woodland/rich-text-editor";
|
|
83
|
+
import { useSpsForm, SpsLabel } from "@spscommerce/ds-react";
|
|
84
|
+
|
|
85
|
+
function Component() {
|
|
86
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
87
|
+
text: "<b>bold text</b><ul><li>bulleted list</li></ul>",
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const htmlChangeHandler = ({ html }) => {
|
|
91
|
+
updateForm({ ...formValue, text: html });
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<>
|
|
96
|
+
<SpsLabel for={formMeta.fields.text}>Markdown</SpsLabel>
|
|
97
|
+
<RichTextEditor
|
|
98
|
+
html={formValue.text}
|
|
99
|
+
onChange={(event) => htmlChangeHandler(event)}
|
|
100
|
+
/>
|
|
101
|
+
{JSON.stringify(formValue)}
|
|
102
|
+
</>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
`
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
disabled: {
|
|
110
|
+
label: "Disabled State",
|
|
111
|
+
examples: {
|
|
112
|
+
disabled: {
|
|
113
|
+
react: e`
|
|
114
|
+
import { RichTextEditor } from "@sps-woodland/rich-text-editor";
|
|
115
|
+
import { useSpsForm, SpsLabel } from "@spscommerce/ds-react";
|
|
116
|
+
|
|
117
|
+
function Component() {
|
|
118
|
+
const { formValue, formMeta, updateForm } = useSpsForm({
|
|
119
|
+
text: "",
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const mdChangeHandler = ({ md }) => {
|
|
123
|
+
updateForm({ ...formValue, text: md });
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<>
|
|
128
|
+
<SpsLabel for={formMeta.fields.text}>Markdown</SpsLabel>
|
|
129
|
+
<RichTextEditor
|
|
130
|
+
md={formValue.text}
|
|
131
|
+
onChange={(event) => mdChangeHandler(event)}
|
|
132
|
+
disabled
|
|
133
|
+
/>
|
|
134
|
+
{JSON.stringify(formValue)}
|
|
135
|
+
</>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
`
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}, n = {
|
|
144
|
+
"Rich Text Editor": r
|
|
145
|
+
};
|
|
2
146
|
export {
|
|
3
|
-
|
|
4
|
-
i as RichTextEditor,
|
|
5
|
-
o as RichTextEditorExamples
|
|
147
|
+
n as MANIFEST
|
|
6
148
|
};
|