ckeditor5-pre-element
pre element (to write longer code snippets) for CKEditor 5. https://ckeditor.com
Example
There are CKEditor5 Builds available on there official page as
Classic editor, Inline editor, Balloon editor, Document editor
let assume Classic editor example
First, install the build from npm:
npm install --save @ckeditor/ckeditor5-build-classic
And use it in your website:
This is the editor content.
Or in your JavaScript application:
; // Or using the CommonJS version:// const ClassicEditor = require( '@ckeditor/ckeditor5-build-classic' ); ClassicEditor ;
Note: If you are planning to integrate CKEditor 5 deep into your application, it is actually more convenient and recommended to install and import the source modules directly (like it happens in ckeditor.js
). Read more in the Advanced setup guide.
Including ckeditor5-pre-element with classic editor
now install pre element
npm install ckeditor5-pre-element
open "ckeditor5-build-classic/src/ckeditor.js" source file where you can see imported packages. now import ckeditor5-pre-element as shown in below example and build.
// The editor creator to use.; ;;;;;;;;;;;;;;;; ; {} // Plugins to include in the build.ClassicEditorbuiltinPlugins = Essentials UploadAdapter Autoformat Bold Italic BlockQuote EasyImage Heading Image ImageCaption ImageStyle ImageToolbar ImageUpload Link PreElement List Paragraph; // Editor configuration.ClassicEditordefaultConfig = toolbar: items: 'heading' '|' 'bold' 'italic' 'link' 'bulletedList' 'numberedList' 'imageUpload' 'pre' 'blockQuote' 'undo' 'redo' image: toolbar: 'imageStyle:full' 'imageStyle:side' '|' 'imageTextAlternative' // This value must be kept in sync with the language defined in webpack.config.js. language: 'en';
After build you can see code block pre element icon in classic editor top bars.
Note: click on icon to insert/leave pre element in your editor.
Help to imporove this as i am new to this platform.
Thank you.
Licensed under the terms of GNU General Public License Version 2 or later. For full details about the license, please check the LICENSE.md
file.