Below shows the ckeditor config in used.
Below is the CKEditor config in use.
A few strange behaviors are being observed:
- The snippet result below shows that h1 becomes h2, but style="font-size:22px;" is kept.
- In the local environment, h1 is still there, but the style="font-size:22px;" was dropped from h1.
- In the local environment, the first
in the root will be converted to
Any explanation about above?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<style>
#container {
width: 1000px;
margin: 20px auto;
}
.ck-editor__editable[role="textbox"] {
/* editing area */
min-height: 200px;
}
.ck-content .image {
/* block images */
max-width: 80%;
margin: 20px auto;
}
</style>
<div id="container">
<div id="editor">
</div>
</div>
<script src="https://cdn.ckeditor.com/ckeditor5/36.0.1/super-build/ckeditor.js"></script>
<script>
CKEDITOR.ClassicEditor.create(document.getElementById("editor"), {
toolbar: {
items: [
'sourceEditing'
],
shouldNotGroupWhenFull: true
},
htmlSupport: {
allow: [
{
name: /.*/,
attributes: true,
classes: true,
styles: true
}
]
},
removePlugins: [
'CKBox',
'CKFinder',
'EasyImage',
'RealTimeCollaborativeComments',
'RealTimeCollaborativeTrackChanges',
'RealTimeCollaborativeRevisionHistory',
'PresenceList',
'Comments',
'TrackChanges',
'TrackChangesData',
'RevisionHistory',
'Pagination',
'WProofreader',
'MathType'
]
}).then(editor => {
let mydata = '<h1 style="font-size:22px;"><span>hi</span>hello world</h1>';
editor.setData(mydata)
});
</script>
</body>
</html>
Found out that the issue is due to