Comments (5)
Hi,
According to the log, the code is running in the NodeJS environment where Element
is not defined as well as other browser APIs.
EditorJS is a client library, so you need to set up your project to not run EditorJS code on the server.
Closing the issue as it is not an EditorJS bug
from editor.js.
@fzsf163 Could you share your solution?
yes sure.
the components that require to be rendered on client must be inside <ClientOnly/>
, And if you have say a file named Component.tsx
that has imports (like say editor js) that needs to be rendered on client, you simply name it Component.client.tsx
, this *.client.tsx
forces remix to render that components entirely on client side. To make it render only server side just change the *.client.tsx
to *.server.tsx
. Then when you call that component on any file and put that inside <ClientOnly>{ ()=> (<Component/>) }<ClientOnly/>
. Install remix-utls to get client-only component.
Example :
Editor.client.tsx
import EditorJS from "@editorjs/editorjs";
export default function Editor() {
const editor = new EditorJS({
/**
* Id of Element that should contain the Editor
*/
holder: "editorjs",
/**
* Available Tools list.
* Pass Tool's class or Settings object for each Tool you want to use
*/
});
return <div id="editorjs"></div>;
}
then I <Editor/>
inside Blog-Page.tsx
route
import { ClientOnly } from "remix-utils/client-only";
import Editor from "~/components/EditorJS.client"
<ClientOnly fallback={<p>Loading Editor Please Wait...</p>}>
{() => (
<Editor></Editor>
)}
</ClientOnly>
from editor.js.
Hi, According to the log, the code is running in the NodeJS environment where
Element
is not defined as well as other browser APIs. EditorJS is a client library, so you need to set up your project to not run EditorJS code on the server.Closing the issue as it is not an EditorJS bug
thank you sir, I will look into it.
from editor.js.
I fixed it. Now it renders.
from editor.js.
@fzsf163 Could you share your solution?
from editor.js.
Related Issues (20)
- I18n configuration doesn't seem to work for block tunes HOT 1
- Scrolls to the top of the page when focused on some select element
- Tunes with wrappers aren't calling didMutated, when changing tune value
- URL is not being treated as a url HOT 2
- Features playground and JSON output
- toc sidebar for navigating through long note
- Empty output if the content is only a single emoji
- keyboard backspace does not work with editor js list. the content gets removed but the numbers still persist. how to overcome this?
- Svelte 5 - 'Element is not defined' HOT 1
- Extend inline tools
- Extend inline tools HOT 1
- Clear formatting
- Adanced block tunes in sidebar HOT 1
- Not possible to reorder built-in toolbar actions HOT 3
- editor.js in vscode extension webview throw error
- Can not delete new line on quote block HOT 2
- Issue: Multiple Instances of EditorJS Created in React with Vite and TypeScript
- Feature: auto link
- Link text doesn't work when it's in bold
- Unexpected Closure of Toolbar in Nested Editor.js Editors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from editor.js.