Inline editor
Inline editor lets you create your content directly in its target location with the help of a floating toolbar that appears when the editable text is focused.
In this example the image styles configuration was changed to enable left- and right-aligned images.
Gone traveling
Monthly travel news and inspiration
# Editor example configuration
Check out the Quick start guide to learn more about implementing this kind of editor. You will find implementation steps there. You can see this example editor’s code below.
View editor configuration script
import InlineEditor from '@ckeditor/ckeditor5-build-inline';
const inlineInjectElements = document.querySelectorAll( '#snippet-inline-editor [data-inline-inject]' );
Array.from( inlineInjectElements ).forEach( inlineElement => {
const config = {
toolbar: {
items: [
'undo', 'redo',
'|', 'heading',
'|', 'bold', 'italic',
'|', 'link', 'insertImage', 'insertTable', 'mediaEmbed',
'|', 'bulletedList', 'numberedList', 'outdent', 'indent'
]
},
cloudServices: {
// All predefined builds include the Easy Image feature.
// Provide correct configuration values to use it.
tokenUrl: 'https://example.com/cs-token-endpoint',
uploadUrl: 'https://your-organization-id.cke-cs.com/easyimage/upload/'
// Read more about Easy Image - https://ckeditor.com/docs/ckeditor5/latest/features/images/image-upload/easy-image.html.
// For other image upload methods see the guide - https://ckeditor.com/docs/ckeditor5/latest/features/images/image-upload/image-upload.html.
},
};
if ( inlineElement.tagName.toLowerCase() == 'header' ) {
config.removePlugins = [
'Blockquote',
'Image',
'ImageCaption',
'ImageStyle',
'ImageToolbar',
'ImageUpload',
'List',
'EasyImage',
'CKFinder',
'CKFinderUploadAdapter'
];
config.toolbar.items = [ 'heading', '|', 'bold', 'italic', 'link' ];
} else {
config.image = {
toolbar: [
'imageStyle:inline',
'imageStyle:wrapText',
'imageStyle:breakText',
'|',
'toggleImageCaption',
'imageTextAlternative'
]
};
}
InlineEditor
.create( inlineElement, config )
.then( editor => {
window.editor = editor;
} )
.catch( err => {
console.error( err );
} );
} );
View editor content listing
<div id="snippet-inline-editor">
<header data-inline-inject="true">
Editor content is inserted here.
</header>
<div data-inline-inject="true">
Editor content is inserted here.
</div>
<div class="demo-row">
<div class="demo-row__half">
<div data-inline-inject="true">
Editor content is inserted here.
</div>
</div>
<div class="demo-row__half">
<div data-inline-inject="true">
Editor content is inserted here.
</div>
</div>
</div>
</div>
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.