@evergis/react 3.1.92 → 3.1.93

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/react.esm.js CHANGED
@@ -21,6 +21,8 @@ import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
21
21
  import 'mapbox-gl/dist/mapbox-gl.css';
22
22
  import { Swiper, SwiperSlide } from 'swiper/react';
23
23
  import ReactMarkdown from 'react-markdown';
24
+ import rehypeRaw from 'rehype-raw';
25
+ import rehypeSanitize, { defaultSchema } from 'rehype-sanitize';
24
26
  import remarkGfm from 'remark-gfm';
25
27
  import { Terminal } from '@xterm/xterm';
26
28
  import { FitAddon } from '@xterm/addon-fit';
@@ -8061,6 +8063,13 @@ const MarkdownWrapper = styled.div `
8061
8063
  }
8062
8064
  `;
8063
8065
 
8066
+ const sanitizeSchema = {
8067
+ ...defaultSchema,
8068
+ attributes: {
8069
+ ...defaultSchema.attributes,
8070
+ "*": [...(defaultSchema.attributes?.["*"] || []), "style"],
8071
+ },
8072
+ };
8064
8073
  const ElementMarkdown = memo(({ elementConfig, type }) => {
8065
8074
  const { attributes } = useWidgetContext(type);
8066
8075
  const { t } = useGlobalContext();
@@ -8081,16 +8090,16 @@ const ElementMarkdown = memo(({ elementConfig, type }) => {
8081
8090
  const shouldShowExpand = expandLength > 0 && markdownString.length > expandLength;
8082
8091
  // If expand is not needed, show full content
8083
8092
  if (!shouldShowExpand) {
8084
- return (jsx(MarkdownWrapper, { children: jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: markdownString }) }));
8093
+ return (jsx(MarkdownWrapper, { children: jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw, [rehypeSanitize, sanitizeSchema]], children: markdownString }) }));
8085
8094
  }
8086
8095
  // Collapsed state
8087
8096
  if (!expanded) {
8088
8097
  // Truncated content for collapsed state
8089
8098
  const truncatedContent = markdownString.substring(0, expandLength);
8090
- return (jsxs(MarkdownWrapper, { children: [jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: truncatedContent }), jsx(LegendToggler, { onClick: () => setExpanded(true), children: t("more", { ns: "dashboard", defaultValue: "Подробнее" }) })] }));
8099
+ return (jsxs(MarkdownWrapper, { children: [jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw, [rehypeSanitize, sanitizeSchema]], children: truncatedContent }), jsx(LegendToggler, { onClick: () => setExpanded(true), children: t("more", { ns: "dashboard", defaultValue: "Подробнее" }) })] }));
8091
8100
  }
8092
8101
  // Expanded state
8093
- return (jsxs(MarkdownWrapper, { children: [jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: markdownString }), jsx(LegendToggler, { toggled: true, onClick: () => setExpanded(false), children: t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) })] }));
8102
+ return (jsxs(MarkdownWrapper, { children: [jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw, rehypeSanitize], children: markdownString }), jsx(LegendToggler, { toggled: true, onClick: () => setExpanded(false), children: t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) })] }));
8094
8103
  });
8095
8104
 
8096
8105
  const SmallPreviewContainer = styled.div `
@@ -8423,7 +8432,7 @@ const ElementUploader = memo(({ elementConfig, type }) => {
8423
8432
  if (index === -1)
8424
8433
  return;
8425
8434
  const resourceId = files[index].id;
8426
- await api.file.deleteResource(resourceId);
8435
+ await api.file.deleteResource({ resourceId });
8427
8436
  setFiles(currentFiles => currentFiles.filter(({ id }) => id !== resourceId));
8428
8437
  }, [files]);
8429
8438
  const renderTitle = useMemo(() => {