Saturday, 28 December 2024

How to use fckeditor

 <!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>CKEditor 5 - Quick start CDN</title>

<link rel="stylesheet" href="https://cdn.ckeditor.com/ckeditor5/44.1.0/ckeditor5.css">

<style>

.main-container {

width: 795px;

margin-left: auto;

margin-right: auto;

}

</style>

</head>

<body>

<div class="main-container">

<div id="editor">

<p>Hello from CKEditor 5!</p>

</div>

</div>

<script src="https://cdn.ckeditor.com/ckeditor5/44.1.0/ckeditor5.umd.js"></script>

<script>

const {

ClassicEditor,

Essentials,

Paragraph,

Bold,

Italic,

Font

} = CKEDITOR;

// Create a free account and get <YOUR_LICENSE_KEY>

// https://portal.ckeditor.com/checkout?plan=free

ClassicEditor

.create( document.querySelector( '#editor' ), {

licenseKey: '<YOUR_LICENSE_KEY>',

plugins: [ Essentials, Paragraph, Bold, Italic, Font ],

toolbar: [

'undo', 'redo', '|', 'bold', 'italic', '|',

'fontSize', 'fontFamily', 'fontColor', 'fontBackgroundColor'

]

} )

.then( editor => {

window.editor = editor;

} )

.catch( error => {

console.error( error );

} );

</script>

</body>

</html>