The part where you have to destroy the ref i dont get it. I'm trying to follow along using typescript and when i create my editor component and i call it... It renders it like 4 times and when i try to add the line where you destroy the ref.current my code breaks
can I get the orginal code cause I tried a lot but I didn't even get up with running the Editor Js, let alone the further things in the video. Please can I get your original code and not some other reference code? please
How do you resolve the errors of typescript about types of modules like table, chekclist and others? I only found types for @editorjs/editorjs__header.
I'm using Neovim, and this is my own custom configuration which you can find here: kavin.me/dots Honestly, I would suggest to start off just use vim keybindings in VSCode or ay other code editor that you use to just get used to the motions.
Nvm my question. My problem was that I had the Editor as part of a map function. So there were more then 1 editors on a page. I changed my code around and got it working now. Here the adjusted code for more editors on a single page. import React, { useState, useEffect, useRef } from "react"; import dynamic from 'next/dynamic'; export default function Editor() { const [isMounted, setIsMounted] = useState(false); const ref = useRef(); const initializeEditor = async () => { const EditorJS = (await import("@editorjs/editorjs")).default const Header = (await import("@editorjs/header")).default if (ref.current) { const editor = new EditorJS({ holder: ref.current, tools: { header: Header, }, }); ref.current = editor } }; useEffect(() => { if (typeof window !== "undefined") { setIsMounted(true); } }, []) useEffect(() => { const init = async () => { await initializeEditor(); }; if (isMounted) { init(); return () => { if (ref.current) { ref.current.destroy(); } } } }, [isMounted]) const save = () => { if (ref.current) { ref.current.save().then((outputData) => { console.log(outputData) }) } } return (
Thanks dude. I am facing one issue Heading in editor are not big, their size is same as normal text. Did you face this issue? Edit: I got the fix, Tailwind CSS was overriding h1 style
Oh man, I'm so sorry. I thought I'd posted a Github Link in the description and deleted the directory. The code is somewhat similar to this component written by @joshtriedcoding so you can check that out instead if it helps github.com/joschan21/breadit/blob/master/src/components/Editor.tsx
my goat, right when i needed to build an editor
Even I am using Editor.JS in my project and it's brilliant. Ended up building custom renderers for almost all the tools and it looks perfect.
It is a pretty good setup and much lightweight compared to the ones which existed before. Obviously all have different use cases but yes
@@livecode247 Yeah, I agree
thanks, this video helped a lot. all those dynamic imports were important
The part where you have to destroy the ref i dont get it. I'm trying to follow along using typescript and when i create my editor component and i call it... It renders it like 4 times and when i try to add the line where you destroy the ref.current my code breaks
can I get the orginal code cause I tried a lot but I didn't even get up with running the Editor Js, let alone the further things in the video. Please can I get your original code and not some other reference code? please
what nextjs version ?
How do you resolve the errors of typescript about types of modules like table, chekclist and others? I only found types for @editorjs/editorjs__header.
Ya they don't exist unfortunately, just // @ts-ignore them for now
Could we please get the code?
Bro what's your vim setup like, I'm trying to get into vim. Could you help me out or point me in the right direction
I'm using Neovim, and this is my own custom configuration which you can find here: kavin.me/dots
Honestly, I would suggest to start off just use vim keybindings in VSCode or ay other code editor that you use to just get used to the motions.
Awesome tutorial 💯💯 but how to render text by providing JSON data?
Thank you so much! I'm pretty sure that's part of the video
how to change text color?
your EditorJS stopped???
@@andreyuriel3305 editorjs dose not suppoert nextjs server side rendering, i weill try another
Nvm my question. My problem was that I had the Editor as part of a map function. So there were more then 1 editors on a page. I changed my code around and got it working now. Here the adjusted code for more editors on a single page.
import React, { useState, useEffect, useRef } from "react";
import dynamic from 'next/dynamic';
export default function Editor() {
const [isMounted, setIsMounted] = useState(false);
const ref = useRef();
const initializeEditor = async () => {
const EditorJS = (await import("@editorjs/editorjs")).default
const Header = (await import("@editorjs/header")).default
if (ref.current) {
const editor = new EditorJS({
holder: ref.current,
tools: {
header: Header,
},
});
ref.current = editor
}
};
useEffect(() => {
if (typeof window !== "undefined") {
setIsMounted(true);
}
}, [])
useEffect(() => {
const init = async () => {
await initializeEditor();
};
if (isMounted) {
init();
return () => {
if (ref.current) {
ref.current.destroy();
}
}
}
}, [isMounted])
const save = () => {
if (ref.current) {
ref.current.save().then((outputData) => {
console.log(outputData)
})
}
}
return (
Save
)
};
Thank you for sharing!
Thanks dude.
I am facing one issue
Heading in editor are not big, their size is same as normal text.
Did you face this issue?
Edit: I got the fix, Tailwind CSS was overriding h1 style
@@Himanshuyadav-us6me Hi, I'm facing the same problem how to counter the overriding?
which code editor is that?
That's Neovim!
can i do the same using django?
Not sure how well it works but you can look at this: github.com/2ik/django-editorjs-fields
hey can i get link to that code !!
Oh man, I'm so sorry. I thought I'd posted a Github Link in the description and deleted the directory. The code is somewhat similar to this component written by @joshtriedcoding so you can check that out instead if it helps
github.com/joschan21/breadit/blob/master/src/components/Editor.tsx
You magician..
Thank you!
Notiion use EditorJS
Nice video. I reached out on LinkedIn.
Thank you!
discord?
Here it is: kavinvalli
@@livecode247 no i mean server like any community?
Oh, no 😔. Not that big yet lol