django-ckeditor5源编辑功能不起作用

问题描述 投票:0回答:1

再次单击“源”按钮后,它不应用任何样式并自动转换: enter image description here

我已经从文档中尝试了GeneralHtmlSupport:

Https://ckeditor.com/docs/ckeditor5/latest/features/html/html/general-html-support.htmlenter image description here 我的CKeditor配置看起来像这样

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;

did您在ckeditor_5_configs

中尝试此尝试

... "extends": { ... "extraPlugins": ["GeneralHtmlSupport"], "sourceEditing": {"allowedStyles": True}, # Allow editing inline styles "htmlSupport": { # General HTML Support plugin "allow": [ { "name": ".*", # Allow all elements "attributes": True, # Allow all attributes "classes": True, # Allow all classes "styles": True, # Allow all inline styles } ] }, ... } ...
    
django ckeditor ckeditor5 django-ckeditor
1个回答
0
投票
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.