Fixed bug #14830: htmlArea RTE: Entering line breaks with Safari not possible
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 28 Jun 2010 19:23:12 +0000 (19:23 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Mon, 28 Jun 2010 19:23:12 +0000 (19:23 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8071 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js

index d49bf57..4bfd038 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-28  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #14830: htmlArea RTE: Entering line breaks with Safari not possible
+
 2010-06-27  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #14886: htmlArea RTE: Incorrect function scope when error is raised
index e42f1ff..3f38852 100644 (file)
@@ -1,3 +1,7 @@
+2010-06-28  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #14830: htmlArea RTE: Entering line breaks with Safari not possible
+
 2010-06-27  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #14886: htmlArea RTE: Incorrect function scope when error is raised
index 16698d7..82a8491 100644 (file)
@@ -1069,8 +1069,8 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
        setOptions: function () {
                if (!Ext.isIE) {
                        try {
-                               if (this.document.queryCommandEnabled('insertbronreturn')) {
-                                       this.document.execCommand('insertbronreturn', false, this.config.disableEnterParagraphs);
+                               if (this.document.queryCommandEnabled('insertBrOnReturn')) {
+                                       this.document.execCommand('insertBrOnReturn', false, this.config.disableEnterParagraphs);
                                }
                                if (this.document.queryCommandEnabled('styleWithCSS')) {
                                        this.document.execCommand('styleWithCSS', false, this.config.useCSS);
@@ -1334,7 +1334,23 @@ HTMLArea.Iframe = Ext.extend(Ext.BoxComponent, {
                        return false;
                }
                if (event.shiftKey || this.config.disableEnterParagraphs) {
-                       this.getEditor()._detectURL(event);
+                       var editor = this.getEditor();
+                       editor._detectURL(event);
+                       if (Ext.isSafari) {
+                               var brNode = editor.document.createElement('br');
+                               editor.insertNodeAtSelection(brNode);
+                               brNode.parentNode.normalize();
+                                       // Selection issue when an URL was detected
+                               if (editor._unlinkOnUndo) {
+                                       brNode = brNode.parentNode.parentNode.insertBefore(brNode, brNode.parentNode.nextSibling);
+                               }
+                               if (!brNode.nextSibling || !/\S+/i.test(brNode.nextSibling.textContent)) {
+                                       var secondBrNode = editor.document.createElement('br');
+                                       secondBrNode = brNode.parentNode.appendChild(secondBrNode);
+                               }
+                               editor.selectNode(brNode, false);
+                               event.stopEvent();
+                       }
                }
                        // Update the toolbar state after some time
                this.getToolbar().updateLater.delay(200);