techlab23 / ckeditor5-svelte Goto Github PK
View Code? Open in Web Editor NEWckeditor5 editor component for svelte
Home Page: https://codesandbox.io/s/ckeditor5-svelte-demo-p2n4w
ckeditor5 editor component for svelte
Home Page: https://codesandbox.io/s/ckeditor5-svelte-demo-p2n4w
Hi,
Multiple instances are not allowed because DOM element id is fixed to "_editor".
To allow multiple instances a propose to pass id as a property.
I've done a fork with this change. We could do a PR?
https://github.com/obendi/ckeditor5-svelte
Thanks.
Problem
Line 42 of Ckeditor.svelte tries to set the read-only status with this piece of code: editor.isReadOnly = disabled;
.
This is not supported by CKEditor 5, because read-only has no setter. Read more here.
Screenshot of the error message
Suggested Solution
Since I don't see the purpose of disabling the editor anyway, I would suggest removing the line altogether.
<script>
import CKEditor from "ckeditor5-svelte";
// Setting up editor prop to be sent to wrapper component
let editor ;
// Reference to initialised editor instance
let editorInstance = null;
// Setting up any initial data for the editor
let editorData = "Hello World";
// If needed, custom editor config can be passed through to the component
// Uncomment the custom editor config if you need to customise the editor.
// Note: If you don't pass toolbar object then Document editor will use default set of toolbar items.
let editorConfig = {
toolbar: {
items: [
"heading",
"|",
"fontFamily",
"fontSize",
"bold",
"italic",
"underline",
],
},
};
onMount(async () => {
const module = await import(
"@ckeditor/ckeditor5-build-decoupled-document/build/ckeditor"
);
editor = module
console.log('_____',editor)
});
function onReady({ detail: editor }) {
// Insert the toolbar before the editable area.
editorInstance = editor;
editor.ui
.getEditableElement()
.parentElement.insertBefore(
editor.ui.view.toolbar.element,
editor.ui.getEditableElement()
);
}
</script>
<CKEditor
on:ready={onReady}
bind:config={editorConfig}
bind:value={editorData}
/>
I am getting Uncaught (in promise) TypeError: editor is null
How to use it in sapper ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.