From cf1735450495dca00d21fecabcc59225fdae5497 Mon Sep 17 00:00:00 2001
From: Eric Rasmussen <ericrasmussen1@gmail.com>
Date: Thu, 18 Apr 2013 15:15:51 -0500
Subject: [PATCH] [gh-1] Fix Unl.hasParentNodeWithClass for plain text nodes

---
 plugins/unl/editor_plugin.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/unl/editor_plugin.js b/plugins/unl/editor_plugin.js
index 748a55f..06daedb 100644
--- a/plugins/unl/editor_plugin.js
+++ b/plugins/unl/editor_plugin.js
@@ -5,7 +5,7 @@
 var Unl = {};
 
 Unl.hasParentNodeWithClass = function(childNode, parentClass) {
-	for (var selectedNode = childNode; selectedNode.id != 'maincontent'; selectedNode = selectedNode.parentNode) {
+	for (var selectedNode = childNode; selectedNode.id != 'maincontent' && !selectedNode.body; selectedNode = selectedNode.parentNode) {
 		if (typeof selectedNode.className !== 'undefined' && selectedNode.className.search(parentClass) >= 0) {
 			return selectedNode;
 		}
@@ -453,4 +453,4 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
 
 	// Register plugin
 	tinymce.PluginManager.add('unl', tinymce.plugins.UnlPlugin);
-})();
\ No newline at end of file
+})();
-- 
GitLab