-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: GutenbergKit Media Library support (#23721)
* wip: GutenbergKit Media Library support * fix: JSON encode media array and pass as string to WebView * fix: Prevent global callback collisions A single Media Library callback resulted in erroneously mutating unselected blocks. * refactor: Remove Media Library UUID usage Unable to recreate the original erroneously replacement of media attachments for unselected blocks. This now feels unnecessary. * style: Remove unnecessary white space Address lint warning. * feat: Media Library preserves initial selection Enable retaining selection for gallery addition/editing in the block editor. * refactor: Remove unnecessary preserveSelection parameter Reusing the `initialSelection` reduces complexity. * fix: Reinstate commented selection clearing code This no longer disrupts initial selection as the setting the initial selection now occurs within `setEditing` rather than initialization. * refactor: Remove unnecessary application of initial selection This appears to be unnecessary with the latest implementation. * refactor: Remove unused `preserveSelection` parameter * fix: Canceling media selection returns initial selection Without returning the initial selection, canceling cleared out media attached to Gallery blocks in the web-based editor, as it presumes the existing media will be returned as "selected." * fix: Discard initial selection for single select Workaround existing logic that dismisses the dialog if `allowMuliple` is true and selection is not empty. The existing logic allows for quickly selecting a single media item, but inhibits the ability to showcase a pre-existing selection for single-select contexts. This diverges from the web experience, but is the easiest path forward to avoid a significant refactor of the logic that would impact all other existing use cases--Gutenberg Mobile, Aztec, etc. * fix: Ensure correct media attachment sorting Map the Media lookup results to the original array of media IDs so that the sort order is preserved. * build: Update GutenbergKit ref * build: Update GutenbergKit ref * docs: Expand existing documentation to include new parameter * refactor: Update bridge method name to mirror GutenbergKit * refactor: Rename `OpenMediaLibrary` to `OpenMediaLibraryAction` Improve clarity. * fix: Include VideoPress ID in metadata * fix: Account for null `allowedTypes` values The File block does not provide these value. * fix: Assert main thread for `mapMediaIdsToMedia` The returned `Media` entities are not thread-safe. * build: Update GutenbergKit ref * build: Update GutenbergKit ref
- Loading branch information
Showing
7 changed files
with
128 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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