Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with WordPress 6.6 #260

Open
rafaucau opened this issue Jul 16, 2024 · 8 comments
Open

Not working with WordPress 6.6 #260

rafaucau opened this issue Jul 16, 2024 · 8 comments

Comments

@rafaucau
Copy link

rafaucau commented Jul 16, 2024

ref: #254

After updating to WordPress 6.6, the Isolated Block Editor is not working. Error in the console:

Uncaught Error: You tried to opt-in to unstable APIs without confirming you know the consequences. This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on the next WordPress release.
    at __dangerousOptInToUnstableAPIsOnlyForCoreModules (private-apis.js?ver=53100b466d825a8b9022:115:11)
    at ../../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_4lglvpqjpsedbgvkrr4wlluyyq/node_modules/@automattic/isolated-block-editor/build-module/components/block-editor/unlock.js (unlock.js:7:53)
    at __webpack_require__ (chunk loaded:30:1)
    at ../../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_4lglvpqjpsedbgvkrr4wlluyyq/node_modules/@automattic/isolated-block-editor/build-module/components/block-editor/sidebar-heading.js (post-text-editor.js:114:1)
    at __webpack_require__ (chunk loaded:30:1)
    at ../../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_4lglvpqjpsedbgvkrr4wlluyyq/node_modules/@automattic/isolated-block-editor/build-module/components/block-editor/sidebar.js (sidebar-heading.js:41:1)
    at __webpack_require__ (chunk loaded:30:1)
    at ../../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_4lglvpqjpsedbgvkrr4wlluyyq/node_modules/@automattic/isolated-block-editor/build-module/components/block-editor/index.js (footer.js:44:1)
    at __webpack_require__ (chunk loaded:30:1)
    at ../../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_4lglvpqjpsedbgvkrr4wlluyyq/node_modules/@automattic/isolated-block-editor/build-module/components/block-editor-contents/index.js (editor-content.js:45:1)

Opt-in string was changed in WordPress/gutenberg#62635, so ISO Editor also needs to update it

@johngodley
Copy link
Member

Yes, it is not compatible with WP 6.6

@rafaucau
Copy link
Author

I did for a test search replace all occurrences of I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress. on I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress. in the package files, and it seems to work. Only the toolbar styles are messed up.

@lihsaa591
Copy link

Yes, it is not compatible with WP 6.6

Is there any info about the new update? Compatible with WP6.6? @johngodley

@johngodley
Copy link
Member

Is there any info about the new update? Compatible with WP6.6

No, there is no info.

@imrantushar
Copy link

We are also facing same issues

@lihsaa591
Copy link

I make a workaround by overriding private-api.js and now it's working.

@lihsaa591
Copy link

if ( version_compare( get_bloginfo( 'version' ), '6.6', '>=' ) ) { $suffix = SCRIPT_DEBUG ? '.js' : '.min.js'; wp_deregister_script( 'wp-private-apis' ); wp_register_script( 'wp-private-apis', plugins_url( 'libs/private-apis' . $suffix, PLUGIN_FILE ), array(), PLUGIN_VERSION, true ); }

Download private-api.js from the previous WP and add it to your plugin folder.

@rafaucau
Copy link
Author

rafaucau commented Jul 17, 2024

Here is my workaround:

  1. Install replace-in-file: npm i replace-in-file.
  2. Create fix-iso-editor.json:
{
	"files": "node_modules/@automattic/isolated-block-editor/**/*",
	"from": "I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress",
	"to": "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress"
}
  1. Add postinstall script to package.json:
"postinstall": "replace-in-file --configFile=fix-iso-editor.json"
  1. Run npm install.

Full package.json example:

{
	"private": true,
	"scripts": {
		"dev": "wp-scripts start",
		"dev:hot": "wp-scripts start --hot",
		"build": "wp-scripts build",
		"postinstall": "replace-in-file --configFile=fix-iso-editor.json"
	},
	"dependencies": {
		"@automattic/isolated-block-editor": "^2.29.0",
		"replace-in-file": "^8.1.0"
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants