Install Blk42 in CKEditor 5
Blk42 adds Bootstrap/Tailwind layout features to your editor implementing best practices of CKEditor 5. Then you can insert a new block with selected grid layout, edit the grid, fill the block with contents, and save blocks as templates for future use.
Plugin
Install NPM package
Blk42 plugin is distributed in an NPM package that is easy to add into your existing CKEditor 5 build project for further compilation.
npm install --save-dev @edsdk/blk42-ckeditor5Include to build
Add Blk42 into your import section:
import {
ClassicEditor,
Image,
Essentials,
Paragraph,
Bold,
Italic
} from 'ckeditor5';
import Blk42 from "@edsdk/blk42-ckeditor5";Then pass this plugin to the
pluginssection of yourClassicEditorcreation method call and set the API key:ClassicEditor.create(
document.querySelector('#editor'), // your editor selector
{
plugins: [
Essentials,
Paragraph,
Bold,
Italic,
Blk42
],
Blk42: {
// apiKey: "...",
// Get in the Dashboard: https://blk42.com/dashboard
}
}
).then( editor => {
console.log(editor);
} ).catch( error => {
console.error(error.stack);
} );Build
Build your CKEditor 5 project or your project with CKEditor 5 imported to apply newly added plugin.
If you see a new bottom toolbar of the editor, everything works fine.
Ready to Use
CKEditor 5 Bundle
Download
Ready-to-Use CKEditor 5 bundle already contains Blk42 plugin precompiled and enabled and has support of Bootstrap or Tailwind layout from the scratch. Just download and use it, HTML sample included.
Download CKEditor 5 BundleUnpack
The archive contains the compiled build and a ready-made sample page:
build/
ckeditor5-blk42.js
ckeditor5-blk42.js.map
sample/
index.html
styles.cssOpen
sample/index.htmlright from your disk to see the editor running — no webserver needed. When you are ready to install it, copybuild/ckeditor5-blk42.jssomewhere into your webserver public directory, for example:var/
www/
public/
js/
ckeditor5-blk42.jsThe
.mapfile is optional: it is what turns a minified stack trace back into readable line numbers if you ever need to report a problem.Attach to content box
Add script link onto your page and initialize CKEditor 5 there attaching it to the textarea or some div with the content you want to edit.
<script src="/js/ckeditor5-blk42.js"></script>
<script type="text/javascript">
CKEditor5WithBlk42.create(
document.querySelector('#editorId'),
{
Blk42: {
// apiKey: "...",
// Get in the Dashboard: https://blk42.com/dashboard
}
}
);
</script>Ready to Use
CDN
Add the CDN Script
Script snippet provides quick loading of CKEditor 5 with Blk42 plugin enabled and preconfigured.
<!-- Load CKEditor 5 with Blk42 plugin -->
<script src="https://cloud.n1ed.com/v/latest/sdk/ckeditor5-blk42.js"></script>
<!-- Your editor placeholder -->
<div id="editorId"></div>
<script type="text/javascript">
CKEditor5WithBlk42.create(
document.querySelector('#editorId'),
{
Blk42: {
// apiKey: "...",
// Get in the Dashboard: https://blk42.com/dashboard
}
}
);
</script>Blk42 is part of the N1ED family — its scripts are served from N1ED's cloud,
cloud.n1ed.com, the one loader every product of the family shares.Ready to Use