@@ -120,8 +120,6 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
120120 self . editorSession = PostEditorAnalyticsSession ( editor: . gutenbergKit, post: post)
121121 self . navigationBarManager = navigationBarManager ?? PostEditorNavigationBarManager ( )
122122
123- let networkClient = NewGutenbergNetworkClient ( blog: post. blog)
124-
125123 let selfHostedApiUrl = post. blog. url ( withPath: " wp-json/ " )
126124 let isSelfHosted = !post. blog. isHostedAtWPcom && !post. blog. isAtomic ( )
127125 let siteApiRoot = post. blog. isAccessibleThroughWPCom ( ) && !isSelfHosted ? post. blog. wordPressComRestApi ( ) ? . baseURL. absoluteString : selfHostedApiUrl
@@ -140,22 +138,23 @@ class NewGutenbergViewController: UIViewController, PostEditor, PublishingEditor
140138 }
141139
142140 let siteApiNamespace = post. blog. dotComID != nil && !isSelfHosted && applicationPassword == nil ? " sites/ \( siteId ?? " " ) " : " "
143- let postType = post is Page ? " page " : " post "
144- let postId : Int ? = post. postID? . intValue != - 1 ? post. postID? . intValue : nil
145141
146- self . editorViewController = GutenbergKit . EditorViewController (
147- id: postId,
148- type: postType,
142+ var conf = EditorConfiguration (
149143 title: post. postTitle ?? " " ,
150- content: post. content ?? " " ,
151- service: GutenbergKit . EditorService ( client: networkClient) ,
152- themeStyles: FeatureFlag . newGutenbergThemeStyles. enabled,
153- plugins: FeatureFlag . newGutenbergPlugins. enabled && isSelfHosted,
154- siteURL: post. blog. url ?? " " ,
155- siteApiRoot: siteApiRoot!,
156- siteApiNamespace: siteApiNamespace,
157- authHeader: authHeader
144+ content: post. content ?? " "
158145 )
146+ conf. postID = post. postID? . intValue != - 1 ? post. postID? . intValue : nil
147+ conf. postType = post is Page ? " page " : " post "
148+
149+ conf. siteURL = post. blog. url ?? " "
150+ conf. siteApiRoot = siteApiRoot ?? " "
151+ conf. siteApiNamespace = siteApiNamespace
152+ conf. authHeader = authHeader
153+
154+ conf. themeStyles = FeatureFlag . newGutenbergThemeStyles. enabled
155+ conf. plugins = FeatureFlag . newGutenbergPlugins. enabled && isSelfHosted
156+
157+ self . editorViewController = GutenbergKit . EditorViewController ( configuration: conf)
159158
160159 super. init ( nibName: nil , bundle: nil )
161160
@@ -415,28 +414,6 @@ extension NewGutenbergViewController: GutenbergKit.EditorViewControllerDelegate
415414 }
416415}
417416
418- private struct NewGutenbergNetworkClient : GutenbergKit . EditorNetworkingClient {
419- private let api : WordPressOrgRestApi ?
420-
421- init ( blog: Blog ) {
422- self . api = WordPressOrgRestApi ( blog: blog)
423- }
424-
425- func send( _ request: GutenbergKit . EditorNetworkRequest ) async throws -> GutenbergKit . EditorNetworkResponse {
426- guard let api else {
427- throw URLError ( . unknown) // Should never happen
428- }
429- // TODO: Add support for other requests
430- var path = request. url. absoluteString
431- guard path. hasPrefix ( " ./wp-json " ) else {
432- throw URLError ( . unknown) // Currently unsupported
433- }
434- path. removePrefix ( " ./wp-json " )
435-
436- throw URLError ( . unknown) // Should never happen
437- }
438- }
439-
440417// MARK: - GutenbergBridgeDelegate
441418
442419extension NewGutenbergViewController {
0 commit comments