Install Blk42 plugin for CKEditor 5
Blk42 adds Bootstrap and Tailwind grids to your CKEditor 5: insert a block with the grid layout you pick, edit the grid, fill the block with content and save it as a template for later.
Plugin
Install NPM package
Blk42 is part of the N1ED plugin for CKEditor 5, one npm package that is easy to add into your existing CKEditor 5 build project for further compilation. Your Blk42 API key switches on the blocks. If you buy N1ED later, its file manager and image editor join the same build with no rebuild.
npm install --save-dev @edsdk/n1ed-ckeditor5Moving from
@edsdk/blk42-ckeditor5? Replace it, don't add to it: remove its import and theBlk42entry fromplugins. An old version left in the build next to N1ED stops CKEditor 5 before it starts (two plugins namedBlk42).Include to build
Add N1ED into your import section:
import {
ClassicEditor,
Image,
Essentials,
Paragraph,
Bold,
Italic
} from 'ckeditor5';
import N1ED from "@edsdk/n1ed-ckeditor5";Then pass it to the
pluginssection of yourClassicEditorcreation method call and set the API key:ClassicEditor.create(
document.querySelector('#editor'), // your editor selector
{
licenseKey: "GPL", // or your commercial key: CKEditor 5 v44+ will not start without one
plugins: [
Essentials,
Paragraph,
Bold,
Italic,
N1ED
],
apiKey: "BL42B5RRdemodemodemodemo", // the demo key; yours is 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 the newly added plugin.
If you see a new bottom toolbar of the editor, everything works fine.
Ready to Use
Ready-to-Use Bundle
Download
The ready-to-use CKEditor 5 bundle already contains the Blk42 plugin, precompiled and enabled, with Bootstrap or Tailwind layouts from the start. Just download and use it, HTML sample included.
Download 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 the 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 your own key in the Dashboard: https://blk42.com/dashboard
}
}
);
</script>Ready to Use
CDN
Add the CDN Script
One script loads CKEditor 5 with the Blk42 plugin enabled and preconfigured, always the latest version.
<!-- Load CKEditor 5 with Blk42 -->
<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 your own key 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
Configuration
Configure your Blk42 CKEditor 5 installation in the Dashboard: set the Bootstrap or Tailwind options and share your custom blocks between your websites, all without touching the code.
Blk42 uses the editor's own image upload settings. For blocks together with a file manager and an image editor in one plugin, use N1ED.
DashboardExamples
Live CodePlay examples for CKEditor 5 with the JS/CSS/HTML code provided.