@evergis/react 3.1.92 → 3.1.94
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 +26 -8
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +27 -9
- package/dist/react.esm.js.map +1 -1
- package/package.json +6 -4
package/dist/index.js
CHANGED
|
@@ -23,6 +23,8 @@ require('@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css');
|
|
|
23
23
|
require('mapbox-gl/dist/mapbox-gl.css');
|
|
24
24
|
var react = require('swiper/react');
|
|
25
25
|
var ReactMarkdown = require('react-markdown');
|
|
26
|
+
var rehypeRaw = require('rehype-raw');
|
|
27
|
+
var rehypeSanitize = require('rehype-sanitize');
|
|
26
28
|
var remarkGfm = require('remark-gfm');
|
|
27
29
|
var xterm = require('@xterm/xterm');
|
|
28
30
|
var addonFit = require('@xterm/addon-fit');
|
|
@@ -3935,6 +3937,15 @@ const ServerNotificationsContext = React.createContext({});
|
|
|
3935
3937
|
const useServerNotifications = (url, initialized) => {
|
|
3936
3938
|
const hubConnection = React.useRef(null);
|
|
3937
3939
|
const [connection, setConnection] = React.useState(null);
|
|
3940
|
+
const subscribeNotifications = React.useCallback(() => {
|
|
3941
|
+
if (!connection || connection.state !== "Connected") {
|
|
3942
|
+
return;
|
|
3943
|
+
}
|
|
3944
|
+
connection
|
|
3945
|
+
.invoke("SubscribeNotifications", [])
|
|
3946
|
+
.then(() => console.info("Подписка `SubscribeNotifications` оформлена"))
|
|
3947
|
+
.catch(err => console.info("Ошибка подписки `SubscribeNotifications`:", err));
|
|
3948
|
+
}, [connection]);
|
|
3938
3949
|
React.useEffect(() => {
|
|
3939
3950
|
if (!initialized) {
|
|
3940
3951
|
return;
|
|
@@ -3943,6 +3954,7 @@ const useServerNotifications = (url, initialized) => {
|
|
|
3943
3954
|
.withUrl(`${url}?clientId=${api.generateId()}`, {
|
|
3944
3955
|
withCredentials: true,
|
|
3945
3956
|
})
|
|
3957
|
+
.withAutomaticReconnect({ nextRetryDelayInMilliseconds: () => 3000 })
|
|
3946
3958
|
.configureLogging(signalr.LogLevel.Information)
|
|
3947
3959
|
.build();
|
|
3948
3960
|
hubConnection.current
|
|
@@ -3955,10 +3967,9 @@ const useServerNotifications = (url, initialized) => {
|
|
|
3955
3967
|
if (!connection || connection.state !== "Connected") {
|
|
3956
3968
|
return;
|
|
3957
3969
|
}
|
|
3958
|
-
connection
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
.catch(err => console.info("Ошибка подписки `SubscribeNotifications`:", err));
|
|
3970
|
+
connection.onreconnecting(() => console.info("Переподключение к серверным нотификациям"));
|
|
3971
|
+
connection.onreconnected(subscribeNotifications);
|
|
3972
|
+
subscribeNotifications();
|
|
3962
3973
|
}, [connection]);
|
|
3963
3974
|
return connection;
|
|
3964
3975
|
};
|
|
@@ -8063,6 +8074,13 @@ const MarkdownWrapper = styled.div `
|
|
|
8063
8074
|
}
|
|
8064
8075
|
`;
|
|
8065
8076
|
|
|
8077
|
+
const sanitizeSchema = {
|
|
8078
|
+
...rehypeSanitize.defaultSchema,
|
|
8079
|
+
attributes: {
|
|
8080
|
+
...rehypeSanitize.defaultSchema.attributes,
|
|
8081
|
+
"*": [...(rehypeSanitize.defaultSchema.attributes?.["*"] || []), "style"],
|
|
8082
|
+
},
|
|
8083
|
+
};
|
|
8066
8084
|
const ElementMarkdown = React.memo(({ elementConfig, type }) => {
|
|
8067
8085
|
const { attributes } = useWidgetContext(type);
|
|
8068
8086
|
const { t } = useGlobalContext();
|
|
@@ -8083,16 +8101,16 @@ const ElementMarkdown = React.memo(({ elementConfig, type }) => {
|
|
|
8083
8101
|
const shouldShowExpand = expandLength > 0 && markdownString.length > expandLength;
|
|
8084
8102
|
// If expand is not needed, show full content
|
|
8085
8103
|
if (!shouldShowExpand) {
|
|
8086
|
-
return (jsxRuntime.jsx(MarkdownWrapper, { children: jsxRuntime.jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: markdownString }) }));
|
|
8104
|
+
return (jsxRuntime.jsx(MarkdownWrapper, { children: jsxRuntime.jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw, [rehypeSanitize, sanitizeSchema]], children: markdownString }) }));
|
|
8087
8105
|
}
|
|
8088
8106
|
// Collapsed state
|
|
8089
8107
|
if (!expanded) {
|
|
8090
8108
|
// Truncated content for collapsed state
|
|
8091
8109
|
const truncatedContent = markdownString.substring(0, expandLength);
|
|
8092
|
-
return (jsxRuntime.jsxs(MarkdownWrapper, { children: [jsxRuntime.jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: truncatedContent }), jsxRuntime.jsx(uilibGl.LegendToggler, { onClick: () => setExpanded(true), children: t("more", { ns: "dashboard", defaultValue: "Подробнее" }) })] }));
|
|
8110
|
+
return (jsxRuntime.jsxs(MarkdownWrapper, { children: [jsxRuntime.jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw, [rehypeSanitize, sanitizeSchema]], children: truncatedContent }), jsxRuntime.jsx(uilibGl.LegendToggler, { onClick: () => setExpanded(true), children: t("more", { ns: "dashboard", defaultValue: "Подробнее" }) })] }));
|
|
8093
8111
|
}
|
|
8094
8112
|
// Expanded state
|
|
8095
|
-
return (jsxRuntime.jsxs(MarkdownWrapper, { children: [jsxRuntime.jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: markdownString }), jsxRuntime.jsx(uilibGl.LegendToggler, { toggled: true, onClick: () => setExpanded(false), children: t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) })] }));
|
|
8113
|
+
return (jsxRuntime.jsxs(MarkdownWrapper, { children: [jsxRuntime.jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw, rehypeSanitize], children: markdownString }), jsxRuntime.jsx(uilibGl.LegendToggler, { toggled: true, onClick: () => setExpanded(false), children: t("hide", { ns: "dashboard", defaultValue: "Свернуть" }) })] }));
|
|
8096
8114
|
});
|
|
8097
8115
|
|
|
8098
8116
|
const SmallPreviewContainer = styled.div `
|
|
@@ -8425,7 +8443,7 @@ const ElementUploader = React.memo(({ elementConfig, type }) => {
|
|
|
8425
8443
|
if (index === -1)
|
|
8426
8444
|
return;
|
|
8427
8445
|
const resourceId = files[index].id;
|
|
8428
|
-
await api.file.deleteResource(resourceId);
|
|
8446
|
+
await api.file.deleteResource({ resourceId });
|
|
8429
8447
|
setFiles(currentFiles => currentFiles.filter(({ id }) => id !== resourceId));
|
|
8430
8448
|
}, [files]);
|
|
8431
8449
|
const renderTitle = React.useMemo(() => {
|