1、ckeditor初始化
html:
<script src="ckeditor/ckeditor.js"></script>
<div id="editor"></div>
js :
<script>
if(CKEDITOR.env.ie && CKEDITOR.env.version < 9)
CKEDITOR.tools.enableHtml5Elements(document);
CKEDITOR.config.height = '420';
CKEDITOR.config.width = 'auto';
var initSample = (function() {
var wysiwygareaAvailable = isWysiwygareaAvailable(),
isBBCodeBuiltIn = !!CKEDITOR.plugins
.get('bbcode');
return function() {
var editorElement = CKEDITOR.document.getById('editor');
if(isBBCodeBuiltIn) {
editorElement.setHtml('Hello world!\n\n' +
'I\'m an instance of [url=http://ckeditor.com]CKEditor[/url].');
}
if(wysiwygareaAvailable) {
CKEDITOR.replace('editor');
} else {
editorElement.setAttribute('contenteditable', 'true');
CKEDITOR.inline('editor');
}
};
function isWysiwygareaAvailable() {
if(CKEDITOR.revision == ('%RE' + 'V%')) {
return true;
}
return !!CKEDITOR.plugins.get('wysiwygarea');
}})();
</script>
<script>
initSample();
</script>