From 60a79649f2a5f85d82af923e48cdf1cc895e9b10 Mon Sep 17 00:00:00 2001
From: Dennis1993 <marvin-wegener@outlook.com>
Date: Fri, 26 Jul 2013 07:33:44 -0400
Subject: [PATCH] Update Socket.php

---
 program/js/tiny_mce/plugins/directionality/editor_plugin_src.js |   48 +++++++++++++++++++++++++++---------------------
 1 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/program/js/tiny_mce/plugins/directionality/editor_plugin_src.js b/program/js/tiny_mce/plugins/directionality/editor_plugin_src.js
index 81818e3..b134014 100644
--- a/program/js/tiny_mce/plugins/directionality/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/directionality/editor_plugin_src.js
@@ -1,8 +1,11 @@
 /**
- * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
+ * editor_plugin_src.js
  *
- * @author Moxiecode
- * @copyright Copyright � 2004-2008, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
  */
 
 (function() {
@@ -12,30 +15,33 @@
 
 			t.editor = ed;
 
-			ed.addCommand('mceDirectionLTR', function() {
-				var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
+			function setDir(dir) {
+				var dom = ed.dom, curDir, blocks = ed.selection.getSelectedBlocks();
 
-				if (e) {
-					if (ed.dom.getAttrib(e, "dir") != "ltr")
-						ed.dom.setAttrib(e, "dir", "ltr");
-					else
-						ed.dom.setAttrib(e, "dir", "");
+				if (blocks.length) {
+					curDir = dom.getAttrib(blocks[0], "dir");
+
+					tinymce.each(blocks, function(block) {
+						// Add dir to block if the parent block doesn't already have that dir
+						if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {
+							if (curDir != dir) {
+								dom.setAttrib(block, "dir", dir);
+							} else {
+								dom.setAttrib(block, "dir", null);
+							}
+						}
+					});
+
+					ed.nodeChanged();
 				}
+			}
 
-				ed.nodeChanged();
+			ed.addCommand('mceDirectionLTR', function() {
+				setDir("ltr");
 			});
 
 			ed.addCommand('mceDirectionRTL', function() {
-				var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
-
-				if (e) {
-					if (ed.dom.getAttrib(e, "dir") != "rtl")
-						ed.dom.setAttrib(e, "dir", "rtl");
-					else
-						ed.dom.setAttrib(e, "dir", "");
-				}
-
-				ed.nodeChanged();
+				setDir("rtl");
 			});
 
 			ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});

--
Gitblit v1.9.1