📅  最后修改于: 2023-12-03 15:14:39.678000             🧑  作者: Mango
DecoupledEditor.create is a Javascript method that allows developers to create a decoupled editor instance. This method is a part of the CKEditor 5 framework and it is used to create editors that can be used in any web application.
To use DecoupledEditor.create, you will first need to include the required script files. Once you have done that, you can call the method with the necessary configuration options to create a new editor instance.
import { DecoupledEditor } from '@ckeditor/ckeditor5-build-decoupled-document';
DecoupledEditor.create( document.querySelector( '#editor' ), {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote' ],
language: 'en'
} )
.then( editor => {
console.log( 'Editor was initialized', editor );
} )
.catch( error => {
console.error( error.stack );
} );
In this example, we are using the DecoupledEditor.create method to create a new editor instance with a toolbar and specified language.
DecoupledEditor.create is a powerful Javascript method that allows developers to create rich-text editors quickly and efficiently. With its ease of use and customization options, it is a great option for any web application needing an editor function.