Hi guys!
I'm working on functionality to edit documents in discrete chunks. To conclude one section and start another a double-tap of the key would be needed. For this, one instance of the editor should be closed and another instance should open.
Now I've got the instance to destroy itself when the second enter is input- however I would really love to remove or disable the placement of te next new line. I've tried canceling the event but it still places a new line anyway.
Here is the code I have so far:
<script> var enterkey = false; var currentPara; // Turn off automatic editor creation first CKEDITOR.disableAutoInline = true; CKEDITOR.on('instanceCreated', function(e) { e.editor.on('key', function(evt) { if(evt.data.keyCode == 13) { if (enterkey) { enterkey = false; // [[Save editor contents and create new editor instance]] // Attempts to prevent a return showing up CKEDITOR.keystrokeHandler.blockedKeystrokes = [13]; evt.preventDefault(); evt.cancel(); // Destroy current editor evt.editor.destroy(); currentPara.setAttribute("contenteditable", "false"); return false; } else enterkey = true; } else enterkey = false; }); }); </script>