我正在尝试修改CKEditor中对话框的HTML。每个框内的HTML都是绝对的噩梦,更糟糕的是,源代码被压缩,并且不清楚执行的路径是什么。
我想采取这样的方式:
<div class="cke_dialog_ui_select" id="44_uiElement" role="presentation"><label style="" for="42_select" id="43_label" class="cke_dialog_ui_labeled_label">Link Type</label><div role="presentation" class="cke_dialog_ui_labeled_content"><select aria-labelledby="43_label" class="cke_dialog_ui_input_select" id="42_select"><option value="url"> URL</option><option value="anchor"> Link to anchor in the text</option><option value="email"> E-mail</option></select></div></div>
并将其变成更易读,更容易设计的内容,删除其中一个div。它们分别用于图像和锚点对话框(模态对话框)。
感谢您的帮助。
答案 0 :(得分:1)
等等,你真的想在编辑器里编辑HTML文件吗?
有精湛的api和文档。当文档说它比以往任何时候都好100%更清晰时,不值得在此进行描述。如果您尝试自定义对话框here's the documentation.
所有api的all of the documentation,如何等等。
如果你还需要帮助,请告诉我一个问题。
答案 1 :(得分:1)
这是我对这个问题的主张。
var htmlId=dialog.getContentElement( 'tabId', 'htmlElement' ).domId;
document.getElementById(htmlId).innerHTML='<img src="happy_face.jpg"/>';
我必须说文档在正确的方法上有点模糊。如果有人有更好的解决方案,我很高兴看到。
http://docs.ckeditor.com/#!/api/CKEDITOR.dialog.definition.html
我使用原生javascript,但它很可能是jquery。
var htmlId=dialog.getContentElement( 'tabId', 'htmlElement' ).domId;
$("#"+htmlId).html('<img src="happy_face.jpg"/>');