@treely/strapi-slices 8.0.0 → 8.0.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/dist/index.js
CHANGED
|
@@ -6054,13 +6054,11 @@ import {
|
|
|
6054
6054
|
Box as Box30
|
|
6055
6055
|
} from "boemly";
|
|
6056
6056
|
import { CheckIcon, LinkIcon } from "@phosphor-icons/react";
|
|
6057
|
-
import { useCopyToClipboard } from "@reactuses/core";
|
|
6058
6057
|
import { jsx as jsx38, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6059
6058
|
var Glossary = ({ slice }) => {
|
|
6060
6059
|
const { formatMessage } = useContext13(IntlContext);
|
|
6061
6060
|
const grouped = {};
|
|
6062
6061
|
const [copiedItem, setCopiedItem] = useState7();
|
|
6063
|
-
const [, copyToClipboard] = useCopyToClipboard();
|
|
6064
6062
|
slice.glossary_items.sort((a, b) => a.attributes.title.localeCompare(b.attributes.title)).forEach((curr) => {
|
|
6065
6063
|
const index = curr.attributes.title.at(0)?.toUpperCase() || "A";
|
|
6066
6064
|
if (!grouped[index]) {
|
|
@@ -6069,9 +6067,9 @@ var Glossary = ({ slice }) => {
|
|
|
6069
6067
|
grouped[index].push(curr.attributes);
|
|
6070
6068
|
}, {});
|
|
6071
6069
|
const handleAnchorClick = async (slug) => {
|
|
6072
|
-
if (typeof window !== "undefined" && window.location) {
|
|
6070
|
+
if (typeof window !== "undefined" && window.location && navigator.clipboard) {
|
|
6073
6071
|
const currentUrl = window.location.href.split("#")[0];
|
|
6074
|
-
|
|
6072
|
+
await navigator.clipboard.writeText(`${currentUrl}#${slug}`);
|
|
6075
6073
|
setCopiedItem(slug);
|
|
6076
6074
|
setTimeout(() => {
|
|
6077
6075
|
setCopiedItem(void 0);
|