Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
03d3370
build: Add commonly used `@wordpress` modules
dcalhoun Oct 28, 2025
842fe17
feat: Expose `@wordpress` modules as `window.wp` globals
dcalhoun Oct 28, 2025
a683c9b
build: Bundled editor leverages remote Vite config
dcalhoun Oct 28, 2025
7dbc498
fix: Preserve CSS side-effect imports
dcalhoun Oct 28, 2025
8850636
feat: Bundled editor loads plugin assets
dcalhoun Oct 28, 2025
756634e
feat: Demo app always uses bundled editor
dcalhoun Oct 28, 2025
f48c272
fix: Allow all assets when `disallowedPackages` is empty
dcalhoun Oct 28, 2025
b55b838
fix: Ensure iOS editor assets logic is always available
dcalhoun Oct 28, 2025
5f9b8dc
fix: Unregister disallowed block types
dcalhoun Oct 30, 2025
deb2257
feat: Exclude core and Gutenberg assets
dcalhoun Oct 30, 2025
0beeba1
refactor: Simplify editor URL selection
dcalhoun Oct 31, 2025
8e6eae2
feat: Exclude core and Gutenberg assets (Android)
dcalhoun Oct 31, 2025
c853b42
fix: Conditionally load plugin assets
dcalhoun Oct 31, 2025
5b2c91f
build: Exclude internal `@wordpress` module paths from externalization
dcalhoun Oct 31, 2025
9788308
fix: Configure i18n before loading dependent `@wordpress` modules
dcalhoun Oct 31, 2025
9911292
fix: Defer references to `@wordpress` modules
dcalhoun Oct 31, 2025
f6c4b49
build: Ensure `index.html` entry is created
dcalhoun Oct 31, 2025
6c8b0e1
refactor: Correct import grouping
dcalhoun Oct 31, 2025
185ffda
build: Stop marking `@wordpress` modules as external
dcalhoun Oct 31, 2025
0b9ffbe
build: Skip transforming `node_modules` files
dcalhoun Oct 31, 2025
150770c
refactor: Revert unnecessary code relocation
dcalhoun Oct 31, 2025
5ed122a
refactor: Revert unnecessary import relocation
dcalhoun Oct 31, 2025
90e3b07
fix: Apply correct font weight to error heading
dcalhoun Oct 31, 2025
3b1af54
build: Add missing `@wordpress` modules and dependencies
dcalhoun Oct 31, 2025
215af3a
fix: Reinstate VideoPress bridge initialization
dcalhoun Nov 3, 2025
e5c03e1
fix: Initialize editor after plugins loading
dcalhoun Nov 4, 2025
5d0c795
build: Add jquery dependency
dcalhoun Nov 4, 2025
50f8125
feat: Expose jQuery for plugins
dcalhoun Nov 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,8 @@ class GutenbergView : WebView {

initializeWebView()

val editorUrl = if (configuration.plugins && BuildConfig.GUTENBERG_EDITOR_REMOTE_URL.isNotEmpty()) {
BuildConfig.GUTENBERG_EDITOR_REMOTE_URL
} else if (BuildConfig.GUTENBERG_EDITOR_URL.isNotEmpty()) {
val editorUrl = if (BuildConfig.GUTENBERG_EDITOR_URL.isNotEmpty()) {
BuildConfig.GUTENBERG_EDITOR_URL
} else if (configuration.plugins) {
ASSET_URL_REMOTE
} else {
ASSET_URL
}
Expand Down Expand Up @@ -304,6 +300,7 @@ class GutenbergView : WebView {
"namespaceExcludedPaths": ${configuration.namespaceExcludedPaths.joinToString(",", "[", "]") { "\"$it\"" }},
"authHeader": "${configuration.authHeader}",
"themeStyles": ${configuration.themeStyles},
"plugins": ${configuration.plugins},
"hideTitle": ${configuration.hideTitle},
"editorSettings": $editorSettings,
"locale": "${configuration.locale}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ public actor EditorAssetsLibrary {
/// reused on future calls.
func loadManifestContent() async throws -> Data {
let endpoint: URL
// The GutenbergKit bundle includes the required `@wordpress` modules
let excludeParam = URLQueryItem(name: "exclude", value: "core,gutenberg")
Comment on lines +25 to +26
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This leverages the query parameter introduced in Automattic/jetpack#45715. We exclude "core" and Gutenberg so that only third-party plugin assets are returned.

if let url = configuration.editorAssetsEndpoint {
endpoint = url
endpoint = url.appending(queryItems: [excludeParam])
} else if !configuration.siteApiRoot.isEmpty, let apiRoot = URL(string: configuration.siteApiRoot) {
endpoint = apiRoot.appendingPathComponent("wpcom/v2/editor-assets")
endpoint = apiRoot
.appendingPathComponent("wpcom/v2/editor-assets")
.appending(queryItems: [excludeParam])
} else {
throw ManifestError.unavailable
}
Expand Down
20 changes: 7 additions & 13 deletions ios/Sources/GutenbergKit/Sources/EditorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,13 @@ public final class EditorViewController: UIViewController, GutenbergEditorContro
}

private func loadEditor() {
if configuration.shouldUsePlugins {
webView.configuration.userContentController.addScriptMessageHandler(
EditorAssetsProvider(library: assetsLibrary),
contentWorld: .page,
name: "loadFetchedEditorAssets"
)
webView.configuration.userContentController.addScriptMessageHandler(
EditorAssetsProvider(library: assetsLibrary),
contentWorld: .page,
name: "loadFetchedEditorAssets"
)

if let remoteURL = ProcessInfo.processInfo.environment["GUTENBERG_EDITOR_REMOTE_URL"].flatMap(URL.init) {
webView.load(URLRequest(url: remoteURL))
} else {
let remoteURL = Bundle.module.url(forResource: "remote", withExtension: "html", subdirectory: "Gutenberg")!
webView.loadFileURL(remoteURL, allowingReadAccessTo: Bundle.module.resourceURL!)
}
} else if let editorURL = ProcessInfo.processInfo.environment["GUTENBERG_EDITOR_URL"].flatMap(URL.init) {
if let editorURL = ProcessInfo.processInfo.environment["GUTENBERG_EDITOR_URL"].flatMap(URL.init) {
webView.load(URLRequest(url: editorURL))
} else {
let indexURL = Bundle.module.url(forResource: "index", withExtension: "html", subdirectory: "Gutenberg")!
Expand All @@ -135,6 +128,7 @@ public final class EditorViewController: UIViewController, GutenbergEditorContro
namespaceExcludedPaths: \(Array(configuration.namespaceExcludedPaths)),
authHeader: '\(configuration.authHeader)',
themeStyles: \(configuration.shouldUseThemeStyles),
plugins: \(configuration.shouldUsePlugins),
enableNativeBlockInserter: \(configuration.isNativeInserterEnabled),
hideTitle: \(configuration.shouldHideTitle),
editorSettings: \(configuration.editorSettings),
Expand Down
Loading