feat(widget-markdown): support inline custom editor components - #7958
Open
mmaoteacher wants to merge 12 commits into
Open
feat(widget-markdown): support inline custom editor components#7958mmaoteacher wants to merge 12 commits into
mmaoteacher wants to merge 12 commits into
Conversation
…ifecycle for inline shortcodes
… validation warnings
✅ Deploy Preview for decap-cms ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
* fix: solve flaky/failing tests * fix: change config and cypress setup * fix: increase test timeout * feat: add sharding again * fix: remaining tests (attempt) * fix: ignore parameter order and clear isFetching
Bumps [nx](https://github.com/nrwl/nx/tree/HEAD/packages/nx) from 21.6.11 to 23.1.1. - [Release notes](https://github.com/nrwl/nx/releases) - [Commits](https://github.com/nrwl/nx/commits/23.1.1/packages/nx) --- updated-dependencies: - dependency-name: nx dependency-version: 23.1.1 dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
mmaoteacher
force-pushed
the
5065/inline-editor-components
branch
from
August 20, 2026 00:09
f1c4b77 to
8e6e492
Compare
Author
|
Hi @yanthomasdev , I figured out why CI failed — I forgot to register my component in dev-test/backends/test/index.html as well. I've fixed this, rebased, and force-pushed to the feature branch. Please re-run the CI tests when you have a chance. Thanks! |
mmaoteacher
force-pushed
the
5065/inline-editor-components
branch
from
August 23, 2026 09:01
7d2b558 to
83a6f08
Compare
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
Closes #5065
Relates to #2064
Motivation & Background
Currently,
CMS.registerEditorComponentassumes all registered custom editor components are block-level elements. When developers attempt to register inline shortcode patterns (e.g., Hugo shortcodes{{< ref "..." >}}, Obsidian wikilinks[[wikilink]], inline badges, tags, or mentions):Slate -> MDAST -> Markdown) frequently triggersSent invalid data to remarkerrors or strips leading/trailing whitespaces.Proposed Solution
This PR introduces first-class support for Inline Custom Editor Components in
packages/decap-cms-widget-markdownviaCMS.registerEditorComponent.1. API Specification (
CMS.registerEditorComponent)We extend
EditorComponentOptionswith an explicittype: 'inline'discriminator alongside dedicated serialization and lifecycle hooks:2. Architecture & Data Flow
3. Key Module Changes
packages/decap-cms-widget-markdown/src/serializers/remarkShortcodes.js:inlineTokenizers.inlineShortcodewith properlocatorfunction for fast scanning inside paragraphs without breaking inline text parsing.packages/decap-cms-widget-markdown/src/serializers/slateRemark.js&remarkSlate.js:inline-shortcodeto Slate inline element nodes and vice versa.\n\n) around inline nodes.packages/decap-cms-widget-markdown/src/MarkdownControl/plugins/shortcodes/:withShortcodes.jsto registereditor.isInlineforinline-shortcodeand supportisVoid.insertShortcode.jsto handle inline components with selection capture and asynconInsert.packages/decap-cms-widget-markdown/src/MarkdownControl/components/InlineShortcode.js:contentEditable={false}for void nodes, selection highlight, and asynconEdittrigger.Scope & Future Work
packages/decap-cms-widget-markdown, which is the primary and default Markdown editor used across Decap CMS.packages/decap-cms-widget-richtext(based on Plate.js) will be tracked and implemented in a separate follow-up PR to keep this PR focused, lightweight, and risk-contained for reviewers.Implementation Phases
docs/specs/inline-editor-components-rfc.md).packages/decap-cms-core/index.d.ts.inlineTokenizersupporting custom regex patterns.Markdown <-> MDAST) without character escaping or whitespace loss.contentEditable={false}for void nodes.selectedTextcapture andonInsertresolution.onEdit.Test plan
Unit Tests (
jest):remarkShortcodes.spec.js,slate.spec.js, andinsertShortcode.spec.js.這是一個[[測試頁面]],請點擊!.**Important [badge:NEW] Note**.E2E Browser Tests (
cypress):npx cypress run --browser electron --spec "cypress/e2e/markdown_widget_inline_component_spec.js"Lint & Build:
Checklist