-
-
Save arcdev1/aba0fcea9f618de42ca399e3266f42aa to your computer and use it in GitHub Desktop.
// A custom React Hook for using CKEditor with SSR | |
// particularly with NextJS. | |
// https://ckeditor.com | https://nextjs.org | |
import React, { useRef, useState, useEffect } from 'react' | |
export default function useCKEditor () { | |
const editorRef = useRef() | |
const [isEditorLoaded, setIsEditorLoaded] = useState(false) | |
const { CKEditor, InlineEditor } = editorRef.current || {} | |
useEffect(() => { | |
editorRef.current = { | |
// CKEditor: require('@ckeditor/ckeditor5-react'), // depricated in v3 | |
CKEditor: require('@ckeditor/ckeditor5-react').CKEditor // v3+ | |
InlineEditor: require('@ckeditor/ckeditor5-build-inline') | |
} | |
setIsEditorLoaded(true) | |
}, []) | |
return Object.freeze({ | |
isEditorLoaded, | |
CKEditor, | |
InlineEditor | |
}) | |
} |
Hi, can you show how to add plugin like Alliment to ckeditor ? :s I tried some ways but it not work. It show nothing and text not change when I change heading on menu editor
Did you find any way to add plugins?
Hi, can you show how to add plugin like Alliment to ckeditor ? :s I tried some ways but it not work. It show nothing and text not change when I change heading on menu editor
Did you find any way to add plugins?
I changed to use ckeditor5 :) Its more easy
Hi, can you show how to add plugin like Alliment to ckeditor ? :s I tried some ways but it not work. It show nothing and text not change when I change heading on menu editor
Did you find any way to add plugins?
I changed to use ckeditor5 :) Its more easy
how import plugin in ssr with ckeditor5 ?
So how do we now use this
getting this error:
Unhandled Runtime Error
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `MyEditor`.
Hey @yelnyaface ... try the updated code above, it seems there was a breaking change in v3.
require is not defined
Hi, can you show how to add plugin like Alliment to ckeditor ? :s I tried some ways but it not work. It show nothing and text not change when I change heading on menu editor