Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
8 changes: 8 additions & 0 deletions ReactApp/src/components/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ObserveTyping,
} from '@wordpress/block-editor';
import { Popover } from '@wordpress/components';
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
import { registerCoreBlocks } from '@wordpress/block-library';
import { parse, serialize, registerBlockType } from '@wordpress/blocks';

Expand Down Expand Up @@ -75,6 +76,13 @@ function Editor() {
window.editor = editor;
registerCoreBlocks();
postMessage("onEditorLoaded");

return () => {
window.editor = {};
getBlockTypes().forEach((block) => {
unregisterBlockType(block.name);
});
};
}, []);

const settings = {
Expand Down
4 changes: 4 additions & 0 deletions Sources/GutenbergKit/Sources/EditorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public final class EditorViewController: UIViewController, GutenbergEditorContro
])

webView.alpha = 0

if #available(iOS 16.4, *) {
webView.isInspectable = true
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what's the implication of making a web view inspectable, but I decided to keep it off by default. The app enables it in the debug mode.

Copy link
Member Author

Choose a reason for hiding this comment

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

I interpet "debug mode" to mean the scheme configuration for running the app. I have that enabled, but the web view does not display as inspectable for me in Safari. Am I missing something?

Xcode Scheme Safari Inspector
run-with-debug no-inspectable-applications

Copy link
Contributor

@kean kean Jul 10, 2024

Choose a reason for hiding this comment

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

Ah, I forgot I only enabled it in the jpios/wpios apps but not in this demo. I suggest enabling it in the demo project instead of the package itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

I moved this to the Demo if you don't mind – merging.

}

// TODO: register it when editor is loaded
// service.$rawBlockTypesResponseData.compactMap({ $0 }).sink { [weak self] data in
Expand Down