我不確定CKEditor是否允許你想要的行爲。我建議調查猛禽編輯器 - http://www.raptor-editor.com/
我已經把如何與選擇,將保證編輯器不會嘗試解決無效的HTML實例猛禽一個例子 - JSFiddle。
猛禽實例是:
<textarea id="raptor">
<table>
<tbody>$GarbagePailKids</tbody>
</table>
</textarea>
<script type="text/javascript">
$('#raptor').editor({
// Enable editor immediately
autoEnable: true,
// Replace the element with the editor
replace: true,
// Disable the cancel, save & dock buttons
disabledUi: ['cancel', 'save', 'dock'],
// Disable the unsaved edits warning, and the clean & empty element plugins, both of which will attempt to fix broken HTML
disabledPlugins: ['unsavedEditWarning', 'clean', 'emptyElement'],
// Disable the "you have unsaved edits on this page" warning triggered when one attempts to leave the page after editing
unloadWarning: false,
// Plugin specific options
plugins: {
// Docking options forcing the editor to be always docked to the textarea
dock: {
docked: true,
dockToElement: true,
persistent: false
}
}
});
</script>
無論如何,瀏覽器通常會嘗試糾正無效的HTML。
我應該指出,我不需要編輯器中的Velocity模板解析,只是單獨留下足夠好的能力將是完美的。 – 2012-08-09 23:35:51