@synerise/ds-rich-text 2.1.0 → 2.2.1
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/CHANGELOG.md +19 -0
- package/dist/RichText.js +1 -3
- package/dist/RichText.styles.d.ts +4 -5
- package/dist/RichText.styles.js +10 -11
- package/dist/components/Toolbar.js +1 -3
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.2.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-rich-text@2.2.0...@synerise/ds-rich-text@2.2.1) (2026-11-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-rich-text
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [2.2.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-rich-text@2.1.0...@synerise/ds-rich-text@2.2.0) (2026-10-29)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* integrate Token Studio design tokens across the design system ([aabb447](https://github.com/Synerise/synerise-design/commit/aabb447edfb2d0c85e3de1f07e809ef84083453b))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [2.1.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-rich-text@2.0.11...@synerise/ds-rich-text@2.1.0) (2026-10-28)
|
|
7
26
|
|
|
8
27
|
|
package/dist/RichText.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
3
3
|
import { forwardRef, useState, useRef, useMemo, useCallback, useEffect } from "react";
|
|
4
|
-
import { useTheme } from "@synerise/ds-core";
|
|
5
4
|
import { FormFieldLabel } from "@synerise/ds-form-field";
|
|
6
5
|
import Icon, { EditS } from "@synerise/ds-icon";
|
|
7
6
|
import { useCombinedRefs, useOnClickOutside } from "@synerise/ds-utils";
|
|
@@ -67,7 +66,6 @@ const RichText = forwardRef(({
|
|
|
67
66
|
const [subtleBlurred, setSubtleBlurred] = useState(false);
|
|
68
67
|
const lastEmittedRef = useRef("");
|
|
69
68
|
const wrapperRef = useCombinedRefs(ref);
|
|
70
|
-
const theme = useTheme();
|
|
71
69
|
const hasError = !!errorText;
|
|
72
70
|
const isSubtle = subtle && !readOnly && !disabled;
|
|
73
71
|
const isSubtlePreview = isSubtle && !subtleActive && !hasError;
|
|
@@ -172,7 +170,7 @@ const RichText = forwardRef(({
|
|
|
172
170
|
/* @__PURE__ */ jsxs(EditorWrapper, { $hasError: hasError, $noBorder: noBorder, $isFocused: isFocused, $subtlePreview: isSubtlePreview, $subtleBlurred: subtleBlurred, $animations: animations, onClick: isSubtlePreview ? handleSubtleActivate : void 0, "data-testid": "rich-text-editor-wrapper", children: [
|
|
173
171
|
!hideToolbar && !readOnly && !isSubtlePreview && /* @__PURE__ */ jsx(ToolbarArea, { children: /* @__PURE__ */ jsx(Toolbar, { editor, features: toolbarFeatures, headingLevels, texts, disabled, onImageUpload, onEditWithAI, editWithAIOptions }) }),
|
|
174
172
|
/* @__PURE__ */ jsx(EditorArea, { $height: height, $maxHeight: maxHeight, $readOnly: readOnly, $subtlePreview: isSubtlePreview, "data-testid": "rich-text-editor", children: /* @__PURE__ */ jsx(EditorContent, { editor }) }),
|
|
175
|
-
isSubtlePreview && /* @__PURE__ */ jsx(SubtleSuffix, { "data-testid": "rich-text-subtle-edit-icon", children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(EditS, {})
|
|
173
|
+
isSubtlePreview && /* @__PURE__ */ jsx(SubtleSuffix, { "data-testid": "rich-text-subtle-edit-icon", children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(EditS, {}) }) })
|
|
176
174
|
] }),
|
|
177
175
|
(errorText || description) && /* @__PURE__ */ jsxs(ContentBelow, { "data-testid": "rich-text-below", children: [
|
|
178
176
|
errorText && /* @__PURE__ */ jsx(ErrorText, { "data-testid": "rich-text-error", children: errorText }),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ThemeProps } from '@synerise/ds-core';
|
|
2
1
|
export declare const RichTextWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
3
2
|
$disabled?: boolean;
|
|
4
3
|
}, never>;
|
|
@@ -11,7 +10,7 @@ export declare const EditorWrapper: import('styled-components').StyledComponent<
|
|
|
11
10
|
$subtleBlurred?: boolean;
|
|
12
11
|
$animations?: boolean;
|
|
13
12
|
}, never>;
|
|
14
|
-
export declare const ToolbarArea: import('styled-components').StyledComponent<"div", any,
|
|
13
|
+
export declare const ToolbarArea: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
15
14
|
export declare const ToolbarItems: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
16
15
|
export declare const ToolbarEntry: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
17
16
|
export declare const EditorArea: import('styled-components').StyledComponent<"div", any, {
|
|
@@ -22,10 +21,10 @@ export declare const EditorArea: import('styled-components').StyledComponent<"di
|
|
|
22
21
|
}, never>;
|
|
23
22
|
export declare const ContentAbove: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
24
23
|
export declare const ContentBelow: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
25
|
-
export declare const ErrorText: import('styled-components').StyledComponent<"div", any,
|
|
26
|
-
export declare const Description: import('styled-components').StyledComponent<"div", any,
|
|
24
|
+
export declare const ErrorText: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
25
|
+
export declare const Description: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
27
26
|
export declare const AiGradientLabel: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
28
|
-
export declare const ToolbarSeparator: import('styled-components').StyledComponent<"div", any,
|
|
27
|
+
export declare const ToolbarSeparator: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
29
28
|
export declare const BlockMenu: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
30
29
|
export declare const PopoverForm: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
31
30
|
export declare const PopoverActions: import('styled-components').StyledComponent<"div", any, {}, never>;
|
package/dist/RichText.styles.js
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import styled, { css, keyframes } from "styled-components";
|
|
2
|
-
import { hexToRgba } from "@synerise/ds-utils";
|
|
3
2
|
const TOOLBAR_HEIGHT_PX = 44;
|
|
4
3
|
const subtleBlurAnimation = /* @__PURE__ */ keyframes(["0%{padding-top:", "px;}100%{padding-top:12px;}"], 12 + TOOLBAR_HEIGHT_PX);
|
|
5
4
|
const RichTextWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
6
5
|
displayName: "RichTextstyles__RichTextWrapper",
|
|
7
6
|
componentId: "sc-8lgglv-0"
|
|
8
|
-
})(["display:flex;flex-direction:column;", ";"], (props) => props.$disabled && css(["opacity:
|
|
7
|
+
})(["display:flex;flex-direction:column;", ";"], (props) => props.$disabled && css(["opacity:var(--ds-opacity-disabled);pointer-events:none;"]));
|
|
9
8
|
const SubtleSuffix = /* @__PURE__ */ styled.div.withConfig({
|
|
10
9
|
displayName: "RichTextstyles__SubtleSuffix",
|
|
11
10
|
componentId: "sc-8lgglv-1"
|
|
12
|
-
})(["position:absolute;right:6px;top:6px;display:flex;opacity:0;height:24px;transition:opacity 0.1s ease-in;transition-delay:0.2s;pointer-events:none;"]);
|
|
11
|
+
})(["position:absolute;right:6px;top:6px;display:flex;color:var(--ds-color-icon-base-default);opacity:0;height:24px;transition:opacity 0.1s ease-in;transition-delay:0.2s;pointer-events:none;"]);
|
|
13
12
|
const EditorWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
14
13
|
displayName: "RichTextstyles__EditorWrapper",
|
|
15
14
|
componentId: "sc-8lgglv-2"
|
|
16
|
-
})(["position:relative;border:", ";border-radius:3px;display:flex;flex-direction:column;overflow:hidden;transition:border-color 0.2s ease,background 0.1s ease-in;", ";", ";", ";", ";"], (props) => props.$noBorder ? "none" : props.$subtlePreview ? "solid 1px transparent" : `solid 1px ${props.$hasError ?
|
|
15
|
+
})(["position:relative;border:", ";border-radius:3px;display:flex;flex-direction:column;overflow:hidden;transition:border-color 0.2s ease,background 0.1s ease-in;", ";", ";", ";", ";"], (props) => props.$noBorder ? "none" : props.$subtlePreview ? "solid 1px transparent" : `solid 1px ${props.$hasError ? "var(--ds-color-border-danger-default)" : props.$isFocused ? "var(--ds-color-focus-base-default)" : "var(--ds-color-border-base-default)"}`, (props) => props.$subtlePreview && css(["cursor:pointer;&& .ProseMirror{cursor:pointer;padding-left:0;}&&:hover{background:var(--ds-rich-text-bg-hover);", "{opacity:1;}}", ";"], SubtleSuffix, props.$animations ? css(["transition:border-color 0.2s ease,background 0.1s ease-in 0.2s;&& .ProseMirror{transition:padding 0.1s ease-in 0.2s;}&& .ProseMirror p.is-editor-empty:first-child::before{transform:translateY(-6px);transition:transform 0.1s ease-in 0.2s;}&&:hover{.ProseMirror{padding-left:12px;}.ProseMirror p.is-editor-empty:first-child::before{transform:translateY(0);}}"]) : css(["transition:border-color 0.2s ease;", "{transition:none;}"], SubtleSuffix)), (props) => props.$subtlePreview && props.$subtleBlurred && props.$animations && css(["&& .ProseMirror{animation:", " 0.1s ease-in 0.2s backwards;}"], subtleBlurAnimation), (props) => props.$hasError && css(["background:var(--ds-color-background-danger-subtle);", ";"], !props.$noBorder && css(["outline:1px solid var(--ds-color-border-danger-default);outline-offset:-1px;"])), (props) => props.$isFocused && !props.$hasError && !props.$noBorder && css(["outline:1px solid var(--ds-color-focus-base-default);outline-offset:-1px;"]));
|
|
17
16
|
const ToolbarArea = /* @__PURE__ */ styled.div.withConfig({
|
|
18
17
|
displayName: "RichTextstyles__ToolbarArea",
|
|
19
18
|
componentId: "sc-8lgglv-3"
|
|
20
|
-
})(["padding:4px;box-shadow:inset 0 -1px 0 0
|
|
19
|
+
})(["padding:4px;box-shadow:inset 0 -1px 0 0 var(--ds-color-border-base-default);> div{> div{flex:0 0 auto;background:transparent;box-shadow:none;padding:2px;border-radius:0;}}"]);
|
|
21
20
|
const ToolbarItems = /* @__PURE__ */ styled.div.withConfig({
|
|
22
21
|
displayName: "RichTextstyles__ToolbarItems",
|
|
23
22
|
componentId: "sc-8lgglv-4"
|
|
@@ -29,7 +28,7 @@ const ToolbarEntry = /* @__PURE__ */ styled.span.withConfig({
|
|
|
29
28
|
const EditorArea = /* @__PURE__ */ styled.div.withConfig({
|
|
30
29
|
displayName: "RichTextstyles__EditorArea",
|
|
31
30
|
componentId: "sc-8lgglv-6"
|
|
32
|
-
})([".ProseMirror{padding:12px;outline:none;min-height:", ";height:", ";max-height:", ";overflow-y:auto;font-size:13px;line-height:1.6;color:
|
|
31
|
+
})([".ProseMirror{padding:12px;outline:none;min-height:", ";height:", ";max-height:", ";overflow-y:auto;font-size:13px;line-height:1.6;color:var(--ds-color-text-base-default);", ";> * + *{margin-top:0.5em;}h1{font-size:24px;font-weight:500;line-height:1.3;margin:0 0 0.5em;}h2{font-size:20px;font-weight:500;line-height:1.3;margin:0 0 0.5em;}h3{font-size:16px;font-weight:500;line-height:1.3;margin:0 0 0.5em;}p{margin:0 0 4px;}ul,ol{padding-left:24px;margin:0 0 4px;}li{margin:2px 0;}a{color:var(--ds-color-text-brand-default);text-decoration:underline;cursor:pointer;}code{background:var(--ds-color-background-base-muted);padding:2px 4px;border-radius:3px;font-family:'SFMono-Regular',Consolas,'Liberation Mono',Menlo,monospace;font-size:12px;}pre{background:var(--ds-color-background-base-muted);padding:12px;border-radius:3px;overflow-x:auto;code{background:none;padding:0;border-radius:0;font-size:12px;}}blockquote{border-left:3px solid var(--ds-color-border-base-strong);padding-left:12px;margin:0 0 4px;color:var(--ds-color-text-neutral-default);}.ds-rt-code-snippet{position:relative;display:flex;align-items:center;background:var(--ds-color-background-base-subtle);border-radius:3px;padding:6px 40px 6px 12px;margin:0 0 4px;code{flex:1 1 auto;background:none;padding:0;border-radius:0;white-space:pre;overflow-x:auto;outline:none;}.ds-rt-code-snippet__actions{position:absolute;top:50%;right:4px;transform:translateY(-50%);}}table{border-collapse:collapse;width:100%;margin:0 0 4px;table-layout:fixed;overflow:hidden;td,th{border:1px solid var(--ds-color-border-base-strong);padding:6px 10px;vertical-align:top;text-align:left;position:relative;> *{margin:0;}}th{background:var(--ds-color-background-base-subtle);font-weight:500;}.selectedCell::after{content:'';position:absolute;inset:0;background:var(--ds-color-background-brand-subtle);opacity:0.4;pointer-events:none;}}s{text-decoration:line-through;}img{max-width:100%;height:auto;border-radius:3px;display:block;margin:8px 0;&.ProseMirror-selectednode{outline:2px solid var(--ds-color-focus-base-default);outline-offset:2px;}}}.ProseMirror p.is-editor-empty:first-child::before{color:var(--ds-color-text-base-disabled);content:attr(data-placeholder);float:left;height:0;pointer-events:none;}"], (props) => props.$subtlePreview ? "32px" : "120px", (props) => props.$height ? typeof props.$height === "number" ? `${props.$height}px` : props.$height : "auto", (props) => props.$maxHeight ? typeof props.$maxHeight === "number" ? `${props.$maxHeight}px` : props.$maxHeight : "none", (props) => props.$readOnly && css(["background:var(--ds-color-background-base-subtle);cursor:default;"]));
|
|
33
32
|
const ContentAbove = /* @__PURE__ */ styled.div.withConfig({
|
|
34
33
|
displayName: "RichTextstyles__ContentAbove",
|
|
35
34
|
componentId: "sc-8lgglv-7"
|
|
@@ -41,20 +40,20 @@ const ContentBelow = /* @__PURE__ */ styled.div.withConfig({
|
|
|
41
40
|
const ErrorText = /* @__PURE__ */ styled.div.withConfig({
|
|
42
41
|
displayName: "RichTextstyles__ErrorText",
|
|
43
42
|
componentId: "sc-8lgglv-9"
|
|
44
|
-
})(["color:
|
|
43
|
+
})(["color:var(--ds-color-text-danger-default);font-size:13px;line-height:1.39;"]);
|
|
45
44
|
const Description = /* @__PURE__ */ styled.div.withConfig({
|
|
46
45
|
displayName: "RichTextstyles__Description",
|
|
47
46
|
componentId: "sc-8lgglv-10"
|
|
48
|
-
})(["color:
|
|
47
|
+
})(["color:var(--ds-color-text-neutral-default);font-size:13px;line-height:1.39;"]);
|
|
49
48
|
const AiGradientLabel = /* @__PURE__ */ styled.span.withConfig({
|
|
50
49
|
displayName: "RichTextstyles__AiGradientLabel",
|
|
51
50
|
componentId: "sc-8lgglv-11"
|
|
52
|
-
})(["background:
|
|
51
|
+
})(["background:var(--ds-rich-text-ai-label-text);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;"]);
|
|
53
52
|
const ToolbarSeparator = /* @__PURE__ */ styled.div.withConfig({
|
|
54
53
|
displayName: "RichTextstyles__ToolbarSeparator",
|
|
55
54
|
componentId: "sc-8lgglv-12"
|
|
56
|
-
})(["&&{align-self:center;flex:0 0 auto;width:1px;height:18px;min-height:18px;margin:0 4px;padding:0;border-radius:0;background:
|
|
57
|
-
const popoverSurface = /* @__PURE__ */ css(["background:
|
|
55
|
+
})(["&&{align-self:center;flex:0 0 auto;width:1px;height:18px;min-height:18px;margin:0 4px;padding:0;border-radius:0;background:var(--ds-color-border-base-default);}"]);
|
|
56
|
+
const popoverSurface = /* @__PURE__ */ css(["background:var(--ds-color-background-base-default);border:1px solid var(--ds-color-border-base-default);border-radius:3px;box-shadow:var(--ds-shadows-shadow-1);"]);
|
|
58
57
|
const BlockMenu = /* @__PURE__ */ styled.div.withConfig({
|
|
59
58
|
displayName: "RichTextstyles__BlockMenu",
|
|
60
59
|
componentId: "sc-8lgglv-13"
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useCallback, useLayoutEffect, useEffect } from "react";
|
|
3
3
|
import Button from "@synerise/ds-button";
|
|
4
|
-
import { useTheme } from "@synerise/ds-core";
|
|
5
4
|
import Icon, { BoldM, ItalicM, StrikeM, UnderlineM, ListM, ListNumbersM, LinkM, CodeM, Grid2M, ImageM, OptionHorizontalM, AiStarM, TextM, AlignRightM, AlignCenterM, AlignLeftM, H3M, H2M, H1M, TableL, AddM, DeleteM, TrashM } from "@synerise/ds-icon";
|
|
6
5
|
import Popover, { PopoverTrigger, PopoverContent } from "@synerise/ds-popover";
|
|
7
6
|
import DSToolbar, { ToolbarButton, ToolbarGroup } from "@synerise/ds-toolbar";
|
|
@@ -86,7 +85,6 @@ const Toolbar = ({
|
|
|
86
85
|
onEditWithAI,
|
|
87
86
|
editWithAIOptions
|
|
88
87
|
}) => {
|
|
89
|
-
const theme = useTheme();
|
|
90
88
|
const [showLinkPopover, setShowLinkPopover] = useState(false);
|
|
91
89
|
const [showImagePopover, setShowImagePopover] = useState(false);
|
|
92
90
|
const [showBlockMenu, setShowBlockMenu] = useState(false);
|
|
@@ -413,7 +411,7 @@ const Toolbar = ({
|
|
|
413
411
|
(onEditWithAI || hasAiOptions) && /* @__PURE__ */ jsx(ToolbarGroup, { isCompact: true, style: {
|
|
414
412
|
marginLeft: "auto"
|
|
415
413
|
}, children: (() => {
|
|
416
|
-
const aiButton = /* @__PURE__ */ jsx(Button, { type: "custom-color-ghost", color: "pink", mode: "icon-label", loading: aiLoading, disabled, icon: /* @__PURE__ */ jsx(Icon, { color:
|
|
414
|
+
const aiButton = /* @__PURE__ */ jsx(Button, { type: "custom-color-ghost", color: "pink", mode: "icon-label", loading: aiLoading, disabled, icon: /* @__PURE__ */ jsx(Icon, { color: "var(--ds-rich-text-ai-icon)", component: /* @__PURE__ */ jsx(AiStarM, {}) }), onClick: hasAiOptions ? () => setShowAiMenu((prev) => !prev) : handleEditWithAI, children: /* @__PURE__ */ jsx(AiGradientLabel, { children: texts.editWithAI }) });
|
|
417
415
|
if (!hasAiOptions) {
|
|
418
416
|
return aiButton;
|
|
419
417
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-rich-text",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "RichText UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"./dist/*": "./dist/*.js"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@synerise/ds-button": "^2.1
|
|
42
|
-
"@synerise/ds-copy-icon": "^2.
|
|
43
|
-
"@synerise/ds-form-field": "^2.
|
|
44
|
-
"@synerise/ds-icon": "^2.
|
|
45
|
-
"@synerise/ds-input": "^2.
|
|
46
|
-
"@synerise/ds-popover": "^2.
|
|
47
|
-
"@synerise/ds-toolbar": "^2.
|
|
48
|
-
"@synerise/ds-tooltip": "^2.
|
|
49
|
-
"@synerise/ds-utils": "^2.
|
|
41
|
+
"@synerise/ds-button": "^2.2.1",
|
|
42
|
+
"@synerise/ds-copy-icon": "^2.1.1",
|
|
43
|
+
"@synerise/ds-form-field": "^2.1.1",
|
|
44
|
+
"@synerise/ds-icon": "^2.3.1",
|
|
45
|
+
"@synerise/ds-input": "^2.1.1",
|
|
46
|
+
"@synerise/ds-popover": "^2.3.0",
|
|
47
|
+
"@synerise/ds-toolbar": "^2.1.1",
|
|
48
|
+
"@synerise/ds-tooltip": "^2.1.1",
|
|
49
|
+
"@synerise/ds-utils": "^2.3.1",
|
|
50
50
|
"@tiptap/core": "^2.11.0",
|
|
51
51
|
"@tiptap/extension-image": "^2.11.0",
|
|
52
52
|
"@tiptap/extension-link": "^2.11.0",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"@types/markdown-it": "14.1.2",
|
|
72
72
|
"vitest": "4"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "2d2a540b35fddf8855da45f0dec2f4612c6d87b6"
|
|
75
75
|
}
|