我真的需要摆脱图片插件中的这些属性,我只需要允许用户设置src,这就是全部,但我无法弄清楚这是怎么做的,因为javascript和ckeditor不是我强大的一面。有谁知道?
我正在使用CKEditor 4.3.1
答案 0 :(得分:5)
<强> HTML 强>
<textarea id="editor" name="editor1"><p>Initial value.</p></textarea>
<强>脚本强>
<script type="text/javascript">
CKEDITOR.on('dialogDefinition', function (ev) {
// Take the dialog name and its definition from the event data.
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
// Check if the definition is from the dialog we're
// interested in (the 'image' dialog).
if (dialogName == 'image') {
// Get a reference to the 'Image Info' tab.
var infoTab = dialogDefinition.getContents('info');
// Remove unnecessary widgets/elements from the 'Image Info' tab.
infoTab.remove('browse');
infoTab.remove('txtHSpace');
infoTab.remove('txtVSpace');
infoTab.remove('txtBorder');
infoTab.remove('txtAlt');
infoTab.remove('txtWidth');
infoTab.remove('txtHeight');
infoTab.remove('htmlPreview');
infoTab.remove('cmbAlign');
infoTab.remove('ratioLock');
}
});
CKEDITOR.replace('editor');
</script>
答案 1 :(得分:-2)
我建议您使用ckfinder浏览图片。 这是调用coeditor时使用的代码:
<script type="text/javascript">
//<![CDATA[
// This call can be placed at any point after the
// <textarea>, or inside a <head><script> in a
// window.onload event handler.
CKEDITOR.replace('testoEditor', {
filebrowserBrowseUrl : '../../ckfinder/ckfinder.html',
filebrowserImageBrowseUrl : '../../ckfinder/ckfinder.html?Type=Images',
width : '505',
height : '400',
});
//]]>
</script>