@blocklet/discuss-kit-ux 2.3.83 → 2.3.85
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/blocklets.d.ts +1 -0
- package/dist/components/auto-translate/api.d.ts +14 -0
- package/dist/components/auto-translate/auto-translate-button.d.ts +4 -0
- package/dist/components/auto-translate/editor-store-adaptor.d.ts +1 -0
- package/dist/components/auto-translate/index.d.ts +6 -0
- package/dist/components/auto-translate/languages.d.ts +13 -0
- package/dist/components/auto-translate/post-auto-translate-plugin.d.ts +13 -0
- package/dist/components/auto-translate/store.d.ts +21 -0
- package/dist/components/auto-translate/translate.d.ts +16 -0
- package/dist/components/auto-translate/utils.d.ts +9 -0
- package/dist/components/auto-translate/with-availibility-check.d.ts +2 -0
- package/dist/components/hooks/locale-context.d.ts +10 -0
- package/dist/components/hooks/session.d.ts +1 -0
- package/dist/components/posts/comment-list/context.d.ts +3 -1
- package/dist/components/posts/comment.d.ts +2 -1
- package/dist/components/posts/post.d.ts +2 -1
- package/dist/constants.d.ts +3 -0
- package/dist/{editor-gidK4SQd.mjs → editor-CdK8tIVK.mjs} +1 -1
- package/dist/{index-h097ecr7.mjs → index-CIb6-P8d.mjs} +403 -60
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +11 -1
- package/dist/index.umd.js +369 -32
- package/package.json +9 -6
package/dist/blocklets.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const api: import('axios').AxiosInstance;
|
|
2
|
+
interface TranslateItem {
|
|
3
|
+
sid: string;
|
|
4
|
+
text: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const translatePost: ({ id, sourceItems, targetLanguage, targetLanguageName, contentVersion, useCache, }: {
|
|
7
|
+
id: string;
|
|
8
|
+
sourceItems: TranslateItem[];
|
|
9
|
+
targetLanguage: string;
|
|
10
|
+
targetLanguageName?: string | undefined;
|
|
11
|
+
contentVersion: string;
|
|
12
|
+
useCache?: boolean | undefined;
|
|
13
|
+
}) => Promise<any>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useEditorStoreAdapter: () => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare const SUPPORTED_LANGUAGES: {
|
|
2
|
+
name: string;
|
|
3
|
+
nativeName: string;
|
|
4
|
+
iso639_1: string;
|
|
5
|
+
iso639_3: string;
|
|
6
|
+
}[];
|
|
7
|
+
export declare function getLanguageByIso6393(iso639_3: string): {
|
|
8
|
+
name: string;
|
|
9
|
+
nativeName: string;
|
|
10
|
+
iso639_1: string;
|
|
11
|
+
iso639_3: string;
|
|
12
|
+
} | undefined;
|
|
13
|
+
export { SUPPORTED_LANGUAGES };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
postId: string;
|
|
3
|
+
updatedAt: Date | string;
|
|
4
|
+
}
|
|
5
|
+
export declare function PostAutoTranslatePlugin({ postId, updatedAt }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
interface InitialState {
|
|
7
|
+
postId: string;
|
|
8
|
+
updatedAt: Date | string;
|
|
9
|
+
}
|
|
10
|
+
export declare const PostAutoTranslationContainer: import('unstated-next').Container<{
|
|
11
|
+
plugin: import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
}, InitialState>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface State {
|
|
2
|
+
autoTranslate: boolean;
|
|
3
|
+
}
|
|
4
|
+
interface Action {
|
|
5
|
+
enableAutoTranslate: () => void;
|
|
6
|
+
disableAutoTranslate: () => void;
|
|
7
|
+
toggleAutoTranslate: (value?: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const useAutoTranslateStore: import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<State & Action>, "persist"> & {
|
|
10
|
+
persist: {
|
|
11
|
+
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<State & Action, State & Action>>) => void;
|
|
12
|
+
clearStorage: () => void;
|
|
13
|
+
rehydrate: () => void | Promise<void>;
|
|
14
|
+
hasHydrated: () => boolean;
|
|
15
|
+
onHydrate: (fn: (state: State & Action) => void) => () => void;
|
|
16
|
+
onFinishHydration: (fn: (state: State & Action) => void) => () => void;
|
|
17
|
+
getOptions: () => Partial<import('zustand/middleware').PersistOptions<State & Action, State & Action>>;
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
export declare const useTargetLanguage: () => string;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TypographyProps } from '@mui/material';
|
|
2
|
+
export declare const useTranslate: ({ text, enabled }: {
|
|
3
|
+
text: string;
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
}) => {
|
|
6
|
+
translation: any;
|
|
7
|
+
key: string;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
};
|
|
10
|
+
type Props<C extends React.ElementType> = {
|
|
11
|
+
text: string;
|
|
12
|
+
} & TypographyProps<C, {
|
|
13
|
+
component?: C;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function Translate<C extends React.ElementType>({ text, children, sx, ...rest }: Props<C>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function hashText(text?: string): string;
|
|
2
|
+
export declare const isInlineTranslationAvailable: boolean;
|
|
3
|
+
export declare function detectLanguage(src: string): {
|
|
4
|
+
name: string;
|
|
5
|
+
nativeName: string;
|
|
6
|
+
iso639_1: string;
|
|
7
|
+
iso639_3: string;
|
|
8
|
+
} | null;
|
|
9
|
+
export declare function detectLanguageIso6391(src: string): string | null;
|
|
@@ -22,6 +22,7 @@ interface CommentsProviderProps {
|
|
|
22
22
|
renderDonation?: (post: Post) => React.ReactNode;
|
|
23
23
|
renderActions?: (post: Post) => React.ReactNode;
|
|
24
24
|
renderEditorPlugins?: (post: Post) => React.ReactNode;
|
|
25
|
+
enableAutoTranslate?: boolean;
|
|
25
26
|
renderInnerFooter?: (post: Post) => React.ReactElement;
|
|
26
27
|
}
|
|
27
28
|
interface State {
|
|
@@ -66,9 +67,10 @@ interface CommentsContextValue {
|
|
|
66
67
|
renderDonation?: (post: Post) => React.ReactNode;
|
|
67
68
|
renderActions?: (post: Post) => React.ReactNode;
|
|
68
69
|
renderEditorPlugins?: (post: Post) => React.ReactNode;
|
|
70
|
+
enableAutoTranslate?: boolean;
|
|
69
71
|
renderInnerFooter?: (post: Post) => React.ReactElement;
|
|
70
72
|
}
|
|
71
73
|
export declare const CommentsContext: React.Context<CommentsContextValue>;
|
|
72
74
|
export declare const useCommentsContext: () => CommentsContextValue;
|
|
73
|
-
export declare function CommentsProvider({ target, api, flatView, children, order, autoLoadComments, autoCollapse, allowCopyLink, showProfileCard, interactive, containerRef, renderComments, renderDonation, renderActions, renderEditorPlugins, renderInnerFooter, }: CommentsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
75
|
+
export declare function CommentsProvider({ target, api, flatView, children, order, autoLoadComments, autoCollapse, allowCopyLink, showProfileCard, interactive, containerRef, renderComments, renderDonation, renderActions, renderEditorPlugins, enableAutoTranslate, renderInnerFooter, }: CommentsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
74
76
|
export {};
|
|
@@ -10,5 +10,6 @@ export interface CommentProps {
|
|
|
10
10
|
renderDonation?: (post: Post) => React.ReactNode;
|
|
11
11
|
renderActions?: (post: Post) => React.ReactNode;
|
|
12
12
|
renderEditorPlugins?: (post: Post) => React.ReactNode;
|
|
13
|
+
enableAutoTranslate?: boolean;
|
|
13
14
|
}
|
|
14
|
-
export default function Comment({ onDelete, onRate, onUnrate, onReply, onTogglePin, onContentUpdate, onLoadMoreReplies, renderDonation, renderActions, renderEditorPlugins, ...rest }: PostProps & CommentProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default function Comment({ onDelete, onRate, onUnrate, onReply, onTogglePin, onContentUpdate, onLoadMoreReplies, renderDonation, renderActions, renderEditorPlugins, enableAutoTranslate, ...rest }: PostProps & CommentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,6 +14,7 @@ export interface PostProps {
|
|
|
14
14
|
className?: string;
|
|
15
15
|
resolveAuthorInfoAppend?: (post: Post) => React.ReactNode;
|
|
16
16
|
editorPlugins?: React.ReactNode;
|
|
17
|
+
enableAutoTranslate?: boolean;
|
|
17
18
|
}
|
|
18
19
|
interface PostContext {
|
|
19
20
|
isAdmin: boolean;
|
|
@@ -21,5 +22,5 @@ interface PostContext {
|
|
|
21
22
|
interactive: boolean;
|
|
22
23
|
post: Post;
|
|
23
24
|
}
|
|
24
|
-
export default function PostComponent({ post, render, renderExtraContent, customMenu, interactive, onContentUpdate, allowCopyLink, autoCollapse, showProfileCard, resolveAuthorInfoAppend, editorPlugins, ...rest }: PostProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export default function PostComponent({ post, render, renderExtraContent, customMenu, interactive, onContentUpdate, allowCopyLink, autoCollapse, showProfileCard, resolveAuthorInfoAppend, editorPlugins, enableAutoTranslate, ...rest }: PostProps): import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
export {};
|
|
@@ -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-CIb6-P8d.mjs";
|
|
8
8
|
const BlockletEditor = lazyRetry(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|