Skip to content

Conversation

@dcalhoun
Copy link
Member

What?

Registers the MediaFileSchemeHandler with the WKWebView configuration so that media selected from the device's photo library can be displayed in the editor.

Why?

When inserting media from the native iOS block inserter, selected photos and videos were not appearing in the editor. The MediaFileSchemeHandler for the gbk-media-file:// URL scheme was defined but never registered with the WebView configuration.

This was a regression introduced in commit 6486090 ("Add iOS Preload List #250") when EditorViewController was refactored and the scheme handler registration was removed but not restored.

Fixes CMM-1207.

How?

Added the missing scheme handler registration in EditorViewController.init():

config.setURLSchemeHandler(MediaFileSchemeHandler(), forURLScheme: MediaFileSchemeHandler.scheme)

Also added test coverage to verify the scheme handler is properly registered.

Testing Instructions

  1. Open the editor on iOS
  2. Tap the block inserter button
  3. Select "Photos" to choose media from the device's photo library
  4. Select a photo or video
  5. Verify the media block is inserted and displays correctly

Accessibility Testing Instructions

N/A - This fix restores existing functionality without UI changes.

The `MediaFileSchemeHandler` was defined but not registered with the
`WKWebView` configuration, causing media insertion from the native iOS
block inserter to fail. Selected photos and videos from the device's
photo library were not displaying in the editor because the WebView
couldn't load `gbk-media-file://` URLs.

This fix adds the missing scheme handler registration in
`EditorViewController.init()`, restoring functionality that was
accidentally removed in commit 6486090.
@dcalhoun dcalhoun added the [Type] Bug An existing feature does not function as intended label Jan 30, 2026
@dcalhoun dcalhoun force-pushed the fix/native-ios-inserter-inserts-media branch from 97d47e5 to 613fc97 Compare January 30, 2026 21:45
@dcalhoun dcalhoun force-pushed the fix/native-ios-inserter-inserts-media branch from 613fc97 to 76c0546 Compare January 30, 2026 21:46
@dcalhoun dcalhoun marked this pull request as ready for review January 30, 2026 21:59
@dcalhoun dcalhoun requested a review from kean January 30, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants