@wix/ricos-editor-elements 11.21.3 → 11.23.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/dist/lib/Viewer.js +72 -68
- package/package.json +7 -9
package/dist/lib/Viewer.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { truncateContent, RicosViewer, pluginEmojiViewer, pluginHashtagViewer, pluginLinkViewer, pluginMentionsViewer, pluginTextColorViewer, pluginTextHighlightViewer, pluginSpoilerViewer } from "@wix/ricos";
|
|
2
3
|
import { pluginCollapsibleListLazy, pluginDividerLazy, pluginGiphyLazy, pluginImageLazy, pluginGalleryLazy, pluginVideoLazy, pluginAudioLazy, pluginFileUploadLazy, pluginTableLazy, pluginHtmlLazy, pluginLinkPreviewLazy, pluginVerticalEmbedLazy, pluginPollLazy, pluginLinkButtonLazy, pluginTocLazy } from "@wix/ricos/lazy";
|
|
3
4
|
import { useService } from "@wix/services-manager-react";
|
|
@@ -26,7 +27,7 @@ import "@wix/ricos/css/plugin-table-viewer.global.css";
|
|
|
26
27
|
import "@wix/ricos/css/plugin-video-viewer.global.css";
|
|
27
28
|
import "@wix/ricos/css/plugin-audio-viewer.global.css";
|
|
28
29
|
import "@wix/ricos/css/plugin-toc-viewer.global.css";
|
|
29
|
-
import
|
|
30
|
+
import { useState } from "react";
|
|
30
31
|
import { CSS_PROPERTIES, DISPLAY_GROUPS, ELEMENTS, DATA, ACTIONS, LAYOUT } from "@wix/react-component-schema";
|
|
31
32
|
import './Viewer.css';const customPropKey = (tag, cssVar) => `editor-ricos-${tag}-${cssVar}`;
|
|
32
33
|
const elementClassName = (tag) => `editor-ricos-${tag}`;
|
|
@@ -179,20 +180,23 @@ const ContentTrimmer = ({
|
|
|
179
180
|
}) => {
|
|
180
181
|
const [collapsed, setCollapsed] = useState(true);
|
|
181
182
|
if (!trimEnabled) {
|
|
182
|
-
return /* @__PURE__ */
|
|
183
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children(content) });
|
|
183
184
|
}
|
|
184
185
|
const { content: truncated, isTruncated } = trimMode === "word" ? trimByWords(content, trimLengthWord) : trimByBlocks(content, trimLengthParagraph, trimExclude === "plugins");
|
|
185
186
|
const shownContent = isTruncated && collapsed ? trimTrailingEmptyParagraph(truncated) : content;
|
|
186
|
-
return /* @__PURE__ */
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
187
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
188
|
+
children(shownContent),
|
|
189
|
+
isTruncated && trimEllipsisEnabled ? /* @__PURE__ */ jsx(
|
|
190
|
+
"button",
|
|
191
|
+
{
|
|
192
|
+
type: "button",
|
|
193
|
+
style: { ...defaultEllipsisStyle, ...ellipsisStyle },
|
|
194
|
+
onClick: () => setCollapsed((isCollapsed) => !isCollapsed),
|
|
195
|
+
"data-hook": "trim-ellipsis-button",
|
|
196
|
+
children: collapsed ? trimEllipsisExpandText : trimEllipsisCollapseText
|
|
197
|
+
}
|
|
198
|
+
) : null
|
|
199
|
+
] });
|
|
196
200
|
};
|
|
197
201
|
const DEFAULT_CONTENT_TEXT = "No content provided";
|
|
198
202
|
const DEFAULT_CONTENT_NODE_ID = "ricos-viewer-default-content";
|
|
@@ -583,7 +587,7 @@ const ViewerContent = ({
|
|
|
583
587
|
const { language } = useService(LocaleDefinition);
|
|
584
588
|
const { siteId: metaSiteId } = useService(SiteInfoDefinition);
|
|
585
589
|
const { siteUrl } = useService(UrlDefinition);
|
|
586
|
-
return /* @__PURE__ */
|
|
590
|
+
return /* @__PURE__ */ jsx("div", { className: `${s.root} ${className}`, id, children: /* @__PURE__ */ jsx("div", { className: elementClassNames, children: /* @__PURE__ */ jsx(
|
|
587
591
|
ContentTrimmer,
|
|
588
592
|
{
|
|
589
593
|
content,
|
|
@@ -594,63 +598,63 @@ const ViewerContent = ({
|
|
|
594
598
|
trimExclude,
|
|
595
599
|
trimEllipsisEnabled,
|
|
596
600
|
trimEllipsisExpandText,
|
|
597
|
-
trimEllipsisCollapseText
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
)));
|
|
601
|
+
trimEllipsisCollapseText,
|
|
602
|
+
children: (trimmedContent) => /* @__PURE__ */ jsx(
|
|
603
|
+
RicosViewer,
|
|
604
|
+
{
|
|
605
|
+
firstFoldNodeCount: 8,
|
|
606
|
+
responsiveBehavior: "viewport",
|
|
607
|
+
isMobile: deviceType === "Smartphone",
|
|
608
|
+
locale: language,
|
|
609
|
+
biSettings: {
|
|
610
|
+
consumer: editorName,
|
|
611
|
+
platform: "Livesite",
|
|
612
|
+
postId: "",
|
|
613
|
+
containerId: ""
|
|
614
|
+
},
|
|
615
|
+
msid: metaSiteId,
|
|
616
|
+
baseUrl: siteUrl,
|
|
617
|
+
content: trimmedContent,
|
|
618
|
+
theme: {
|
|
619
|
+
colorPalette: viewerColorPalette,
|
|
620
|
+
customStyles: {
|
|
621
|
+
...viewerCustomStyles,
|
|
622
|
+
button: { ...viewerButtonStyle, buttonSize },
|
|
623
|
+
image: viewerImageStyle
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
plugins: [
|
|
627
|
+
pluginCollapsibleListLazy(),
|
|
628
|
+
pluginDividerLazy(),
|
|
629
|
+
pluginEmojiViewer(),
|
|
630
|
+
pluginGiphyLazy(),
|
|
631
|
+
pluginHashtagViewer(),
|
|
632
|
+
pluginImageLazy(),
|
|
633
|
+
pluginGalleryLazy(),
|
|
634
|
+
pluginVideoLazy(),
|
|
635
|
+
pluginAudioLazy(),
|
|
636
|
+
pluginFileUploadLazy({ resolveFileUrl }),
|
|
637
|
+
pluginLinkViewer(),
|
|
638
|
+
pluginMentionsViewer(),
|
|
639
|
+
pluginTableLazy(),
|
|
640
|
+
pluginTextColorViewer(),
|
|
641
|
+
pluginTextHighlightViewer(),
|
|
642
|
+
pluginHtmlLazy(),
|
|
643
|
+
pluginLinkPreviewLazy(),
|
|
644
|
+
pluginVerticalEmbedLazy(),
|
|
645
|
+
pluginSpoilerViewer(),
|
|
646
|
+
pluginPollLazy(),
|
|
647
|
+
pluginLinkButtonLazy(),
|
|
648
|
+
pluginTocLazy()
|
|
649
|
+
]
|
|
650
|
+
}
|
|
651
|
+
)
|
|
652
|
+
}
|
|
653
|
+
) }) });
|
|
650
654
|
};
|
|
651
|
-
const Viewer = ({ content, ...props }) => isContentProvided(content) ? /* @__PURE__ */
|
|
655
|
+
const Viewer = ({ content, ...props }) => isContentProvided(content) ? /* @__PURE__ */ jsx(ViewerContent, { ...props, content }) : (
|
|
652
656
|
// Keep the root so the platform still finds the component node.
|
|
653
|
-
/* @__PURE__ */
|
|
657
|
+
/* @__PURE__ */ jsx("div", { className: `${s.root} ${props.className}`, id: props.id })
|
|
654
658
|
);
|
|
655
659
|
export {
|
|
656
660
|
ViewerContent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/ricos-editor-elements",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.23.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/lib/**"
|
|
6
6
|
],
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"generate-translation-keys": "babel-cli"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@wix/
|
|
39
|
+
"@wix/custom-extensions": "^0.2.28",
|
|
40
40
|
"@wix/dashboard": "^1.3.48",
|
|
41
41
|
"@wix/design-system": "^1.338.0",
|
|
42
42
|
"@wix/editor": "^1.956.0",
|
|
43
43
|
"@wix/essentials": "^1.0.15",
|
|
44
44
|
"@wix/fed-cli-i18next": "^1.7.0",
|
|
45
45
|
"@wix/react-component-schema": "^1.10.0",
|
|
46
|
-
"@wix/ricos": "11.
|
|
46
|
+
"@wix/ricos": "11.23.0",
|
|
47
47
|
"@wix/services-manager": "^1.0.7",
|
|
48
48
|
"@wix/services-manager-react": "^1.0.8",
|
|
49
49
|
"@wix/site-service-device-info": "^1.0.8",
|
|
@@ -52,12 +52,9 @@
|
|
|
52
52
|
"@wix/site-service-site-info": "^1.0.8",
|
|
53
53
|
"@wix/site-service-url": "^1.0.9",
|
|
54
54
|
"@wix/wix-ui-icons-common": "^3.190.8",
|
|
55
|
-
"astro": "^5.18.1",
|
|
56
55
|
"lodash": "^4.17.15"
|
|
57
56
|
},
|
|
58
57
|
"devDependencies": {
|
|
59
|
-
"@astrojs/cloudflare": "^12.6.13",
|
|
60
|
-
"@astrojs/react": "^4.4.2",
|
|
61
58
|
"@playwright/test": "~1.51.0",
|
|
62
59
|
"@storybook/react-vite": "^10.4.1",
|
|
63
60
|
"@testing-library/dom": "^10.4.1",
|
|
@@ -68,6 +65,7 @@
|
|
|
68
65
|
"@wix/babel-cli": "^1.20.0",
|
|
69
66
|
"@wix/cli": "^1.1.263",
|
|
70
67
|
"@wix/fed-cli-oxlint": "^1.0.6",
|
|
68
|
+
"@wix/fed-cli-plugin": "^1.0.1",
|
|
71
69
|
"@wix/fed-cli-sled": "^1.0.39",
|
|
72
70
|
"@wix/fed-cli-vitest": "^1.0.17",
|
|
73
71
|
"@wix/sdk-types": "^1.17.12",
|
|
@@ -79,10 +77,10 @@
|
|
|
79
77
|
"regenerator-runtime": "^0.14.0",
|
|
80
78
|
"storybook": "^10.4.1",
|
|
81
79
|
"typescript": "5.8.3",
|
|
82
|
-
"vite": "^6.4.
|
|
80
|
+
"vite": "^6.4.4",
|
|
83
81
|
"vite-plugin-dts": "^4.5.0",
|
|
84
82
|
"vite-plugin-lib-inject-css": "^2.2.0",
|
|
85
|
-
"vitest": "^4.
|
|
83
|
+
"vitest": "^4.1.12"
|
|
86
84
|
},
|
|
87
85
|
"peerDependencies": {
|
|
88
86
|
"react": "^18.2.0",
|
|
@@ -107,5 +105,5 @@
|
|
|
107
105
|
]
|
|
108
106
|
}
|
|
109
107
|
},
|
|
110
|
-
"falconPackageHash": "
|
|
108
|
+
"falconPackageHash": "9c283dc9ac94d141b3206be81f4612765d11c3d58e012f3cd8848c06"
|
|
111
109
|
}
|