一个可插入的、直观的类似于丰富文本编辑器的媒介/概念工具(目前处于开发中)
AI-native React editor built on Lexical.
The current entry point exports a modern Lexical editor designed for AI chat and agent workflows: rich prompt input, structured context, attachments, tool intent, and serializable AI parts.
npm installnpm run startOpen the local Vite URL and try the demo editor.
npm run buildBuild output:
dist/react-tapable-editor.mjsdist/react-tapable-editor.cjsdist/react-tapable-editor.cssdist/index.d.tsimport LexicalTapableEditor from 'react-tapable-editor';
import 'react-tapable-editor/style.css';
export function Composer() {
return (
{
console.log(event.action, event.id);
}}
onSubmit={payload => {
console.log(payload.text);
console.log(payload.parts);
console.log(payload.portable);
}}
/>
);
}Use AIElementsComposer when you want a designed composer surface instead of a
bare editor core. It ships with a shadcn-inspired container, default mention
suggestions for people/files/folders/actions, model options, tool modes, and
prompt history.
import {
AIElementsAgentConsole,
AIElementsCatalog,
AIElementsComposer,
AIElementsGallery,
AIElementsStats,
AIElementsSystemMap,
AIElementsWorkflow,
MentionPicker,
PayloadInspector,
SourcesBlock,
TaskPlanBlock,
aiElementsMentionSuggestions,
} from 'react-tapable-editor';
import 'react-tapable-editor/style.css';
export function WorkspaceComposer() {
return (
<>
runAgent(payload)}
/>
runCodingAgent(payload)}
/>
);
}The preset is intentionally opinionated but not closed: pass
mentionSuggestions, models, toolModes, promptHistory, and the normal
editor callbacks to replace any default.
The primitives can also be used without the composer. They are ordinary React components that share the same TypeScript types as the editor payload, so a product can place them in sidebars, popovers, agent consoles, or artifact workspaces while keeping one schema contract.
import {
INSERT_AI_BLOCK_COMMAND,
INSERT_AI_CHIP_COMMAND,
INSERT_IMAGE_COMMAND,
UPDATE_AI_BLOCK_COMMAND,
UPDATE_IMAGE_COMMAND,
} from 'react-tapable-editor';The command payload types are exported as TypeScript types.
import {
createLexicalJSONFromPortableDocument,
exportPortableDocumentToMarkdown,
exportPortableDocumentToPlainText,
migratePortableDocument,
} from 'react-tapable-editor';The portable document is a versioned schema that can be stored or sent to an AI runtime without coupling the caller to Lexical internals.
import { useRef } from 'react';
import LexicalTapableEditor, {
LexicalTapableEditorHandle,
} from 'react-tapable-editor';
export function AgentComposer() {
const editorRef = useRef(null);
return (
{
editorRef.current?.insertAIBlock({
id: 'run-1',
kind: 'tool-call',
title: 'Agent run',
status: 'running',
});
}}
/>
);
}Planning and architecture notes live in codebase-wiki/.
npm run docs:wiki:devThe public documentation site lives in docs/. It is separate from the
internal codebase wiki and is organized around Philosophy, Components, Blocks,
Runtime, Recipes, and API.
npm run docs:devnpm run release:checkThis runs the production build, Playwright e2e suite, and wiki build.
暂无开放 Issues,或尚未同步最近议题。