@wizeworks/silicaui-editor 0.3.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/LICENSE +21 -0
- package/README.md +55 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +133 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 WizeWorks
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @wizeworks/silicaui-editor
|
|
2
|
+
|
|
3
|
+
Silica UI's `<RichTextEditor>` — [TipTap](https://tiptap.dev/) wrapped with a
|
|
4
|
+
Silica-styled formatting toolbar and content surface. Controlled or
|
|
5
|
+
uncontrolled, HTML in and out.
|
|
6
|
+
|
|
7
|
+
[](https://silicaui.com)
|
|
8
|
+
[](https://www.npmjs.com/package/@wizeworks/silicaui-editor)
|
|
9
|
+
[](https://www.npmjs.com/package/@wizeworks/silicaui-editor)
|
|
10
|
+
[](https://bundlephobia.com/package/@wizeworks/silicaui-editor)
|
|
11
|
+
[](https://github.com/silicaui/silicaui/blob/main/LICENSE)
|
|
12
|
+
[](https://github.com/silicaui/silicaui/actions/workflows/ci.yml)
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add @wizeworks/silicaui-editor @wizeworks/silicaui-react
|
|
18
|
+
pnpm add -D @wizeworks/silicaui tailwindcss
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { RichTextEditor } from "@wizeworks/silicaui-editor";
|
|
25
|
+
|
|
26
|
+
const [html, setHtml] = React.useState("<p>Hello world</p>");
|
|
27
|
+
|
|
28
|
+
<RichTextEditor value={html} onValueChange={setHtml} placeholder="Write something…" />
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Ships with `StarterKit`, link, and placeholder extensions preconfigured.
|
|
32
|
+
|
|
33
|
+
## `<RichTextEditor>` props
|
|
34
|
+
|
|
35
|
+
| Prop | Type | Default |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| `value` | `string` — controlled HTML value | — |
|
|
38
|
+
| `defaultValue` | `string` — uncontrolled initial HTML | — |
|
|
39
|
+
| `onValueChange` | `(html: string) => void` — fires with the editor's HTML on every change | — |
|
|
40
|
+
| `placeholder` | `string` — empty-state placeholder text | — |
|
|
41
|
+
| `editable` | `boolean` | `true` |
|
|
42
|
+
| `toolbar` | `boolean` — show the formatting toolbar | `true` |
|
|
43
|
+
| `contentClassName` | `string` — class for the editable content surface | — |
|
|
44
|
+
|
|
45
|
+
Also re-exports TipTap's `useEditor`, `EditorContent`, and `Editor` (plus
|
|
46
|
+
`EditorOptions`), so you can extend the editor — add extensions, drive
|
|
47
|
+
commands imperatively — without a separate TipTap install.
|
|
48
|
+
|
|
49
|
+
## Links
|
|
50
|
+
|
|
51
|
+
- [silicaui.com](https://silicaui.com) — website & docs
|
|
52
|
+
|
|
53
|
+
- [GitHub repo](https://github.com/silicaui/silicaui)
|
|
54
|
+
- [Issues](https://github.com/silicaui/silicaui/issues)
|
|
55
|
+
- [`@wizeworks/silicaui-react`](https://www.npmjs.com/package/@wizeworks/silicaui-react) — the component layer this package extends
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export { Editor, EditorContent, EditorOptions, useEditor } from '@tiptap/react';
|
|
3
|
+
|
|
4
|
+
interface RichTextEditorProps {
|
|
5
|
+
/** Controlled HTML value. */
|
|
6
|
+
value?: string;
|
|
7
|
+
/** Uncontrolled initial HTML. */
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
/** Fires with the editor's HTML on every change. */
|
|
10
|
+
onValueChange?: (html: string) => void;
|
|
11
|
+
/** Empty-state placeholder text. */
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
/** Allow editing. Default `true`. */
|
|
14
|
+
editable?: boolean;
|
|
15
|
+
/** Show the formatting toolbar. Default `true`. */
|
|
16
|
+
toolbar?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
/** Class for the editable content surface. */
|
|
19
|
+
contentClassName?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* RichTextEditor — a TipTap editor with a Silica-styled toolbar and content
|
|
23
|
+
* surface. Emits HTML via `onValueChange`; control it with `value` or run
|
|
24
|
+
* uncontrolled with `defaultValue`. StarterKit + Link + Placeholder are wired in;
|
|
25
|
+
* drop `toolbar={false}` for a bare editable surface.
|
|
26
|
+
*/
|
|
27
|
+
declare function RichTextEditor({ value, defaultValue, onValueChange, placeholder, editable, toolbar, className, contentClassName, }: RichTextEditorProps): React.JSX.Element;
|
|
28
|
+
|
|
29
|
+
export { RichTextEditor, type RichTextEditorProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEditor, EditorContent } from '@tiptap/react';
|
|
3
|
+
export { Editor, EditorContent, useEditor } from '@tiptap/react';
|
|
4
|
+
import StarterKit from '@tiptap/starter-kit';
|
|
5
|
+
import Link from '@tiptap/extension-link';
|
|
6
|
+
import Placeholder from '@tiptap/extension-placeholder';
|
|
7
|
+
import { useSilicaClass, cx } from '@wizeworks/silicaui-react';
|
|
8
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
// src/rich-text-editor.tsx
|
|
11
|
+
var icons = {
|
|
12
|
+
bulletList: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
13
|
+
/* @__PURE__ */ jsx("path", { d: "M8 6h13M8 12h13M8 18h13" }),
|
|
14
|
+
/* @__PURE__ */ jsx("circle", { cx: "3.5", cy: "6", r: "1.2", fill: "currentColor", stroke: "none" }),
|
|
15
|
+
/* @__PURE__ */ jsx("circle", { cx: "3.5", cy: "12", r: "1.2", fill: "currentColor", stroke: "none" }),
|
|
16
|
+
/* @__PURE__ */ jsx("circle", { cx: "3.5", cy: "18", r: "1.2", fill: "currentColor", stroke: "none" })
|
|
17
|
+
] }),
|
|
18
|
+
orderedList: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M10 6h11M10 12h11M10 18h11M4 4v4M3 8h2M3 16h2a1 1 0 0 1 0 2H3a1 1 0 0 0 0 2h2" }) }),
|
|
19
|
+
quote: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", stroke: "none", children: /* @__PURE__ */ jsx("path", { d: "M7 7H4a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h2v1a2 2 0 0 1-2 2H3v2h1a4 4 0 0 0 4-4V9a2 2 0 0 0-1-2Zm11 0h-3a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h2v1a2 2 0 0 1-2 2h-1v2h1a4 4 0 0 0 4-4V9a2 2 0 0 0-1-2Z" }) }),
|
|
20
|
+
code: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "m8 8-4 4 4 4M16 8l4 4-4 4M13 5l-2 14" }) }),
|
|
21
|
+
link: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
22
|
+
/* @__PURE__ */ jsx("path", { d: "M10 13a5 5 0 0 0 7 0l2-2a5 5 0 0 0-7-7l-1 1" }),
|
|
23
|
+
/* @__PURE__ */ jsx("path", { d: "M14 11a5 5 0 0 0-7 0l-2 2a5 5 0 0 0 7 7l1-1" })
|
|
24
|
+
] }),
|
|
25
|
+
undo: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
26
|
+
/* @__PURE__ */ jsx("path", { d: "M9 14 4 9l5-5" }),
|
|
27
|
+
/* @__PURE__ */ jsx("path", { d: "M4 9h11a5 5 0 0 1 0 10h-1" })
|
|
28
|
+
] }),
|
|
29
|
+
redo: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
30
|
+
/* @__PURE__ */ jsx("path", { d: "m15 14 5-5-5-5" }),
|
|
31
|
+
/* @__PURE__ */ jsx("path", { d: "M20 9H9a5 5 0 0 0 0 10h1" })
|
|
32
|
+
] })
|
|
33
|
+
};
|
|
34
|
+
function Toolbar({ editor }) {
|
|
35
|
+
const sc = useSilicaClass();
|
|
36
|
+
const Btn = ({ onClick, active, disabled, title, children }) => /* @__PURE__ */ jsx(
|
|
37
|
+
"button",
|
|
38
|
+
{
|
|
39
|
+
type: "button",
|
|
40
|
+
className: cx(sc("rich-text-editor-btn")),
|
|
41
|
+
"data-active": active || void 0,
|
|
42
|
+
disabled,
|
|
43
|
+
title,
|
|
44
|
+
"aria-label": title,
|
|
45
|
+
"aria-pressed": active || void 0,
|
|
46
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
47
|
+
onClick,
|
|
48
|
+
children
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
const sep = /* @__PURE__ */ jsx("span", { className: cx(sc("rich-text-editor-sep")), "aria-hidden": "true" });
|
|
52
|
+
const setLink = () => {
|
|
53
|
+
const prev = editor.getAttributes("link").href;
|
|
54
|
+
const url = window.prompt("Link URL", prev ?? "");
|
|
55
|
+
if (url === null) return;
|
|
56
|
+
if (url === "") {
|
|
57
|
+
editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ jsxs("div", { className: cx(sc("rich-text-editor-toolbar")), role: "toolbar", "aria-label": "Formatting", children: [
|
|
63
|
+
/* @__PURE__ */ jsx(Btn, { title: "Bold", active: editor.isActive("bold"), onClick: () => editor.chain().focus().toggleBold().run(), children: /* @__PURE__ */ jsx("span", { style: { fontWeight: 800 }, children: "B" }) }),
|
|
64
|
+
/* @__PURE__ */ jsx(Btn, { title: "Italic", active: editor.isActive("italic"), onClick: () => editor.chain().focus().toggleItalic().run(), children: /* @__PURE__ */ jsx("span", { style: { fontStyle: "italic", fontFamily: "Georgia, serif" }, children: "I" }) }),
|
|
65
|
+
/* @__PURE__ */ jsx(Btn, { title: "Strikethrough", active: editor.isActive("strike"), onClick: () => editor.chain().focus().toggleStrike().run(), children: /* @__PURE__ */ jsx("span", { style: { textDecoration: "line-through" }, children: "S" }) }),
|
|
66
|
+
sep,
|
|
67
|
+
/* @__PURE__ */ jsx(Btn, { title: "Heading 1", active: editor.isActive("heading", { level: 1 }), onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(), children: "H1" }),
|
|
68
|
+
/* @__PURE__ */ jsx(Btn, { title: "Heading 2", active: editor.isActive("heading", { level: 2 }), onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(), children: "H2" }),
|
|
69
|
+
sep,
|
|
70
|
+
/* @__PURE__ */ jsx(Btn, { title: "Bullet list", active: editor.isActive("bulletList"), onClick: () => editor.chain().focus().toggleBulletList().run(), children: icons.bulletList }),
|
|
71
|
+
/* @__PURE__ */ jsx(Btn, { title: "Ordered list", active: editor.isActive("orderedList"), onClick: () => editor.chain().focus().toggleOrderedList().run(), children: icons.orderedList }),
|
|
72
|
+
sep,
|
|
73
|
+
/* @__PURE__ */ jsx(Btn, { title: "Quote", active: editor.isActive("blockquote"), onClick: () => editor.chain().focus().toggleBlockquote().run(), children: icons.quote }),
|
|
74
|
+
/* @__PURE__ */ jsx(Btn, { title: "Code block", active: editor.isActive("codeBlock"), onClick: () => editor.chain().focus().toggleCodeBlock().run(), children: icons.code }),
|
|
75
|
+
/* @__PURE__ */ jsx(Btn, { title: "Link", active: editor.isActive("link"), onClick: setLink, children: icons.link }),
|
|
76
|
+
sep,
|
|
77
|
+
/* @__PURE__ */ jsx(Btn, { title: "Undo", disabled: !editor.can().undo(), onClick: () => editor.chain().focus().undo().run(), children: icons.undo }),
|
|
78
|
+
/* @__PURE__ */ jsx(Btn, { title: "Redo", disabled: !editor.can().redo(), onClick: () => editor.chain().focus().redo().run(), children: icons.redo })
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
function RichTextEditor({
|
|
82
|
+
value,
|
|
83
|
+
defaultValue,
|
|
84
|
+
onValueChange,
|
|
85
|
+
placeholder = "Write something\u2026",
|
|
86
|
+
editable = true,
|
|
87
|
+
toolbar = true,
|
|
88
|
+
className,
|
|
89
|
+
contentClassName
|
|
90
|
+
}) {
|
|
91
|
+
const sc = useSilicaClass();
|
|
92
|
+
const editor = useEditor({
|
|
93
|
+
editable,
|
|
94
|
+
immediatelyRender: false,
|
|
95
|
+
extensions: [
|
|
96
|
+
StarterKit,
|
|
97
|
+
Link.configure({ openOnClick: false, autolink: true }),
|
|
98
|
+
Placeholder.configure({ placeholder })
|
|
99
|
+
],
|
|
100
|
+
content: value ?? defaultValue ?? "",
|
|
101
|
+
onUpdate: ({ editor: editor2 }) => onValueChange?.(editor2.getHTML())
|
|
102
|
+
});
|
|
103
|
+
React.useEffect(() => {
|
|
104
|
+
if (!editor || value === void 0) return;
|
|
105
|
+
if (value !== editor.getHTML()) {
|
|
106
|
+
editor.commands.setContent(value, false);
|
|
107
|
+
}
|
|
108
|
+
}, [value, editor]);
|
|
109
|
+
React.useEffect(() => {
|
|
110
|
+
editor?.setEditable(editable);
|
|
111
|
+
}, [editable, editor]);
|
|
112
|
+
return /* @__PURE__ */ jsxs(
|
|
113
|
+
"div",
|
|
114
|
+
{
|
|
115
|
+
className: cx(sc("rich-text-editor"), className),
|
|
116
|
+
"data-disabled": !editable || void 0,
|
|
117
|
+
children: [
|
|
118
|
+
toolbar && editor && /* @__PURE__ */ jsx(Toolbar, { editor }),
|
|
119
|
+
/* @__PURE__ */ jsx(
|
|
120
|
+
EditorContent,
|
|
121
|
+
{
|
|
122
|
+
editor,
|
|
123
|
+
className: cx(sc("rich-text-editor-content"), contentClassName)
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { RichTextEditor };
|
|
132
|
+
//# sourceMappingURL=index.js.map
|
|
133
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/rich-text-editor.tsx"],"names":["editor"],"mappings":";;;;;;;;;;AAyBA,IAAM,KAAA,GAAQ;AAAA,EACZ,UAAA,kBACE,IAAA,CAAC,KAAA,EAAA,EAAI,OAAA,EAAQ,aAAY,IAAA,EAAK,MAAA,EAAO,MAAA,EAAO,cAAA,EAAe,WAAA,EAAY,GAAA,EAAI,aAAA,EAAc,OAAA,EAAQ,gBAAe,OAAA,EAC9G,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,GAAE,yBAAA,EAA0B,CAAA;AAAA,oBAClC,GAAA,CAAC,QAAA,EAAA,EAAO,EAAA,EAAG,KAAA,EAAM,EAAA,EAAG,GAAA,EAAI,CAAA,EAAE,KAAA,EAAM,IAAA,EAAK,cAAA,EAAe,MAAA,EAAO,MAAA,EAAO,CAAA;AAAA,oBAClE,GAAA,CAAC,QAAA,EAAA,EAAO,EAAA,EAAG,KAAA,EAAM,EAAA,EAAG,IAAA,EAAK,CAAA,EAAE,KAAA,EAAM,IAAA,EAAK,cAAA,EAAe,MAAA,EAAO,MAAA,EAAO,CAAA;AAAA,oBACnE,GAAA,CAAC,QAAA,EAAA,EAAO,EAAA,EAAG,KAAA,EAAM,EAAA,EAAG,IAAA,EAAK,CAAA,EAAE,KAAA,EAAM,IAAA,EAAK,cAAA,EAAe,MAAA,EAAO,MAAA,EAAO;AAAA,GAAA,EACrE,CAAA;AAAA,EAEF,6BACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAQ,WAAA,EAAY,IAAA,EAAK,QAAO,MAAA,EAAO,cAAA,EAAe,aAAY,GAAA,EAAI,aAAA,EAAc,SAAQ,cAAA,EAAe,OAAA,EAC9G,8BAAC,MAAA,EAA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AAS,UAAA,CAAW,KAAA,EAAO,KAAK,CAAA;AAAA,IACzC;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,EAAO,MAAM,CAAC,CAAA;AAElB,EAAM,gBAAU,MAAM;AACpB,IAAA,MAAA,EAAQ,YAAY,QAAQ,CAAA;AAAA,EAC9B,CAAA,EAAG,CAAC,QAAA,EAAU,MAAM,CAAC,CAAA;AAErB,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,EAAA,CAAG,EAAA,CAAG,kBAAkB,GAAG,SAAS,CAAA;AAAA,MAC/C,eAAA,EAAe,CAAC,QAAA,IAAY,MAAA;AAAA,MAE3B,QAAA,EAAA;AAAA,QAAA,OAAA,IAAW,MAAA,oBAAU,GAAA,CAAC,OAAA,EAAA,EAAQ,MAAA,EAAgB,CAAA;AAAA,wBAC/C,GAAA;AAAA,UAAC,aAAA;AAAA,UAAA;AAAA,YACC,MAAA;AAAA,YACA,SAAA,EAAW,EAAA,CAAG,EAAA,CAAG,0BAA0B,GAAG,gBAAgB;AAAA;AAAA;AAChE;AAAA;AAAA,GACF;AAEJ","file":"index.js","sourcesContent":["import * as React from \"react\";\nimport { useEditor, EditorContent, type Editor } from \"@tiptap/react\";\nimport StarterKit from \"@tiptap/starter-kit\";\nimport Link from \"@tiptap/extension-link\";\nimport Placeholder from \"@tiptap/extension-placeholder\";\nimport { cx, useSilicaClass } from \"@wizeworks/silicaui-react\";\n\nexport interface RichTextEditorProps {\n /** Controlled HTML value. */\n value?: string;\n /** Uncontrolled initial HTML. */\n defaultValue?: string;\n /** Fires with the editor's HTML on every change. */\n onValueChange?: (html: string) => void;\n /** Empty-state placeholder text. */\n placeholder?: string;\n /** Allow editing. Default `true`. */\n editable?: boolean;\n /** Show the formatting toolbar. Default `true`. */\n toolbar?: boolean;\n className?: string;\n /** Class for the editable content surface. */\n contentClassName?: string;\n}\n\nconst icons = {\n bulletList: (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M8 6h13M8 12h13M8 18h13\" />\n <circle cx=\"3.5\" cy=\"6\" r=\"1.2\" fill=\"currentColor\" stroke=\"none\" />\n <circle cx=\"3.5\" cy=\"12\" r=\"1.2\" fill=\"currentColor\" stroke=\"none\" />\n <circle cx=\"3.5\" cy=\"18\" r=\"1.2\" fill=\"currentColor\" stroke=\"none\" />\n </svg>\n ),\n orderedList: (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M10 6h11M10 12h11M10 18h11M4 4v4M3 8h2M3 16h2a1 1 0 0 1 0 2H3a1 1 0 0 0 0 2h2\" />\n </svg>\n ),\n quote: (\n <svg viewBox=\"0 0 24 24\" fill=\"currentColor\" stroke=\"none\">\n <path d=\"M7 7H4a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h2v1a2 2 0 0 1-2 2H3v2h1a4 4 0 0 0 4-4V9a2 2 0 0 0-1-2Zm11 0h-3a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h2v1a2 2 0 0 1-2 2h-1v2h1a4 4 0 0 0 4-4V9a2 2 0 0 0-1-2Z\" />\n </svg>\n ),\n code: (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"m8 8-4 4 4 4M16 8l4 4-4 4M13 5l-2 14\" />\n </svg>\n ),\n link: (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M10 13a5 5 0 0 0 7 0l2-2a5 5 0 0 0-7-7l-1 1\" />\n <path d=\"M14 11a5 5 0 0 0-7 0l-2 2a5 5 0 0 0 7 7l1-1\" />\n </svg>\n ),\n undo: (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M9 14 4 9l5-5\" />\n <path d=\"M4 9h11a5 5 0 0 1 0 10h-1\" />\n </svg>\n ),\n redo: (\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"m15 14 5-5-5-5\" />\n <path d=\"M20 9H9a5 5 0 0 0 0 10h1\" />\n </svg>\n ),\n};\n\ninterface BtnProps {\n onClick: () => void;\n active?: boolean;\n disabled?: boolean;\n title: string;\n children: React.ReactNode;\n}\n\nfunction Toolbar({ editor }: { editor: Editor }) {\n const sc = useSilicaClass();\n\n const Btn = ({ onClick, active, disabled, title, children }: BtnProps) => (\n <button\n type=\"button\"\n className={cx(sc(\"rich-text-editor-btn\"))}\n data-active={active || undefined}\n disabled={disabled}\n title={title}\n aria-label={title}\n aria-pressed={active || undefined}\n // Keep the editor selection instead of blurring to the button.\n onMouseDown={(e) => e.preventDefault()}\n onClick={onClick}\n >\n {children}\n </button>\n );\n\n const sep = <span className={cx(sc(\"rich-text-editor-sep\"))} aria-hidden=\"true\" />;\n\n const setLink = () => {\n const prev = editor.getAttributes(\"link\").href as string | undefined;\n const url = window.prompt(\"Link URL\", prev ?? \"\");\n if (url === null) return;\n if (url === \"\") {\n editor.chain().focus().extendMarkRange(\"link\").unsetLink().run();\n return;\n }\n editor.chain().focus().extendMarkRange(\"link\").setLink({ href: url }).run();\n };\n\n return (\n <div className={cx(sc(\"rich-text-editor-toolbar\"))} role=\"toolbar\" aria-label=\"Formatting\">\n <Btn title=\"Bold\" active={editor.isActive(\"bold\")} onClick={() => editor.chain().focus().toggleBold().run()}>\n <span style={{ fontWeight: 800 }}>B</span>\n </Btn>\n <Btn title=\"Italic\" active={editor.isActive(\"italic\")} onClick={() => editor.chain().focus().toggleItalic().run()}>\n <span style={{ fontStyle: \"italic\", fontFamily: \"Georgia, serif\" }}>I</span>\n </Btn>\n <Btn title=\"Strikethrough\" active={editor.isActive(\"strike\")} onClick={() => editor.chain().focus().toggleStrike().run()}>\n <span style={{ textDecoration: \"line-through\" }}>S</span>\n </Btn>\n {sep}\n <Btn title=\"Heading 1\" active={editor.isActive(\"heading\", { level: 1 })} onClick={() => editor.chain().focus().toggleHeading({ level: 1 }).run()}>\n H1\n </Btn>\n <Btn title=\"Heading 2\" active={editor.isActive(\"heading\", { level: 2 })} onClick={() => editor.chain().focus().toggleHeading({ level: 2 }).run()}>\n H2\n </Btn>\n {sep}\n <Btn title=\"Bullet list\" active={editor.isActive(\"bulletList\")} onClick={() => editor.chain().focus().toggleBulletList().run()}>\n {icons.bulletList}\n </Btn>\n <Btn title=\"Ordered list\" active={editor.isActive(\"orderedList\")} onClick={() => editor.chain().focus().toggleOrderedList().run()}>\n {icons.orderedList}\n </Btn>\n {sep}\n <Btn title=\"Quote\" active={editor.isActive(\"blockquote\")} onClick={() => editor.chain().focus().toggleBlockquote().run()}>\n {icons.quote}\n </Btn>\n <Btn title=\"Code block\" active={editor.isActive(\"codeBlock\")} onClick={() => editor.chain().focus().toggleCodeBlock().run()}>\n {icons.code}\n </Btn>\n <Btn title=\"Link\" active={editor.isActive(\"link\")} onClick={setLink}>\n {icons.link}\n </Btn>\n {sep}\n <Btn title=\"Undo\" disabled={!editor.can().undo()} onClick={() => editor.chain().focus().undo().run()}>\n {icons.undo}\n </Btn>\n <Btn title=\"Redo\" disabled={!editor.can().redo()} onClick={() => editor.chain().focus().redo().run()}>\n {icons.redo}\n </Btn>\n </div>\n );\n}\n\n/**\n * RichTextEditor — a TipTap editor with a Silica-styled toolbar and content\n * surface. Emits HTML via `onValueChange`; control it with `value` or run\n * uncontrolled with `defaultValue`. StarterKit + Link + Placeholder are wired in;\n * drop `toolbar={false}` for a bare editable surface.\n */\nexport function RichTextEditor({\n value,\n defaultValue,\n onValueChange,\n placeholder = \"Write something…\",\n editable = true,\n toolbar = true,\n className,\n contentClassName,\n}: RichTextEditorProps) {\n const sc = useSilicaClass();\n\n const editor = useEditor({\n editable,\n immediatelyRender: false,\n extensions: [\n StarterKit,\n Link.configure({ openOnClick: false, autolink: true }),\n Placeholder.configure({ placeholder }),\n ],\n content: value ?? defaultValue ?? \"\",\n onUpdate: ({ editor }) => onValueChange?.(editor.getHTML()),\n });\n\n // Sync a controlled value in without firing onUpdate (avoids a loop) or\n // stomping the cursor when the change already came from the editor.\n React.useEffect(() => {\n if (!editor || value === undefined) return;\n if (value !== editor.getHTML()) {\n editor.commands.setContent(value, false);\n }\n }, [value, editor]);\n\n React.useEffect(() => {\n editor?.setEditable(editable);\n }, [editable, editor]);\n\n return (\n <div\n className={cx(sc(\"rich-text-editor\"), className)}\n data-disabled={!editable || undefined}\n >\n {toolbar && editor && <Toolbar editor={editor} />}\n <EditorContent\n editor={editor}\n className={cx(sc(\"rich-text-editor-content\"), contentClassName)}\n />\n </div>\n );\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wizeworks/silicaui-editor",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Silica UI rich-text editor — TipTap wrapped with a Silica-styled toolbar and content surface.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "WizeWorks",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/silicaui/silicaui.git",
|
|
11
|
+
"directory": "packages/silicaui-editor"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://silicaui.com",
|
|
14
|
+
"bugs": "https://github.com/silicaui/silicaui/issues",
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react": ">=18",
|
|
29
|
+
"react-dom": ">=18",
|
|
30
|
+
"@wizeworks/silicaui-react": ">=0.0.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@tiptap/react": "^2.10.0",
|
|
34
|
+
"@tiptap/pm": "^2.10.0",
|
|
35
|
+
"@tiptap/starter-kit": "^2.10.0",
|
|
36
|
+
"@tiptap/extension-link": "^2.10.0",
|
|
37
|
+
"@tiptap/extension-placeholder": "^2.10.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/react": "^19.0.0",
|
|
41
|
+
"@types/react-dom": "^19.0.0",
|
|
42
|
+
"react": "^19.0.0",
|
|
43
|
+
"react-dom": "^19.0.0",
|
|
44
|
+
"tsup": "^8.3.0",
|
|
45
|
+
"typescript": "^5.6.0",
|
|
46
|
+
"@wizeworks/silicaui-react": "0.3.0"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"react",
|
|
50
|
+
"rich-text",
|
|
51
|
+
"editor",
|
|
52
|
+
"tiptap",
|
|
53
|
+
"wysiwyg",
|
|
54
|
+
"design-system",
|
|
55
|
+
"silica"
|
|
56
|
+
],
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "tsup",
|
|
59
|
+
"dev": "tsup --watch",
|
|
60
|
+
"typecheck": "tsc --noEmit"
|
|
61
|
+
}
|
|
62
|
+
}
|