admin管理员组文章数量:1316532
I am using Django CKEditor5 in my admin panel. When I'm trying to insert a html code using "Source Edit" feature,
it doesn't apply any style and transforms automatically after clicking "Source" button again into this:
I already tried the GeneralHtmlSupport from documentation: .html
My ckeditor config looks like this
ClassicEditor.create(
editorEl,
config,
{
plugins: [GeneralHtmlSupport, SourceEditing, Undo, Alignment, Image, ImageResizeEditing, ImageResizeHandles],
htmlSupport: {
allow: [
{
name: /.*/,
attributes: true,
classes: true,
styles: true
}
]
},
image: {
resizeUnit: "%",
styles: {
options: [
{ name: 'Resize', title: 'Resize', className: 'Resize' },
]
},
},
htmlSupport: true,
allowedContent: true
}
).then(editor => {
const textarea = document.querySelector(`#${editorEl.id}`);
editor.model.document.on('change:data', () => {
textarea.value = editor.getData();
});
if (editor.plugins.has('WordCount')) {
const wordCountPlugin = editor.plugins.get('WordCount');
const wordCountWrapper = element.querySelector(`#${script_id}-word-count`);
wordCountWrapper.innerHTML = '';
wordCountWrapper.appendChild(wordCountPlugin.wordCountContainer);
}
editors[editorEl.id] = editor;
if (callbacks[editorEl.id]) {
callbacks[editorEl.id](editor);
}
}).catch(error => {
console.error((error));
});
editorEl.setAttribute('data-processed', '1');
});
window.editors = editors;
I am using Django CKEditor5 in my admin panel. When I'm trying to insert a html code using "Source Edit" feature,
it doesn't apply any style and transforms automatically after clicking "Source" button again into this:
I already tried the GeneralHtmlSupport from documentation: https://ckeditor/docs/ckeditor5/latest/features/html/general-html-support.html
My ckeditor config looks like this
ClassicEditor.create(
editorEl,
config,
{
plugins: [GeneralHtmlSupport, SourceEditing, Undo, Alignment, Image, ImageResizeEditing, ImageResizeHandles],
htmlSupport: {
allow: [
{
name: /.*/,
attributes: true,
classes: true,
styles: true
}
]
},
image: {
resizeUnit: "%",
styles: {
options: [
{ name: 'Resize', title: 'Resize', className: 'Resize' },
]
},
},
htmlSupport: true,
allowedContent: true
}
).then(editor => {
const textarea = document.querySelector(`#${editorEl.id}`);
editor.model.document.on('change:data', () => {
textarea.value = editor.getData();
});
if (editor.plugins.has('WordCount')) {
const wordCountPlugin = editor.plugins.get('WordCount');
const wordCountWrapper = element.querySelector(`#${script_id}-word-count`);
wordCountWrapper.innerHTML = '';
wordCountWrapper.appendChild(wordCountPlugin.wordCountContainer);
}
editors[editorEl.id] = editor;
if (callbacks[editorEl.id]) {
callbacks[editorEl.id](editor);
}
}).catch(error => {
console.error((error));
});
editorEl.setAttribute('data-processed', '1');
});
window.editors = editors;
Share
Improve this question
edited Jan 31 at 7:20
neonbones
asked Jan 30 at 9:48
neonbonesneonbones
234 bronze badges
0
1 Answer
Reset to default 0did you try this in CKEDITOR_5_CONFIGS
...
"extends": {
...
"htmlSupport": {"allow": [{"name": "/.*/", "attributes": True, "classes": True, "styles": True}]},
...
}
...
本文标签: ckeditorDjangoCKEditor5 Source Editing Feature Doesn39t WorkStack Overflow
版权声明:本文标题:ckeditor - Django-CKEditor5 Source Editing Feature Doesn't Work - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741974928a2408063.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论