Expose components needed for the ai plugin new interface (#24972)
* Export thread components * Exporting AdvancedCreateComment * Expose components needed for the ai plugin new interface * Exporting the placeholder for the plugin CreatePost component, and simplify the export * Fixing linter errors * Fixing type errors * Reverting typescript related changes * Cheating typescript to keep the changes as minimal as possible * Fix linter errors
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c67391f1db
Коммит
f8e8eca985
@@ -12,6 +12,7 @@ import {openPricingModal} from 'components/global_header/right_controls/plan_upg
|
||||
import {useNotifyAdmin} from 'components/notify_admin_cta/notify_admin_cta';
|
||||
import PurchaseModal from 'components/purchase_modal';
|
||||
import StartTrialFormModal from 'components/start_trial_form_modal';
|
||||
import ThreadViewer from 'components/threading/thread_viewer';
|
||||
import Timestamp from 'components/timestamp';
|
||||
import BotTag from 'components/widgets/tag/bot_tag';
|
||||
import Avatar from 'components/widgets/users/avatar';
|
||||
@@ -24,6 +25,7 @@ import {formatText} from 'utils/text_formatting';
|
||||
import {useWebSocket, useWebSocketClient, WebSocketContext} from 'utils/use_websocket';
|
||||
import {imageURLForUser} from 'utils/utils';
|
||||
|
||||
import CreatePost from './exported_create_post';
|
||||
import {openInteractiveDialog} from './interactive_dialog'; // This import has intentional side effects. Do not remove without research.
|
||||
import Textbox from './textbox';
|
||||
|
||||
@@ -86,6 +88,8 @@ window.Components = {
|
||||
imageURLForUser,
|
||||
BotBadge: BotTag,
|
||||
StartTrialFormModal,
|
||||
ThreadViewer,
|
||||
CreatePost,
|
||||
};
|
||||
|
||||
// This is a prototype of the Product API for use by internal plugins only while we transition to the proper architecture
|
||||
|
||||
35
webapp/channels/src/plugins/exported_create_post.tsx
Обычный файл
35
webapp/channels/src/plugins/exported_create_post.tsx
Обычный файл
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import AdvancedCreateComment from 'components/advanced_create_comment';
|
||||
|
||||
import type {PostDraft} from 'types/store/draft';
|
||||
|
||||
type Props = {
|
||||
placeholder?: string;
|
||||
onSubmit: (draft: PostDraft) => void;
|
||||
}
|
||||
|
||||
const ExportedCreatePost = ({placeholder, onSubmit}: Props) => {
|
||||
const Component = AdvancedCreateComment as any;
|
||||
|
||||
return (
|
||||
<Component
|
||||
placeholder={placeholder}
|
||||
rootDeleted={false}
|
||||
channelId={undefined}
|
||||
rootId={undefined}
|
||||
latestPostId={undefined}
|
||||
onSubmit={onSubmit}
|
||||
onUpdateCommentDraft={() => null}
|
||||
updateCommentDraftWithRootId={() => null}
|
||||
onMoveHistoryIndexBack={() => null}
|
||||
onMoveHistoryIndexForward={() => null}
|
||||
onEditLatestPost={() => ({data: true})}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default ExportedCreatePost;
|
||||
Ссылка в новой задаче
Block a user