@blocklet/discuss-kit-ux 2.3.85 → 2.3.87
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.
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
export declare function hashText(text?: string): string;
|
|
2
2
|
export declare const isInlineTranslationAvailable: boolean;
|
|
3
|
-
export declare function detectLanguage(src: string):
|
|
4
|
-
|
|
5
|
-
nativeName: string;
|
|
6
|
-
iso639_1: string;
|
|
7
|
-
iso639_3: string;
|
|
8
|
-
} | null;
|
|
9
|
-
export declare function detectLanguageIso6391(src: string): string | null;
|
|
3
|
+
export declare function detectLanguage(src: string): null;
|
|
4
|
+
export declare function detectLanguageIso6391(src: string): null;
|
|
@@ -4,7 +4,7 @@ import { OnContentChangePlugin } from "@blocklet/editor/lib/ext/OnContentChangeP
|
|
|
4
4
|
import { CtrlsShortcutPlugin } from "@blocklet/editor/lib/ext/ShortcutPlugin";
|
|
5
5
|
import { SafeAreaPlugin } from "@blocklet/editor/lib/ext/SafeAreaPlugin";
|
|
6
6
|
import { lazyRetry } from "@arcblock/ux/lib/Util";
|
|
7
|
-
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-
|
|
7
|
+
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-Dzkqoajm.mjs";
|
|
8
8
|
const BlockletEditor = lazyRetry(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -59,7 +59,6 @@ import MuiMenu from "@mui/material/Menu";
|
|
|
59
59
|
import { InlineTranslationPlugin, useInlineTranslationStore } from "@blocklet/editor/lib/ext/InlineTranslationPlugin";
|
|
60
60
|
import { createContainer } from "unstated-next";
|
|
61
61
|
import murmurhash from "murmurhash";
|
|
62
|
-
import { franc } from "franc-min";
|
|
63
62
|
import { createAxios } from "@blocklet/js-sdk";
|
|
64
63
|
import { EditorHolderProvider } from "@blocklet/editor/lib/ext/EditorHolderPlugin";
|
|
65
64
|
import red from "@mui/material/colors/red";
|
|
@@ -1787,77 +1786,12 @@ const useLocaleContext = () => {
|
|
|
1787
1786
|
const AIGNE_RUNTIME_DID = "z2qaBP9SahqU2L2YA3ip7NecwKACMByTFuiJ2";
|
|
1788
1787
|
const AIGNE_STUDIO_DID = "z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB";
|
|
1789
1788
|
const DISCUSS_KIT_DID = "z8ia1WEiBZ7hxURf6LwH21Wpg99vophFwSJdu";
|
|
1790
|
-
const SUPPORTED_LANGUAGES = [
|
|
1791
|
-
{
|
|
1792
|
-
name: "English",
|
|
1793
|
-
nativeName: "English",
|
|
1794
|
-
iso639_1: "en",
|
|
1795
|
-
iso639_3: "eng"
|
|
1796
|
-
},
|
|
1797
|
-
{
|
|
1798
|
-
name: "Simplified Chinese",
|
|
1799
|
-
nativeName: "简体中文",
|
|
1800
|
-
iso639_1: "zh",
|
|
1801
|
-
iso639_3: "cmn"
|
|
1802
|
-
},
|
|
1803
|
-
{
|
|
1804
|
-
name: "Spanish",
|
|
1805
|
-
nativeName: "Español",
|
|
1806
|
-
iso639_1: "es",
|
|
1807
|
-
iso639_3: "spa"
|
|
1808
|
-
},
|
|
1809
|
-
{
|
|
1810
|
-
name: "Portuguese",
|
|
1811
|
-
nativeName: "Português",
|
|
1812
|
-
iso639_1: "pt",
|
|
1813
|
-
iso639_3: "por"
|
|
1814
|
-
},
|
|
1815
|
-
{
|
|
1816
|
-
name: "Russian",
|
|
1817
|
-
nativeName: "Русский",
|
|
1818
|
-
iso639_1: "ru",
|
|
1819
|
-
iso639_3: "rus"
|
|
1820
|
-
},
|
|
1821
|
-
{
|
|
1822
|
-
name: "Japanese",
|
|
1823
|
-
nativeName: "日本語",
|
|
1824
|
-
iso639_1: "ja",
|
|
1825
|
-
iso639_3: "jpn"
|
|
1826
|
-
},
|
|
1827
|
-
{
|
|
1828
|
-
name: "French",
|
|
1829
|
-
nativeName: "Français",
|
|
1830
|
-
iso639_1: "fr",
|
|
1831
|
-
iso639_3: "fra"
|
|
1832
|
-
},
|
|
1833
|
-
{
|
|
1834
|
-
name: "German",
|
|
1835
|
-
nativeName: "Deutsch",
|
|
1836
|
-
iso639_1: "de",
|
|
1837
|
-
iso639_3: "deu"
|
|
1838
|
-
},
|
|
1839
|
-
{
|
|
1840
|
-
name: "Korean",
|
|
1841
|
-
nativeName: "한국어",
|
|
1842
|
-
iso639_1: "ko",
|
|
1843
|
-
iso639_3: "kor"
|
|
1844
|
-
}
|
|
1845
|
-
];
|
|
1846
|
-
const languagesByIso6393 = new Map(SUPPORTED_LANGUAGES.map((lang) => [lang.iso639_3, lang]));
|
|
1847
|
-
function getLanguageByIso6393(iso639_3) {
|
|
1848
|
-
return languagesByIso6393.get(iso639_3);
|
|
1849
|
-
}
|
|
1850
1789
|
function hashText(text = "") {
|
|
1851
1790
|
return murmurhash.v3(text).toString(16);
|
|
1852
1791
|
}
|
|
1853
1792
|
const isInlineTranslationAvailable = blockletExists([AIGNE_RUNTIME_DID, AIGNE_STUDIO_DID, DISCUSS_KIT_DID]) && !!window.blocklet.preferences.inlineTranslatorAgentAid;
|
|
1854
|
-
function detectLanguage(src) {
|
|
1855
|
-
const lang = franc(src, { only: SUPPORTED_LANGUAGES.map((x) => x.iso639_3), minLength: 2 });
|
|
1856
|
-
return getLanguageByIso6393(lang) || null;
|
|
1857
|
-
}
|
|
1858
1793
|
function detectLanguageIso6391(src) {
|
|
1859
|
-
|
|
1860
|
-
return ((_a2 = detectLanguage(src)) == null ? void 0 : _a2.iso639_1) || null;
|
|
1794
|
+
return null;
|
|
1861
1795
|
}
|
|
1862
1796
|
const api = createAxios({
|
|
1863
1797
|
baseURL: discussKitApiBaseUrl,
|
|
@@ -5158,7 +5092,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, icon, ...rest }) {
|
|
|
5158
5092
|
}
|
|
5159
5093
|
const tablerSend = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 14L21 3m0 0l-6.5 18a.55.55 0 0 1-1 0L10 14l-7-3.5a.55.55 0 0 1 0-1z" }) });
|
|
5160
5094
|
const tablerLetterCase = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M14 15.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0-7 0M3 19V8.5a3.5 3.5 0 0 1 7 0V19m-7-6h7m11-1v7" }) });
|
|
5161
|
-
const Editor = lazyRetry(() => import("./editor-
|
|
5095
|
+
const Editor = lazyRetry(() => import("./editor-B6CJ7JCh.mjs"));
|
|
5162
5096
|
function LazyEditor(props) {
|
|
5163
5097
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
5164
5098
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -12805,7 +12739,7 @@ const useTranslate = ({ text, enabled }) => {
|
|
|
12805
12739
|
if (!text || !enabled) {
|
|
12806
12740
|
return "";
|
|
12807
12741
|
}
|
|
12808
|
-
if (detectLanguageIso6391(
|
|
12742
|
+
if (detectLanguageIso6391() === targetLanguage) {
|
|
12809
12743
|
return text;
|
|
12810
12744
|
}
|
|
12811
12745
|
try {
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
|
-
import { W, o, Y, aQ, A, n, af, B, G, N, L, O, ar, _, Z, a1, $, a0, a3, x, C, y, z, F, a7, a8, aj, aa, T, U, ae, D, ai, ah, K, H, J, aG, aH, b, m, ag, M, P, aC, aq, w, aR, aS, v, aE, aF, R, S, ab, as, aD, q, aP, a4, a6, ak, an, am, aM, aI, aA, at, Q, ao, aK, au, aJ, ax, ay, aN, aL, l, az, h, p, r, k, aw, t, j, ac, aB, X, aT, c, a2, E, a9, ad, aV, e, u, ap, d, av, aU, aO, a5, al, f } from "./index-
|
|
2
|
+
import { W, o, Y, aQ, A, n, af, B, G, N, L, O, ar, _, Z, a1, $, a0, a3, x, C, y, z, F, a7, a8, aj, aa, T, U, ae, D, ai, ah, K, H, J, aG, aH, b, m, ag, M, P, aC, aq, w, aR, aS, v, aE, aF, R, S, ab, as, aD, q, aP, a4, a6, ak, an, am, aM, aI, aA, at, Q, ao, aK, au, aJ, ax, ay, aN, aL, l, az, h, p, r, k, aw, t, j, ac, aB, X, aT, c, a2, E, a9, ad, aV, e, u, ap, d, av, aU, aO, a5, al, f } from "./index-Dzkqoajm.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@arcblock/ux/lib/Locale/context"), require("@mui/icons-material"), require("@mui/lab/LoadingButton"), require("@mui/material/Alert"), require("@mui/material/Box"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("react-router-dom"), require("@arcblock/ux/lib/UserCard"), require("@arcblock/ux/lib/UserCard/types"), require("@arcblock/react-hooks"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("@mui/material/Tooltip"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("semver-compare"), require("@arcblock/bridge"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@arcblock/ux/lib/Util"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@blocklet/editor/lib/ext/InlineTranslationPlugin"), require("unstated-next"), require("murmurhash"), require("
|
|
3
|
-
})(this, function(exports2, labels, jsxRuntime, styles, Theme, react, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, context, iconsMaterial, LoadingButton, Alert, Box, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, reactRouterDom, UserCard, types, reactHooks, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, Tooltip, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, cmp, bridge, NotificationsActiveOutlinedIcon, Util, CheckboxPlugin, MuiMenuItem, clsx, IconButton$2, MuiMenu, InlineTranslationPlugin, unstatedNext, murmurhash,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@arcblock/ux/lib/Locale/context"), require("@mui/icons-material"), require("@mui/lab/LoadingButton"), require("@mui/material/Alert"), require("@mui/material/Box"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("react-router-dom"), require("@arcblock/ux/lib/UserCard"), require("@arcblock/ux/lib/UserCard/types"), require("@arcblock/react-hooks"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("@mui/material/Tooltip"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("semver-compare"), require("@arcblock/bridge"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@arcblock/ux/lib/Util"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@blocklet/editor/lib/ext/InlineTranslationPlugin"), require("unstated-next"), require("murmurhash"), require("@blocklet/js-sdk"), require("@blocklet/editor/lib/ext/EditorHolderPlugin"), require("@mui/material/colors/red"), require("@arcblock/ux/lib/Dialog"), require("axios"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("react-dom"), require("ufo"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("url-join"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/colors/grey"), require("@blocklet/editor"), require("@mui/material/Fab"), require("lodash/debounce"), require("@blocklet/editor/lib/main/hooks/useIsFocused"), require("@blocklet/editor/lib/ext/BusyPlugin"), require("@arcblock/ux/lib/Header/addon-button"), require("react-hot-toast"), require("@mui/material/Pagination"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), require("zustand"), require("zustand/middleware"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "@arcblock/ux/lib/Theme", "react", "@mui/material", "lodash/isNil", "@blocklet/editor/lib/config", "react-lazy-with-preload", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@arcblock/ux/lib/Locale/context", "@mui/icons-material", "@mui/lab/LoadingButton", "@mui/material/Alert", "@mui/material/Box", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/AvatarGroup", "@mui/material/colors", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "react-router-dom", "@arcblock/ux/lib/UserCard", "@arcblock/ux/lib/UserCard/types", "@arcblock/react-hooks", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "@mui/material/Tooltip", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "@arcblock/ux/lib/Empty", "@arcblock/did-connect/lib/Session", "semver-compare", "@arcblock/bridge", "@mui/icons-material/NotificationsActiveOutlined", "@arcblock/ux/lib/Util", "@blocklet/editor/lib/ext/CheckboxPlugin", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@blocklet/editor/lib/ext/InlineTranslationPlugin", "unstated-next", "murmurhash", "@blocklet/js-sdk", "@blocklet/editor/lib/ext/EditorHolderPlugin", "@mui/material/colors/red", "@arcblock/ux/lib/Dialog", "axios", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "react-dom", "ufo", "dayjs", "dayjs/plugin/relativeTime", "url-join", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/colors/grey", "@blocklet/editor", "@mui/material/Fab", "lodash/debounce", "@blocklet/editor/lib/main/hooks/useIsFocused", "@blocklet/editor/lib/ext/BusyPlugin", "@arcblock/ux/lib/Header/addon-button", "react-hot-toast", "@mui/material/Pagination", "js-cookie", "@arcblock/ws", "@emotion/css", "zustand", "zustand/middleware", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.Theme, global.react, global.material, global.isNil, global.config, global.reactLazyWithPreload, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.context, global.iconsMaterial, global.LoadingButton, global.Alert, global.Box, global.isBoolean, global.Button, global.DidAvatar, global.AvatarGroup, global.colors, global.useMediaQuery, global.DID, global.reactRouterDom, global.UserCard, global.types, global.reactHooks, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.Tooltip, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.Empty$3, global.Session, global.cmp, global.bridge, global.NotificationsActiveOutlinedIcon, global.Util, global.CheckboxPlugin, global.MuiMenuItem, global.clsx, global.IconButton$2, global.MuiMenu, global.InlineTranslationPlugin, global.unstatedNext, global.murmurhash, global.jsSdk, global.EditorHolderPlugin, global.red, global.Dialog, global.axios, global.orderBy, global.Typography, global.Skeleton, global.ReactDOM, global.ufo, global.dayjs, global.relativeTime, global.joinUrl, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, global.grey, global.editor$1, global.Fab, global.debounce, global.useIsFocused, global.BusyPlugin, global.addonButton, global.hotToast, global.MuiPagination, global.Cookie, global.ws, global.css, global.zustand, global.middleware, global.OnContentChangePlugin, global.ShortcutPlugin$1, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
|
|
3
|
+
})(this, function(exports2, labels, jsxRuntime, styles, Theme, react, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, context, iconsMaterial, LoadingButton, Alert, Box, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, reactRouterDom, UserCard, types, reactHooks, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, Tooltip, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, cmp, bridge, NotificationsActiveOutlinedIcon, Util, CheckboxPlugin, MuiMenuItem, clsx, IconButton$2, MuiMenu, InlineTranslationPlugin, unstatedNext, murmurhash, jsSdk, EditorHolderPlugin, red, Dialog, axios, orderBy, Typography, Skeleton, ReactDOM, ufo, dayjs, relativeTime, joinUrl, mitt, CircularProgress, reactHelmet, reactFlipToolkit, grey, editor$1, Fab, debounce, useIsFocused, BusyPlugin, addonButton, hotToast, MuiPagination, Cookie, ws, css, zustand, middleware, OnContentChangePlugin, ShortcutPlugin$1, SafeAreaPlugin, text, ImageNode, VideoNode) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
@@ -1703,77 +1703,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1703
1703
|
const AIGNE_RUNTIME_DID = "z2qaBP9SahqU2L2YA3ip7NecwKACMByTFuiJ2";
|
|
1704
1704
|
const AIGNE_STUDIO_DID = "z8iZpog7mcgcgBZzTiXJCWESvmnRrQmnd3XBB";
|
|
1705
1705
|
const DISCUSS_KIT_DID = "z8ia1WEiBZ7hxURf6LwH21Wpg99vophFwSJdu";
|
|
1706
|
-
const SUPPORTED_LANGUAGES = [
|
|
1707
|
-
{
|
|
1708
|
-
name: "English",
|
|
1709
|
-
nativeName: "English",
|
|
1710
|
-
iso639_1: "en",
|
|
1711
|
-
iso639_3: "eng"
|
|
1712
|
-
},
|
|
1713
|
-
{
|
|
1714
|
-
name: "Simplified Chinese",
|
|
1715
|
-
nativeName: "简体中文",
|
|
1716
|
-
iso639_1: "zh",
|
|
1717
|
-
iso639_3: "cmn"
|
|
1718
|
-
},
|
|
1719
|
-
{
|
|
1720
|
-
name: "Spanish",
|
|
1721
|
-
nativeName: "Español",
|
|
1722
|
-
iso639_1: "es",
|
|
1723
|
-
iso639_3: "spa"
|
|
1724
|
-
},
|
|
1725
|
-
{
|
|
1726
|
-
name: "Portuguese",
|
|
1727
|
-
nativeName: "Português",
|
|
1728
|
-
iso639_1: "pt",
|
|
1729
|
-
iso639_3: "por"
|
|
1730
|
-
},
|
|
1731
|
-
{
|
|
1732
|
-
name: "Russian",
|
|
1733
|
-
nativeName: "Русский",
|
|
1734
|
-
iso639_1: "ru",
|
|
1735
|
-
iso639_3: "rus"
|
|
1736
|
-
},
|
|
1737
|
-
{
|
|
1738
|
-
name: "Japanese",
|
|
1739
|
-
nativeName: "日本語",
|
|
1740
|
-
iso639_1: "ja",
|
|
1741
|
-
iso639_3: "jpn"
|
|
1742
|
-
},
|
|
1743
|
-
{
|
|
1744
|
-
name: "French",
|
|
1745
|
-
nativeName: "Français",
|
|
1746
|
-
iso639_1: "fr",
|
|
1747
|
-
iso639_3: "fra"
|
|
1748
|
-
},
|
|
1749
|
-
{
|
|
1750
|
-
name: "German",
|
|
1751
|
-
nativeName: "Deutsch",
|
|
1752
|
-
iso639_1: "de",
|
|
1753
|
-
iso639_3: "deu"
|
|
1754
|
-
},
|
|
1755
|
-
{
|
|
1756
|
-
name: "Korean",
|
|
1757
|
-
nativeName: "한국어",
|
|
1758
|
-
iso639_1: "ko",
|
|
1759
|
-
iso639_3: "kor"
|
|
1760
|
-
}
|
|
1761
|
-
];
|
|
1762
|
-
const languagesByIso6393 = new Map(SUPPORTED_LANGUAGES.map((lang) => [lang.iso639_3, lang]));
|
|
1763
|
-
function getLanguageByIso6393(iso639_3) {
|
|
1764
|
-
return languagesByIso6393.get(iso639_3);
|
|
1765
|
-
}
|
|
1766
1706
|
function hashText(text2 = "") {
|
|
1767
1707
|
return murmurhash.v3(text2).toString(16);
|
|
1768
1708
|
}
|
|
1769
1709
|
const isInlineTranslationAvailable = blockletExists([AIGNE_RUNTIME_DID, AIGNE_STUDIO_DID, DISCUSS_KIT_DID]) && !!window.blocklet.preferences.inlineTranslatorAgentAid;
|
|
1770
|
-
function detectLanguage(src) {
|
|
1771
|
-
const lang = francMin.franc(src, { only: SUPPORTED_LANGUAGES.map((x) => x.iso639_3), minLength: 2 });
|
|
1772
|
-
return getLanguageByIso6393(lang) || null;
|
|
1773
|
-
}
|
|
1774
1710
|
function detectLanguageIso6391(src) {
|
|
1775
|
-
|
|
1776
|
-
return ((_a2 = detectLanguage(src)) == null ? void 0 : _a2.iso639_1) || null;
|
|
1711
|
+
return null;
|
|
1777
1712
|
}
|
|
1778
1713
|
const api = jsSdk.createAxios({
|
|
1779
1714
|
baseURL: discussKitApiBaseUrl,
|
|
@@ -12721,7 +12656,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
12721
12656
|
if (!text2 || !enabled) {
|
|
12722
12657
|
return "";
|
|
12723
12658
|
}
|
|
12724
|
-
if (detectLanguageIso6391(
|
|
12659
|
+
if (detectLanguageIso6391() === targetLanguage) {
|
|
12725
12660
|
return text2;
|
|
12726
12661
|
}
|
|
12727
12662
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.87",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"unstated-next": "^1.1.0",
|
|
49
49
|
"url-join": "^4.0.1",
|
|
50
50
|
"zustand": "^4.5.5",
|
|
51
|
-
"@blocklet/editor": "^2.3.
|
|
52
|
-
"@blocklet/labels": "^2.3.
|
|
51
|
+
"@blocklet/editor": "^2.3.87",
|
|
52
|
+
"@blocklet/labels": "^2.3.87"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@arcblock/did-connect": "^2.10.36",
|