feat: add embed block node for iframes and JSX components in blog editor#4083
Open
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Open
feat: add embed block node for iframes and JSX components in blog editor#4083devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Conversation
Co-Authored-By: Sungbin Jo <goranmoomin@daum.net>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
✅ Deploy Preview for hyprnote-storybook canceled.
|
✅ Deploy Preview for hyprnote ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…ult type Co-Authored-By: Sungbin Jo <goranmoomin@daum.net>
Co-Authored-By: Sungbin Jo <goranmoomin@daum.net>
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.
feat: add embed block node for iframes and JSX components in blog editor
Summary
Adds a new "Embed Block" node to the blog editor, inspired by Vrite's Element block pattern. This is an opaque atom node that stores arbitrary iframe, JSX, or HTML code as a raw string — allowing blog authors to embed
<iframe>,<Callout>,<CtaCard>, or any other component markup directly in the editor.New files:
packages/tiptap/src/shared/embed-block.ts— base tiptapNodedefinition with paste detection (looksLikeEmbedCode),parseHTML/renderHTML, and markdown serialization hooksapps/web/src/components/admin/blog-editor/embed-block.tsx— React node view with edit mode (textarea for pasting code) and preview mode (shows code + detected type label)Modified files:
index.tsx— registersEmbedBlockNodeextensiontoolbar.tsx— adds<CodeXml>toolbar button to insert an embed blockpackages/tiptap/src/shared/index.ts— re-exports the new moduleBehavior:
handlePasteplugin<Callout />") with hover-to-edit pencil buttonReview & Testing Checklist for Human
looksLikeEmbedCodematches any<Tag>...</Tag>or<iframe ...>pattern. Pasting normal HTML (e.g.<div>hello</div>) will be intercepted. Verify this doesn't break normal paste workflows. Also check interaction with the existing ClipNode YouTube paste handler — plugin ordering determines which handler fires first.parseMarkdownunconditionally returns anembedBlockfor any token routed to it (thelooksLikeEmbedCodeguard was removed to satisfy theMarkdownParseResulttype). Load existing blog posts containing JSX (e.g.<Callout>,<Clip>) and verify they survive a full save → reload cycle without data loss or unexpected embed block creation.<iframe src="...">and a JSX snippet like<Callout type="note">text</Callout>, save, and verify the markdown output is correct.[\s\S]*inJSX_BLOCK_REGEXcould be slow on very large clipboard payloads.Notes
ci(typecheck) andfmt(dprint) checks are green.navigator.platform(used for keyboard shortcut hint display) is deprecated but functional; non-blocking.