Skip to content

feat: extract and refactor the GPT extension - #1385

Draft
ReFFaT wants to merge 3 commits into
mainfrom
feat/gpt-renderer-public-entrypoint
Draft

ReFFaT wants to merge 3 commits into
mainfrom
feat/gpt-renderer-public-entrypoint

Conversation

@ReFFaT

@ReFFaT ReFFaT commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Move GPT into @gravity-ui/markdown-editor-gpt-extension: the extension registration, ProseMirror/CodeMirror plugins, dialog, request and feedback state, styles, icons, and translations now belong to a separate publishable workspace package. The package receives renderer and Markdown conversion capabilities from its host and has no dependency on the editor package.

Keep the editor's existing gptExtension, mGptExtension, toolbar items, options, callbacks, CSS classes, and language configuration through compatibility adapters. A dedicated renderer subpath and createGptExtension support direct package integration. Preserve source history with a separate move commit before the implementation changes.

Split the dialog into prompt, answer, and shared popup components. Isolate request and feedback lifecycles; ignore stale responses after a newer request, reset, or unmount. Close the dialog when the document/selection changes so late results cannot replace edited text. Remove unconditional scrolling and synthetic scroll events, focus the prompt without scrolling, restore editor focus on close, and support a popup container for modal/drawer focus boundaries. Also preserve the apply callback in Markdown mode.

Validation: 14 focused unit/integration tests; package/editor builds and typechecks, demo typecheck, lint, ESM/CJS bundling and package-boundary checks, zero circular dependencies, frozen-lockfile installation, and npm tarball generation. Four Chromium scenarios passed inside Docker, covering focus/scroll/reopen and replacement/undo in both editor modes. Docker has 2 GB RAM, so browser scenarios were run as separate processes after warming the build cache.

Add release/publish configuration and integration documentation. Publish the GPT package before the editor version that depends on it. No npm package has been published by this PR.

@gravity-ui

gravity-ui Bot commented Oct 28, 2026

Copy link
Copy Markdown

Storybook Deployed

@gravity-ui

gravity-ui Bot commented Oct 28, 2026

Copy link
Copy Markdown

🎭 Playwright Report

@ReFFaT ReFFaT changed the title feat: expose a dedicated React renderer entry point feat: extract and refactor the GPT extension Oct 28, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant