Closed zammitjames closed 1 year ago
There isn't a demo of it being used in NextJS - it's not something that has been specifically tried.
You might find information about that error elsewhere. For example:
https://josipmisko.com/next-js/global-css-cannot-be-imported-from-files-other-than-your-custom-app
Right. Tried with code:
'use client'
import React from 'react'
import IsolatedBlockEditor from '@automattic/isolated-block-editor'
import '@automattic/isolated-block-editor/build-browser/core.css';
import '@automattic/isolated-block-editor/build-browser/isolated-block-editor.css';
const settings = {
iso: {
moreMenu: false,
},
}
const Page = () => {
return (
<div>
<h1>Editor</h1>
<IsolatedBlockEditor
settings={ settings }
onLoad={ ( parser, rawHandler ) => {
console.log( 'parser: ', parser )
console.log( 'rawHandler: ', rawHandler )
// onLoad( textarea.value, parser, rawHandler )
} }
onSaveContent={ ( content ) => {
console.log( 'onContentSave' )
// saveBlocks( content, textarea )
} }
onError={ () => {
console.log( 'error' )
// document.location.reload()
} }
>
</IsolatedBlockEditor>
</div>
)
}
export default Page
But not works.
Even instead of:
import IsolatedBlockEditor from '@automattic/isolated-block-editor'
with:
const IsolatedBlockEditor = dynamic(
() => import('@automattic/isolated-block-editor'),
{ ssr: false }
)
But no success.
Sorry, NextJS is not something I have experience with and can't really offer any advice.
There are a lot of search results for the same error so all I can suggest is to investigate those.
I'll close this issue, but it's here if anyone else knows anything more.
Is there a basic demo example of importing the Isolated Block Editor and having it render in a fresh new NextJS app?
When I try to do this in NextJS v13 I get the following error: