Created | ![]() |
Favourites | Opened | Upvotes | Comments |
26. Apr 2019 | 0 | 0 | 132 | 0 | 0 |
CKPopover is a commercial CKEditor 5 plugin that allows us to create popovers (or tooltips) for any text element in CKEditor 5 - much like eg. Bootstrap popover.
Index :
If you have not built a CKEditor 5 before, please see "Building CKEditor 5 From Source" to learn how to build CKEditor 5. Otherwise read on and learn how to implement CKPro Popover.
{
"dependencies": {
"@ckeditor/ckeditor5-editor-classic": "x",
"@ckeditor/ckeditor5-essentials": "x",
"@ckeditor/ckeditor5-heading": "x",
"@ckeditor/ckeditor5-link": "x",
"@ckeditor/ckeditor5-list": "x",
"@ckeditor/ckeditor5-basic-styles": "x",
"@ckeditor/ckeditor5-theme-lark": "x",
"@ckpro/ckeditor5-popover": "x"
},
"devDependencies": {
"@ckeditor/ckeditor5-dev-utils": "x",
"postcss-loader": "3.0.0",
"raw-loader": "4.0.1",
"style-loader": "1.2.1",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12"
}
}
// app.js
import ClassicEditorBase from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import Heading from '@ckeditor/ckeditor5-heading/src/heading';
import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
import Link from '@ckeditor/ckeditor5-link/src/link';
import List from '@ckeditor/ckeditor5-list/src/list';
import Popover from '@ckpro/ckeditor5-popover'; // ADD THIS (1/3)
export default class ClassicEditor extends ClassicEditorBase { }
ClassicEditor
.create(document.querySelector('#editor'), {
plugins: [Heading,
Essentials,
Bold,
Link,
List,
Popover // ADD THIS (2/3)
],
toolbar: [
'heading',
'bold',
'link',
'bulletedList',
'numberedList',
'popover' // ADD THIS (3/3)
],
})
.then(editor => {
window.editor = editor;
})
.catch(error => {
console.error(error.stack);
});
<!-- edit.html -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CKEditor 5 - with CKPro Popover Plugin</title>
</head>
<body>
<!-- ADD THIS (1/2) -->
<div id="editor">
<p>Editor content goes here</p>
</div>
<script src="dist/bundle.js"></script> <!-- ADD THIS (2/2) -->
</body>
</html>
<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CKEditor 5 - with CKPro Popover plugin</title>
<!-- ADD THIS (1/4) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- ADD THIS (2/4) -->
<style>
.ckpro-popover-client:after {
content: "\003F";
position: relative;
font-weight: bold;
font-size: 1rem;
color: #aaa;
top: -3px;
left: -3px;
}
</style>
<!-- ADD THIS (3/4) -->
<script>
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll('span[data-ckpro-popover]').forEach(elm => {
elm.classList.add("ckpro-popover-client");
$(elm).popover({
trigger: "hover",
placement: "top",
html: true,
content: function () {
return this.getAttribute("data-ckpro-popover");
}
});
});
});
</script>
</head>
<body>
<!-- ADD THIS (4/4) -->
Editor <span data-ckpro-popover="Content can be many things in CKEditor 5">content</span> goes here.
</body>
</html>
That's all.
CKPro Popover is protected by a commercial license and MUST be purchased be fore use.
There are 3 licenses :
For all licenses you are allowed to use the plugin or a derivative as part of a projekt that you sell or sell access to, it does not matter if you have 1 user or a million users of your projekt.
For all licenses you are allowed to change the source code, however if the source code change you forfeit CKPro ALL support on that particular plugin.
For all licenses any number of developers can work with the plugin.
Please contact Rasmus Rummel on email : rasmusrummel@gmail.com to obtain a license.