From 3a6ca5b68d090b3637cb925a4442f5990327a2b3 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 01 Jun 2012 02:59:01 -0400
Subject: [PATCH] Update to TinyMCE 3.5.2

---
 program/js/tiny_mce/plugins/table/editor_plugin_src.js |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/program/js/tiny_mce/plugins/table/editor_plugin_src.js b/program/js/tiny_mce/plugins/table/editor_plugin_src.js
index 832b5e9..ff095c8 100644
--- a/program/js/tiny_mce/plugins/table/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/table/editor_plugin_src.js
@@ -287,6 +287,21 @@
 				endX = startX + (cols - 1);
 				endY = startY + (rows - 1);
 			} else {
+				startPos = endPos = null;
+
+				// Calculate start/end pos by checking for selected cells in grid works better with context menu
+				each(grid, function(row, y) {
+					each(row, function(cell, x) {
+						if (isCellSelected(cell)) {
+							if (!startPos) {
+								startPos = {x: x, y: y};
+							}
+
+							endPos = {x: x, y: y};
+						}
+					});
+				});
+
 				// Use selection
 				startX = startPos.x;
 				startY = startPos.y;
@@ -599,6 +614,9 @@
 				else
 					dom.insertAfter(row, targetRow);
 			});
+
+			// Remove current selection
+			dom.removeClass(dom.select('td.mceSelected,th.mceSelected'), 'mceSelected');
 		};
 
 		function getPos(target) {
@@ -1227,7 +1245,7 @@
 						for (last = ed.getBody().lastChild; last && last.nodeType == 3 && !last.nodeValue.length; last = last.previousSibling) ;
 
 						if (last && last.nodeName == 'TABLE')
-							ed.dom.add(ed.getBody(), 'p', null, '<br mce_bogus="1" />');
+							ed.dom.add(ed.getBody(), 'p', null, '<br data-mce-bogus="1" />');
 					};
 
 					// Fixes an bug where it's impossible to place the caret before a table in Gecko
@@ -1265,7 +1283,7 @@
 					ed.onPreProcess.add(function(ed, o) {
 						var last = o.node.lastChild;
 
-						if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR')
+						if (last && last.childNodes.length == 1 && last.firstChild.nodeName == 'BR' && last.previousSibling && last.previousSibling.nodeName == "TABLE")
 							ed.dom.remove(last);
 					});
 

--
Gitblit v1.9.1