--- a/includes/clientside/tinymce/plugins/safari/editor_plugin_src.js Thu Jan 31 22:29:07 2008 -0500
+++ b/includes/clientside/tinymce/plugins/safari/editor_plugin_src.js Sat Feb 02 11:54:16 2008 -0500
@@ -2,7 +2,7 @@
* $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $
*
* @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
*/
(function() {
@@ -43,21 +43,13 @@
ed.getDoc().execCommand("Delete", false, ' ');
});
- // Workaround for List ID bug, http://bugs.webkit.org/show_bug.cgi?id=16004
-/* function addList(c) {
- var cb = Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) {
- e = e.target;
-
- if (e.nodeName == 'OL' || e.nodeName == 'UL')
- e.id = '';
- });
-
- ed.getDoc().execCommand(c, false, false);
- Event.remove(ed.getDoc(), 'DOMNodeInserted', cb);
- };
-
- ed.addCommand('InsertUnorderedList', function() {addList('InsertUnorderedList');});
- ed.addCommand('InsertOrderedList', function() {addList('InsertOrderedList');});*/
+ // Workaround for missing shift+enter support, http://bugs.webkit.org/show_bug.cgi?id=16973
+ ed.onKeyPress.add(function(ed, e) {
+ if (e.keyCode == 13 && e.shiftKey) {
+ t._insertBR(ed);
+ Event.cancel(e);
+ }
+ });
// Safari returns incorrect values
ed.addQueryValueHandler('FontSize', function(u, v) {
@@ -392,6 +384,27 @@
});
}
};
+ },
+
+ _insertBR : function(ed) {
+ var dom = ed.dom, s = ed.selection, r = s.getRng(), br;
+
+ // Insert BR element
+ r.insertNode(br = dom.create('br'));
+
+ // Place caret after BR
+ r.setStartAfter(br);
+ r.setEndAfter(br);
+ s.setRng(r);
+
+ // Could not place caret after BR then insert an nbsp entity and move the caret
+ if (s.getSel().focusNode == br.previousSibling) {
+ s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'), br));
+ s.collapse(1);
+ }
+
+ // Scroll to new position, scrollIntoView can't be used due to bug: http://bugs.webkit.org/show_bug.cgi?id=16117
+ ed.getWin().scrollTo(0, dom.getPos(s.getRng().startContainer).y);
}
});