From e4ffd59324afe92f11c1586565aa79c33cd6e357 Mon Sep 17 00:00:00 2001
From: Olga Lytvynenko <olytvynenko@magento.com>
Date: Fri, 4 Nov 2016 12:19:04 +0200
Subject: [PATCH] MAGETWO-58617: [GitHub] WYSIWYG editor loses data after
 show-hide editor #5811

---
 lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js
index 2c4ab52b896..306c9557e64 100755
--- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js
+++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js
@@ -329,8 +329,9 @@ define([
 
         encodeDirectives: function(content) {
             // collect all HTML tags with attributes that contain directives
-            return content.gsub(/<([a-z0-9\-\_]+.+?)([a-z0-9\-\_]+=".*?\{\{.+?\}\}.*?".+?)>/i, function(match) {
+            return content.gsub(/\<([a-z0-9\-\_]+.+?)([a-z0-9\-\_]+=".*?\{\{.+?\}\}.*?".*?)>/i, function(match) {
                 var attributesString = match[2];
+
                 // process tag attributes string
                 attributesString = attributesString.gsub(/([a-z0-9\-\_]+)="(.*?)(\{\{.+?\}\})(.*?)"/i, function(m) {
                     return m[1] + '="' + m[2] + this.makeDirectiveUrl(Base64.mageEncode(m[3])) + m[4] + '"';
-- 
GitLab