Repository navigation
feat(plugins): let editor plugins insert site fragments - #641
Draft
DavidBabinec wants to merge 2 commits into
Draft
DavidBabinec wants to merge 2 commits into
DavidBabinec wants to merge 2 commits into
Conversation
Plugins that ship sections or pages could only drop them in by mutating the editor store by hand, which skips the merge rules, media uploads, table writes and the single undo step. api.editor.fragments (permission editor.fragments) runs the Insert fragment dialog's own plan and commit with the plugin's media reader and an explicit placement; the store action takes that placement while the dialog keeps placing after the selection.
DavidBabinec
force-pushed
the
feat/plugin-fragments-api
branch
from
October 13, 2026 17:16
0ce3ec4 to
0987d9e
Compare
A section that brings a colour the site lacks used to add it with the source site's value, so a pale band could land under a dark site's light text. Callers can now name a site colour to take the values from (colorSources on planFragmentInsert and on the plugin API's plan and insert); the report lists what was filled.
This branch has not been deployed
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.
What
Editor plugins with the new
editor.fragmentspermission getapi.editor.fragments.insertandapi.editor.fragments.plan. Insert runs the same plan, step-up and one-undo commit as Spotlight "Insert fragment from file…", with the plugin supplying media bytes and a placement (after-selection,inside-selectionorend). Plan is a dry run that returns the report and changes nothing. Both takecolorSources, which fills a colour the fragment adds from one of the site's own instead of the source site's value.Why
A plugin that ships sections or pages had no way to insert them except mutating the store by hand, which skips the merge rules, media upload and table writes. The store action now takes an explicit placement; the dialog keeps its current behaviour.
Verification
New
pluginFragmentsApi.test.tscovers the permission, placements, media reads, undo, plan and malformed input;insertFragment.test.tscovers the placements in the store. In a browser, a plugin installed through the Plugins page inserted two sections from its own panel, with the step-up prompt for a table write, and the published page matched the editor.Stacked on #640.