feat: add experimental GridBlockTemplates extension#1152
Draft
makhnatkin wants to merge 8 commits into
Draft
Conversation
Reviewer's GuideIntroduces a new experimental GridBlockTemplates extension that defines a ProseMirror atom node, React-based NodeView UI, HTML serialization, and localStorage-backed template parsing/storage, plus Storybook demo and tests. File-Level Changes
|
…locks Replace native HTML5 drag with a pointer-based drag handle so reordering works reliably over preview HTML; make the handle visible above block content (z-index, float background, touch-action: none). Keep user-entered raw HTML verbatim inside the block instead of unwrapping its root element, so a pasted <div>text</div> stays as <div class="block-N"><div>text</div></div> on serialization. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a second textarea in the container gear popup for free-form CSS rules
with selectors (.grid {}, .block-1 {}). Rules are scoped to the grid
instance so they never leak to other grids, applied live in the preview
and serialized into a <style> tag inside the html block.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Wrap the menu in both the container-templates and block-insert popups in a scrollable container (max-height) so a long list of templates no longer overflows the viewport; the search field stays pinned above it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tyles
Replace inline CSS everywhere with a single selector-based model. The
container gear has one CSS field (.grid {}, .block-1 {}); the block gear
keeps HTML + a CSS field where & targets the block root and other
selectors are scoped under it. All rules are scoped to the instance and
emitted into a <style> tag instead of style="" attributes; templates
convert their inline style to rules on insert.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an experimental
GridBlockTemplatesadditional extension for building reusable grid layouts from typed block and container templates.This PR is stacked on top of
feat/yfm-html-block-templates-and-preview, so the diff stays scoped to the new experiment.What Changed
::: htmloutput.<template type="block|container">parsing and localStorage-backed user templates with merge-by-id and clear support.Validation
pnpm --filter @gravity-ui/markdown-editor lintpnpm --filter @gravity-ui/markdown-editor typecheckNotes
Jest tests were not run locally after the refactor because
AGENTS.mdrequires tests to run in Docker, and this repository only exposes a Docker wrapper for Playwright, not for the affected Jest slice.