Repository navigation
Conversation
A sidebar panel could reach `useMediaEditor()`, which hands out the whole session: the cropper controller with its state shape, setters, gestures and image loading. Public means frozen, and removing any of that later needs a deprecation cycle, while adding to a facade later costs nothing. `useMediaEditorPanelContext()` gives a panel the media type, the image and saving flags, whether there is anything to save, the aspect-ratio preset with its options and setter, a quarter-turn rotation and the two flips. It is built from the frame context, which now carries the media type, and the session. Internal for now; nothing exports it yet.
🤖 PR meta 🤖📦 Bundle sizeSize Change: +9 B (0%) Total Size: 9.06 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Regression: updating a specific option will only change its value and will not corrupt others in
|
…t save `session.edits`, set with `setEdit`, is undoable and cleared by Reset because `isDirty` counts it, but `hasOutputEdits` does not, the editor's unsaved-changes check and Save ignore it, and neither the save hook nor the modal's modifier builder reads it. Say so in the architecture notes, the doc comments and at `hasChanges`, and pin it with a state test, so a sidebar panel reaching the session knows what setting one does before the session is exposed to plugins. Applying named edits to the output is the edit pipeline's job and a separate change.
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
useMediaEditorPanelContext(): what a sidebar panel may read and do. Media type, image and saving flags, whether there is anything to save, the aspect-ratio preset with its options and setter, quarter-turn rotation, and horizontal and vertical flip. Internal for now; nothing exports it yet.Why
A sidebar panel (#84664) could reach
useMediaEditor(), which hands out the whole session: the cropper controller with its state shape, setters, gestures and image loading. Public means frozen, and removing any of that later needs a deprecation cycle; adding to a facade later does not. This is what the next PR of #79175 exports to plugins, in place of the session.What changed
useMediaEditorPanelContext()beside the frame context in the editor component, built from the frame context and the session. The frame context carriesmediaTypefor it.session.edits, set withsetEdit, is session state for the editor's own edit pipeline:isDirtycounts it, so Reset clears it, buthasOutputEditsdoes not, the unsaved-changes check and Save ignore it, and nothing saves it. The architecture note and doc comments say so, a comment athasChangessays why, and a state test pins it. Applying named edits to the output is the edit pipeline's job and a separate change.