+ if (s.force_p_newlines) {\r
+ if (!isIE) {\r
+ ed.onKeyPress.add(function(ed, e) {\r
+ if (e.keyCode == 13 && !e.shiftKey && !t.insertPara(e))\r
+ Event.cancel(e);\r
+ });\r
+ } else {\r
+ // Ungly hack to for IE to preserve the formatting when you press\r
+ // enter at the end of a block element with formatted contents\r
+ // This logic overrides the browsers default logic with\r
+ // custom logic that enables us to control the output\r
+ tinymce.addUnload(function() {\r
+ t._previousFormats = 0; // Fix IE leak\r
+ });\r
+\r
+ ed.onKeyPress.add(function(ed, e) {\r
+ t._previousFormats = 0;\r
+\r
+ // Clone the current formats, this will later be applied to the new block contents\r
+ if (e.keyCode == 13 && !e.shiftKey && ed.selection.isCollapsed() && s.keep_styles)\r
+ t._previousFormats = cloneFormats(ed.selection.getStart());\r
+ });\r
+\r
+ ed.onKeyUp.add(function(ed, e) {\r
+ // Let IE break the element and the wrap the new caret location in the previous formats\r
+ if (e.keyCode == 13 && !e.shiftKey) {\r
+ var parent = ed.selection.getStart(), fmt = t._previousFormats;\r
+\r
+ // Parent is an empty block\r
+ if (!parent.hasChildNodes()) {\r
+ parent = dom.getParent(parent, dom.isBlock);\r
+\r
+ if (parent) {\r
+ parent.innerHTML = '';\r
+ \r
+ if (t._previousFormats) {\r
+ parent.appendChild(fmt.wrapper);\r
+ fmt.inner.innerHTML = '\uFEFF';\r
+ } else\r
+ parent.innerHTML = '\uFEFF';\r
+\r
+ selection.select(parent, 1);\r
+ ed.getDoc().execCommand('Delete', false, null);\r
+ }\r
+ }\r
+ }\r
+ });\r
+ }\r