ATLAS-4611 : (UI)Add text-editor for string attribute value of Business Metadata and for description field while creating Classification and Business Metadata

Signed-off-by: Pinal Shah <pinal.shah@freestoneinfotech.com>
diff --git a/dashboardv2/public/css/scss/override.scss b/dashboardv2/public/css/scss/override.scss
index f98c7fc..7a14abf 100644
--- a/dashboardv2/public/css/scss/override.scss
+++ b/dashboardv2/public/css/scss/override.scss
@@ -573,7 +573,7 @@
     margin-right: 0px !important;
 }
 
-.glossary-longdescription-wrapper {
+.longdescription-wrapper {
     display: inline-block;
     height: 100px;
     background-color: #fff !important;
@@ -616,4 +616,10 @@
 
 .user-circle {
     display: inline;
+}
+
+.business-metadata-detail-attr {
+    ul {
+        list-style: disc
+    }
 }
\ No newline at end of file
diff --git a/dashboardv2/public/css/scss/texteditor.scss b/dashboardv2/public/css/scss/texteditor.scss
index 275bdcc..e05cf4d 100644
--- a/dashboardv2/public/css/scss/texteditor.scss
+++ b/dashboardv2/public/css/scss/texteditor.scss
@@ -19,14 +19,29 @@
 
 .trumbowyg {
     border-radius: 4px !important;
-    min-height: 150px !important;
+    min-height: 106px !important;
 
     .trumbowyg-button-pane {
-        background-color: #f6f7fb !important;
+        background: none;
+        border-bottom: none;
+        position: absolute;
+        bottom: 0px;
+
+        button {
+            transition: none;
+        }
+    }
+
+    .trumbowyg-button-pane-hidden {
+        display: none;
+    }
+
+    .trumbowyg-button-pane::after {
+        background: none !important;
     }
 
     .trumbowyg-editor {
-        min-height: 150px !important;
+        min-height: 70px !important;
         overflow-wrap: break-word;
     }
 
@@ -35,7 +50,19 @@
     }
 
     .trumbowyg-textarea {
-        min-height: 150px !important;
+        min-height: 106px !important;
+    }
+
+    .trumbowyg-button-pane .trumbowyg-button-group::after {
+        height: 25px;
+        vertical-align: middle;
+    }
+
+    .trumbowyg-button-pane button.trumbowyg-active,
+    .trumbowyg-button-pane button:not(.trumbowyg-disable):focus,
+    .trumbowyg-button-pane button:not(.trumbowyg-disable):hover {
+        background-color: #e8e9ee;
+        border-radius: 20px;
     }
 }
 
@@ -62,15 +89,31 @@
     width: 101px !important;
 }
 
-.trumbowyg-h1-dropdown-button{
+.trumbowyg-h1-dropdown-button {
     font-size: 36px !important;
 }
-.trumbowyg-h2-dropdown-button{
+
+.trumbowyg-h2-dropdown-button {
     font-size: 30px !important;
 }
-.trumbowyg-h3-dropdown-button{
+
+.trumbowyg-h3-dropdown-button {
     font-size: 24px !important;
 }
-.trumbowyg-h4-dropdown-button{
+
+.trumbowyg-h4-dropdown-button {
     font-size: 18px !important;
+}
+
+.small-texteditor {
+    .trumbowyg-button-pane button {
+        width: 25px !important;
+        height: 25px !important;
+    }
+    .trumbowyg-button-pane button.trumbowyg-active,
+    .trumbowyg-button-pane button:not(.trumbowyg-disable):focus,
+    .trumbowyg-button-pane button:not(.trumbowyg-disable):hover {
+        background-color: #e8e9ee;
+        border-radius: 20px;
+    }
 }
\ No newline at end of file
diff --git a/dashboardv2/public/js/external_lib/trumbowyg/trumbowyg.js b/dashboardv2/public/js/external_lib/trumbowyg/trumbowyg.js
index 7ef6d17..fca7664 100644
--- a/dashboardv2/public/js/external_lib/trumbowyg/trumbowyg.js
+++ b/dashboardv2/public/js/external_lib/trumbowyg/trumbowyg.js
@@ -9,4 +9,4 @@
  *         Twitter : @AlexandreDemode
  *         Website : alex-d.fr
  */
-jQuery.trumbowyg={langs:{en:{viewHTML:"Plain Text",undo:"Undo",redo:"Redo",formatting:"Formatting",p:"Paragraph",blockquote:"Quote",code:"Code",header:"Header",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",underline:"Underline",strong:"Strong",em:"Emphasis",del:"Deleted",superscript:"Superscript",subscript:"Subscript",unorderedList:"Unordered list",orderedList:"Ordered list",insertImage:"Insert Image",link:"Link",createLink:"Insert link",unlink:"Remove link",justifyLeft:"Align Left",justifyCenter:"Align Center",justifyRight:"Align Right",justifyFull:"Align Justify",horizontalRule:"Insert horizontal rule",removeformat:"Remove format",fullscreen:"Fullscreen",close:"Close",submit:"Confirm",reset:"Cancel",required:"Required",description:"Description",title:"Title",text:"Text",target:"Target",width:"Width"}},plugins:{},svgPath:null,svgAbsoluteUseHref:!1,hideButtonTexts:null},Object.defineProperty(jQuery.trumbowyg,"defaultOptions",{value:{lang:"en",fixedBtnPane:!1,fixedFullWidth:!1,autogrow:!1,autogrowOnEnter:!1,imageWidthModalEdit:!1,hideButtonTexts:null,prefix:"trumbowyg-",tagClasses:{},semantic:!0,semanticKeepAttributes:!1,resetCss:!1,removeformatPasted:!1,tabToIndent:!1,tagsToRemove:[],tagsToKeep:["hr","img","embed","iframe","input"],btns:[["viewHTML"],["undo","redo"],["formatting"],["strong","em","del"],["superscript","subscript"],["link"],["insertImage"],["justifyLeft","justifyCenter","justifyRight","justifyFull"],["unorderedList","orderedList"],["horizontalRule"],["removeformat"],["fullscreen"]],btnsDef:{},changeActiveDropdownIcon:!1,inlineElementsSelector:"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u",pasteHandlers:[],plugins:{},urlProtocol:!1,minimalLinks:!1,defaultLinkTarget:void 0,svgPath:null},writable:!1,enumerable:!0,configurable:!1}),function(l,d,c,u){"use strict";var g="tbwconfirm",h="tbwcancel";u.fn.trumbowyg=function(e,t){var n="trumbowyg";if(e===Object(e)||!e)return this.each(function(){u(this).data(n)||u(this).data(n,new o(this,e))});if(1===this.length)try{var a=u(this).data(n);switch(e){case"execCmd":return a.execCmd(t.cmd,t.param,t.forceCss,t.skipTrumbowyg);case"openModal":return a.openModal(t.title,t.content);case"closeModal":return a.closeModal();case"openModalInsert":return a.openModalInsert(t.title,t.fields,t.callback);case"saveRange":return a.saveRange();case"getRange":return a.range;case"getRangeText":return a.getRangeText();case"restoreRange":return a.restoreRange();case"enable":return a.setDisabled(!1);case"disable":return a.setDisabled(!0);case"toggle":return a.toggle();case"destroy":return a.destroy();case"empty":return a.empty();case"html":return a.html(t)}}catch(e){}return!1};var o=function(e,t){var n=this,a="trumbowyg-icons",o=u.trumbowyg;n.doc=e.ownerDocument||c,n.$ta=u(e),n.$c=u(e),null!=(t=t||{}).lang||null!=o.langs[t.lang]?n.lang=u.extend(!0,{},o.langs.en,o.langs[t.lang]):n.lang=o.langs.en,n.hideButtonTexts=(null!=o.hideButtonTexts?o:t).hideButtonTexts;var r,i=(null!=o.svgPath?o:t).svgPath;n.hasSvg=!1!==i,!1===i||!o.svgAbsoluteUseHref&&0!==u("#"+a,n.doc).length||(null==i&&u("script[src]").each(function(e,t){var n=t.src,t=n.match("trumbowyg(.min)?.js");null!=t&&(i=n.substring(0,n.indexOf(t[0]))+"ui/icons.svg")}),null==i?console.warn("You must define svgPath: https://goo.gl/CfTY9U"):o.svgAbsoluteUseHref||((r=n.doc.createElement("div")).id=a,n.doc.body.insertBefore(r,n.doc.body.childNodes[0]),u.ajax({async:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"xml",crossDomain:!0,url:i,data:null,beforeSend:null,complete:null,success:function(e){r.innerHTML=(new XMLSerializer).serializeToString(e.documentElement)}})));var s=n.doc.querySelector("base")?d.location.href.split(/[?#]/)[0]:"";n.svgPath=o.svgAbsoluteUseHref?i:s;a=n.lang.header,s=function(){return(d.chrome||d.Intl&&Intl.v8BreakIterator)&&"CSS"in d};n.btnsDef={viewHTML:{fn:"toggle",class:"trumbowyg-not-disable",name1:"name1"},undo:{isSupported:s,key:"Z"},redo:{isSupported:s,key:"Y"},p:{fn:"formatBlock"},blockquote:{fn:"formatBlock"},h1:{fn:"formatBlock",title:a+" 1"},h2:{fn:"formatBlock",title:a+" 2"},h3:{fn:"formatBlock",title:a+" 3"},h4:{fn:"formatBlock",title:a+" 4"},h5:{fn:"formatBlock",title:a+" 5"},h6:{fn:"formatBlock",title:a+" 6"},subscript:{tag:"sub"},superscript:{tag:"sup"},bold:{key:"B",tag:"b"},italic:{key:"I",tag:"i"},underline:{tag:"u"},strikethrough:{tag:"strike"},strong:{fn:"bold",key:"B"},em:{fn:"italic",key:"I"},del:{fn:"strikethrough"},createLink:{key:"K",tag:"a"},unlink:{},insertImage:{},justifyLeft:{tag:"left",forceCss:!0},justifyCenter:{tag:"center",forceCss:!0},justifyRight:{tag:"right",forceCss:!0},justifyFull:{tag:"justify",forceCss:!0},unorderedList:{fn:"insertUnorderedList",tag:"ul"},orderedList:{fn:"insertOrderedList",tag:"ol"},horizontalRule:{fn:"insertHorizontalRule"},removeformat:{},fullscreen:{class:"trumbowyg-not-disable"},close:{fn:"destroy",class:"trumbowyg-not-disable"},formatting:{dropdown:["p","h1","h2","h3","h4"],ico:"p"},link:{dropdown:["createLink","unlink"]}},n.o=u.extend(!0,{},o.defaultOptions,t),n.o.hasOwnProperty("imgDblClickHandler")||(n.o.imgDblClickHandler=n.getDefaultImgDblClickHandler()),n.urlPrefix=n.setupUrlPrefix(),n.disabled=n.o.disabled||"TEXTAREA"===e.nodeName&&e.disabled,t.btns?n.o.btns=t.btns:n.o.semantic||(n.o.btns[3]=["bold","italic","underline","strikethrough"]),u.each(n.o.btnsDef,function(e,t){n.addBtnDef(e,t)}),n.eventNamespace="trumbowyg-event",n.keys=[],n.tagToButton={},n.tagHandlers=[],n.pasteHandlers=[].concat(n.o.pasteHandlers),n.isIE=-1!==l.userAgent.indexOf("MSIE")||-1!==l.appVersion.indexOf("Trident/"),n.isMac=-1!==l.platform.toUpperCase().indexOf("MAC"),n.init()};o.prototype={DEFAULT_SEMANTIC_MAP:{b:"strong",i:"em",s:"del",strike:"del",div:"p"},init:function(){var e=this;e.height=e.$ta.height(),e.initPlugins();try{e.doc.execCommand("enableObjectResizing",!1,!1),e.doc.execCommand("defaultParagraphSeparator",!1,"p")}catch(e){}e.buildEditor(),e.buildBtnPane(),e.fixedBtnPaneEvents(),e.buildOverlay(),setTimeout(function(){e.disabled&&e.setDisabled(!0),e.$c.trigger("tbwinit")})},addBtnDef:function(e,t){this.btnsDef[e]=u.extend(t,this.btnsDef[e]||{})},setupUrlPrefix:function(){var e=this.o.urlProtocol;if(e)return"string"!=typeof e?"https://":e.replace("://","")+"://"},buildEditor:function(){var a=this,t=a.o.prefix,e="";a.$box=u("<div/>",{class:t+"box "+t+"editor-visible "+t+a.o.lang+" trumbowyg"}),a.isTextarea=a.$ta.is("textarea"),a.isTextarea?(e=a.$ta.val(),a.$ed=u("<div/>"),a.$box.insertAfter(a.$ta).append(a.$ed,a.$ta)):(a.$ed=a.$ta,e=a.$ed.html(),a.$ta=u("<textarea/>",{name:a.$ta.attr("id"),height:a.height}).val(e),a.$box.insertAfter(a.$ed).append(a.$ta,a.$ed),a.syncCode()),a.$ta.addClass(t+"textarea").attr("tabindex",-1),a.$ed.addClass(t+"editor").attr({contenteditable:!0,dir:a.lang._dir||"ltr"}).html(e),a.o.tabindex&&a.$ed.attr("tabindex",a.o.tabindex),a.$c.is("[placeholder]")&&a.$ed.attr("placeholder",a.$c.attr("placeholder")),a.$c.is("[spellcheck]")&&a.$ed.attr("spellcheck",a.$c.attr("spellcheck")),a.o.resetCss&&a.$ed.addClass(t+"reset-css"),a.o.autogrow||a.$ta.add(a.$ed).css({height:a.height}),a.semanticCode(),a.o.autogrowOnEnter&&a.$ed.addClass(t+"autogrow-on-enter");var n,o=!1,r=!1;a.$ed.on("dblclick","img",a.o.imgDblClickHandler).on("keydown",function(e){var t=e.which;if(8!==t&&13!==t&&46!==t||a.toggleSpan(!0),!e.ctrlKey&&!e.metaKey||e.altKey){if(a.o.tabToIndent&&"Tab"===e.key)try{return e.shiftKey?a.execCmd("outdent",!0,null):a.execCmd("indent",!0,null),!1}catch(e){}}else{o=!0;var n=a.keys[String.fromCharCode(e.which).toUpperCase()];try{return a.execCmd(n.fn,n.param),!1}catch(e){}}}).on("compositionstart compositionupdate",function(){r=!0}).on("keyup compositionend",function(e){if("compositionend"===e.type)r=!1;else if(r)return;var t=e.which;37<=t&&t<=40||(8!==t&&13!==t&&46!==t||a.toggleSpan(),!e.ctrlKey&&!e.metaKey||89!==t&&90!==t?o||17===t?void 0===e.which&&a.semanticCode(!1,!1,!0):(e=!a.isIE||"compositionend"===e.type,a.semanticCode(!1,e&&13===t),a.$c.trigger("tbwchange")):(a.semanticCode(!1,!0),a.$c.trigger("tbwchange")),setTimeout(function(){o=!1},50))}).on("mouseup keydown keyup",function(e){(e.ctrlKey||e.metaKey)&&!e.altKey||setTimeout(function(){o=!1},50),clearTimeout(n),n=setTimeout(function(){a.updateButtonPaneStatus()},50)}).on("focus blur",function(e){"blur"===e.type&&a.clearButtonPaneStatus(),a.$c.trigger("tbw"+e.type),a.o.autogrowOnEnter&&(a.autogrowOnEnterDontClose||("focus"===e.type?(a.autogrowOnEnterWasFocused=!0,a.autogrowEditorOnEnter()):a.o.autogrow||(a.$ed.css({height:a.$ed.css("min-height")}),a.$c.trigger("tbwresize"))))}).on("keyup focus",function(){a.$ta.val().match(/<.*>/)||a.$ed.html().match(/<.*>/)||setTimeout(function(){var e=a.isIE?"<p>":"p";a.doc.execCommand("formatBlock",!1,e),a.syncCode()},0)}).on("cut drop",function(){setTimeout(function(){a.semanticCode(!1,!0),a.$c.trigger("tbwchange")},0)}).on("paste",function(n){if(a.o.removeformatPasted){n.preventDefault(),d.getSelection&&d.getSelection().deleteFromDocument&&d.getSelection().deleteFromDocument();try{var t=d.clipboardData.getData("Text");try{a.doc.selection.createRange().pasteHTML(t)}catch(e){a.doc.getSelection().getRangeAt(0).insertNode(a.doc.createTextNode(t))}a.$c.trigger("tbwchange",n)}catch(e){a.execCmd("insertText",(n.originalEvent||n).clipboardData.getData("text/plain"))}}u.each(a.pasteHandlers,function(e,t){t(n)}),setTimeout(function(){a.semanticCode(!1,!0),a.$c.trigger("tbwpaste",n),a.$c.trigger("tbwchange")},0)}),a.$ta.on("keyup",function(){a.$c.trigger("tbwchange")}).on("paste",function(){setTimeout(function(){a.$c.trigger("tbwchange")},0)}),u(a.doc.body).on("keydown."+a.eventNamespace,function(e){if(27===e.which&&1<=u("."+t+"modal-box").length)return a.closeModal(),!1})},autogrowEditorOnEnter:function(){var e=this;e.$ed.removeClass("autogrow-on-enter");var t=e.$ed[0].clientHeight;e.$ed.height("auto");var n=e.$ed[0].scrollHeight;e.$ed.addClass("autogrow-on-enter"),t!==n&&(e.$ed.height(t),setTimeout(function(){e.$ed.css({height:n}),e.$c.trigger("tbwresize")},0))},buildBtnPane:function(){var a=this,o=a.o.prefix,r=a.$btnPane=u("<div/>",{class:o+"button-pane"});u.each(a.o.btns,function(e,t){u.isArray(t)||(t=[t]);var n=u("<div/>",{class:o+"button-group "+(0<=t.indexOf("fullscreen")?o+"right":"")});u.each(t,function(e,t){try{a.isSupportedBtn(t)&&n.append(a.buildBtn(t))}catch(e){}}),0<n.html().trim().length&&r.append(n)}),a.$box.prepend(r)},buildBtn:function(e){var n,a=this,t=a.o.prefix,o=a.btnsDef[e],r=o.dropdown,i=null==o.hasIcon||o.hasIcon,s=a.lang[e]||e,l=u("<button/>",{type:"button",class:t+e+"-button "+(o.class||"")+(i?"":" "+t+"textual-button"),html:!o.name1&&a.hasSvg&&i?'<svg><use xlink:href="'+a.svgPath+"#"+t+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>':a.hideButtonTexts?"":o.text||o.title||a.lang[e]||e,title:(o.title||o.text||s)+(o.key?" ("+(a.isMac?"Cmd":"Ctrl")+" + "+o.key+")":""),tabindex:-1,mousedown:function(){return r&&!u("."+e+"-"+t+"dropdown",a.$box).is(":hidden")||u("body",a.doc).trigger("mousedown"),(!a.$btnPane.hasClass(t+"disable")&&!a.$box.hasClass(t+"disabled")||u(this).hasClass(t+"active")||u(this).hasClass(t+"not-disable"))&&a.execCmd((!r?o.fn:"dropdown")||e,o.param||e,o.forceCss),!1}});return r?(l.addClass(t+"open-dropdown"),(s={class:(i=t+"dropdown")+"-"+e+" "+i+" "+t+"fixed-top "+(o.dropdownClass||"")})["data-"+i]=e,n=u("<div/>",s),u.each(r,function(e,t){a.btnsDef[t]&&a.isSupportedBtn(t)&&n.append(a.buildSubBtn(t))}),a.$box.append(n.hide())):o.key&&(a.keys[o.key]={fn:o.fn||e,param:o.param||e}),r||(a.tagToButton[(o.tag||e).toLowerCase()]=e),l},buildSubBtn:function(e){var t=this,n=t.o.prefix,a=t.btnsDef[e],o=null==a.hasIcon||a.hasIcon;return a.key&&(t.keys[a.key]={fn:a.fn||e,param:a.param||e}),t.tagToButton[(a.tag||e).toLowerCase()]=e,u("<button/>",{type:"button",class:n+e+"-dropdown-button "+(a.class||"")+(a.ico?" "+n+a.ico+"-button":""),html:t.hasSvg&&o?'<svg><use xlink:href="'+t.svgPath+"#"+n+(a.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>'+(a.text||a.title||t.lang[e]||e):a.text||a.title||t.lang[e]||e,title:a.key?"("+(t.isMac?"Cmd":"Ctrl")+" + "+a.key+")":null,style:a.style||null,mousedown:function(){return u("body",t.doc).trigger("mousedown"),t.execCmd(a.fn||e,a.param||e,a.forceCss),!1}})},isSupportedBtn:function(e){try{return this.btnsDef[e].isSupported()}catch(e){}return!0},buildOverlay:function(){return this.$overlay=u("<div/>",{class:this.o.prefix+"overlay"}).appendTo(this.$box),this.$overlay},showOverlay:function(){u(d).trigger("scroll"),this.$overlay.fadeIn(200),this.$box.addClass(this.o.prefix+"box-blur")},hideOverlay:function(){this.$overlay.fadeOut(50),this.$box.removeClass(this.o.prefix+"box-blur")},fixedBtnPaneEvents:function(){var o=this,r=o.o.fixedFullWidth,i=o.$box;o.o.fixedBtnPane&&(o.isFixed=!1,u(d).on("scroll."+o.eventNamespace+" resize."+o.eventNamespace,function(){var e,t,n,a;i&&(o.syncCode(),e=u(d).scrollTop(),t=i.offset().top+1,a=(n=o.$btnPane).outerHeight()-2,0<e-t&&e-t-o.height<0?(o.isFixed||(o.isFixed=!0,n.css({position:"fixed",top:0,left:r?0:"auto",zIndex:7}),o.$box.css({paddingTop:n.height()})),n.css({width:r?"100%":i.width()-1}),u("."+o.o.prefix+"fixed-top",i).css({position:r?"fixed":"absolute",top:r?a:e-t+a,zIndex:15})):o.isFixed&&(o.isFixed=!1,n.removeAttr("style"),o.$box.css({paddingTop:0}),u("."+o.o.prefix+"fixed-top",i).css({position:"absolute",top:a})))}))},setDisabled:function(e){var t=this,n=t.o.prefix;(t.disabled=e)?t.$ta.attr("disabled",!0):t.$ta.removeAttr("disabled"),t.$box.toggleClass(n+"disabled",e),t.$ed.attr("contenteditable",!e)},destroy:function(){var e=this,t=e.o.prefix;e.isTextarea?e.$box.after(e.$ta.css({height:""}).val(e.html()).removeClass(t+"textarea").show()):e.$box.after(e.$ed.css({height:""}).removeClass(t+"editor").removeAttr("contenteditable").removeAttr("dir").html(e.html()).show()),e.$ed.off("dblclick","img"),e.destroyPlugins(),e.$box.remove(),e.$c.removeData("trumbowyg"),u("body").removeClass(t+"body-fullscreen"),e.$c.trigger("tbwclose"),u(d).off("scroll."+e.eventNamespace+" resize."+e.eventNamespace),u(e.doc.body).off("keydown."+e.eventNamespace)},empty:function(){this.$ta.val(""),this.syncCode(!0)},toggle:function(){var e=this,t=e.o.prefix;e.o.autogrowOnEnter&&(e.autogrowOnEnterDontClose=!e.$box.hasClass(t+"editor-hidden")),e.semanticCode(!1,!0),e.$c.trigger("tbwchange"),setTimeout(function(){e.doc.activeElement.blur(),e.$box.toggleClass(t+"editor-hidden "+t+"editor-visible"),e.$btnPane.toggleClass(t+"disable"),e.$btnPane.find(".trumbowyg-viewHTML-button").text(e.$box.hasClass(t+"editor-hidden")?"Formatted Text":"Plain Text").attr("data-original-title",e.$box.hasClass(t+"editor-hidden")?"Fomatted Text":"Plain Text"),u("."+t+"viewHTML-button",e.$btnPane).toggleClass(t+"active"),e.$box.hasClass(t+"editor-visible")?e.$ta.attr("tabindex",-1):e.$ta.removeAttr("tabindex"),e.o.autogrowOnEnter&&!e.autogrowOnEnterDontClose&&e.autogrowEditorOnEnter()},0)},toggleSpan:function(e){this.$ed.find("span").each(function(){!0===e?u(this).attr("data-tbw-flag",!0):u(this).attr("data-tbw-flag")?u(this).removeAttr("data-tbw-flag"):u(this).contents().unwrap()})},dropdown:function(e){var t=this,n=u("body",t.doc),a=t.o.prefix,o=u("[data-"+a+"dropdown="+e+"]",t.$box),r=u("."+a+e+"-button",t.$btnPane),e=o.is(":hidden");n.trigger("mousedown"),e&&(e=r.offset().left,r.addClass(a+"active"),o.css({position:"absolute",top:r.offset().top-t.$btnPane.offset().top+r.outerHeight(),left:t.o.fixedFullWidth&&t.isFixed?e:e-t.$btnPane.offset().left}).show(),u(d).trigger("scroll"),n.on("mousedown."+t.eventNamespace,function(e){o.is(e.target)||(u("."+a+"dropdown",t.$box).hide(),u("."+a+"active",t.$btnPane).removeClass(a+"active"),n.off("mousedown."+t.eventNamespace))}))},html:function(e){var t=this;return null!=e?(t.$ta.val(e),t.syncCode(!0),t.$c.trigger("tbwchange"),t):t.$ta.val()},syncTextarea:function(){var e=this;e.$ta.val(0<e.$ed.text().trim().length||0<e.$ed.find(e.o.tagsToKeep.join(",")).length?e.$ed.html():"")},syncCode:function(e){var t,n=this;!e&&n.$ed.is(":visible")?n.syncTextarea():(t=u("<div>").html(n.$ta.val()),t=u("<div>").append(t),u(n.o.tagsToRemove.join(","),t).remove(),n.$ed.html(t.contents().html())),n.o.autogrow&&(n.height=n.$ed.height(),n.height!==n.$ta.css("height")&&(n.$ta.css({height:n.height}),n.$c.trigger("tbwresize"))),n.o.autogrowOnEnter&&(n.$ed.height("auto"),(t=n.autogrowOnEnterWasFocused?n.$ed[0].scrollHeight:n.$ed.css("min-height"))!==n.$ta.css("height")&&(n.$ed.css({height:t}),n.$c.trigger("tbwresize")))},semanticCode:function(e,t,n){var a=this;a.saveRange(),a.syncCode(e);var o,r,i,e=!0;a.range&&a.range.collapsed&&(e=!1),a.o.semantic&&(a.semanticTag("b",a.o.semanticKeepAttributes),a.semanticTag("i",a.o.semanticKeepAttributes),a.semanticTag("s",a.o.semanticKeepAttributes),a.semanticTag("strike",a.o.semanticKeepAttributes),t&&(o=a.o.inlineElementsSelector,r=":not("+o+")",a.$ed.contents().filter(function(){return 3===this.nodeType&&0<this.nodeValue.trim().length}).wrap("<span data-tbw/>"),(i=function(e){var t;0!==e.length&&(e=(t=e.nextUntil(r).addBack().wrapAll("<p/>").parent()).nextAll(o).first(),t.next("br").remove(),i(e))})(a.$ed.children(o).first()),a.semanticTag("div",!0),u("[data-tbw]",a.$ed).contents().unwrap(),a.$ed.find("p:empty").remove()),!n&&e&&a.restoreRange(),a.syncTextarea())},semanticTag:function(e,a,t){var o,r=this,n=e;if(null!=this.o.semantic&&"object"==typeof this.o.semantic&&this.o.semantic.hasOwnProperty(e))o=this.o.semantic[e];else{if(!0!==this.o.semantic||!this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(e))return;o=this.DEFAULT_SEMANTIC_MAP[e]}t&&(e=o,o=n),u(e,this.$ed).each(function(){var e=!1,t=u(this);if(0===t.contents().length)return!1;r.range.startContainer.parentNode&&r.range.startContainer.parentNode===this&&(e=!0);var n=u("<"+o+"/>");n.insertBefore(t),a&&u.each(t.prop("attributes"),function(){n.attr(this.name,this.value)}),n.html(t.html()),t.remove(),!0===e&&(r.range.selectNodeContents(n.get(0)),r.range.collapse(!1))})},createLink:function(){for(var e,t,n,a=this,o=a.doc.getSelection(),r=o.getRangeAt(0),i=o.focusNode,s=(new XMLSerializer).serializeToString(r.cloneContents())||r+"";["A","DIV"].indexOf(i.nodeName)<0;)i=i.parentNode;i&&"A"===i.nodeName&&(s=(r=u(i)).text(),n=r.attr("href"),a.o.minimalLinks||(e=r.attr("title"),t=r.attr("target")||a.o.defaultLinkTarget),(r=a.doc.createRange()).selectNode(i),o.removeAllRanges(),o.addRange(r)),a.saveRange();s={url:{label:a.lang.linkUrl||"URL",required:!0,value:n},text:{label:a.lang.text,value:s}};a.o.minimalLinks||u.extend(s,{title:{label:a.lang.title,value:e},target:{label:a.lang.target,value:t}}),a.openModalInsert(a.lang.createLink,s,function(e){var t=a.prependUrlPrefix(e.url);if(!t.length)return!1;t=u(['<a href="',t,'">',e.text||e.url,"</a>"].join(""));return e.title&&t.attr("title",e.title),(e.target||a.o.defaultLinkTarget)&&t.attr("target",e.target||a.o.defaultLinkTarget),a.range.deleteContents(),a.range.insertNode(t[0]),a.syncCode(),a.$c.trigger("tbwchange"),!0})},prependUrlPrefix:function(e){if(!this.urlPrefix)return e;if(/^([a-z][-+.a-z0-9]*:|\/|#)/i.test(e))return e;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?"mailto:"+e:this.urlPrefix+e},unlink:function(){var e,t=this.doc.getSelection(),n=t.focusNode;if(t.isCollapsed){for(;["A","DIV"].indexOf(n.nodeName)<0;)n=n.parentNode;n&&"A"===n.nodeName&&((e=this.doc.createRange()).selectNode(n),t.removeAllRanges(),t.addRange(e))}this.execCmd("unlink",void 0,void 0,!0)},insertImage:function(){var n=this;n.saveRange();var e={url:{label:"URL",required:!0},alt:{label:n.lang.description,value:n.getRangeText()}};n.o.imageWidthModalEdit&&(e.width={}),n.openModalInsert(n.lang.insertImage,e,function(e){n.execCmd("insertImage",e.url,!1,!0);var t=u('img[src="'+e.url+'"]:not([alt])',n.$box);return t.attr("alt",e.alt),n.o.imageWidthModalEdit&&t.attr({width:e.width}),n.syncCode(),n.$c.trigger("tbwchange"),!0})},fullscreen:function(){var e=this,t=e.o.prefix,n=t+"fullscreen",a=n+"-placeholder",o=e.$box.outerHeight();e.$box.toggleClass(n),(n=e.$box.hasClass(n))?e.$box.before(u("<div/>",{class:a}).css({height:o})):u("."+a).remove(),u("body").toggleClass(t+"body-fullscreen",n),u(d).trigger("scroll"),e.$c.trigger("tbw"+(n?"open":"close")+"fullscreen")},execCmd:function(t,n,e,a){var o=this;a=!!a||"","dropdown"!==t&&o.$ed.focus(),"strikethrough"===t&&o.o.semantic&&o.semanticTag("strike",o.o.semanticKeepAttributes,!0);try{o.doc.execCommand("styleWithCSS",!1,e||!1)}catch(e){}try{o[t+a](n)}catch(e){try{t(n)}catch(e){"insertHorizontalRule"===t?n=void 0:"formatBlock"===t&&o.isIE&&(n="<"+n+">"),o.doc.execCommand(t,!1,n),o.syncCode(),o.semanticCode(!1,!0);try{var r=d.getSelection().focusNode;u(d.getSelection().focusNode.parentNode).hasClass("trumbowyg-editor")||(r=d.getSelection().focusNode.parentNode);var i=o.o.tagClasses[n];i&&u(r).addClass(i)}catch(e){}}"dropdown"!==t&&(o.updateButtonPaneStatus(),o.$c.trigger("tbwchange"))}},openModal:function(e,t,n){var a=this,o=a.o.prefix;if(n=!1!==n,0<u("."+o+"modal-box",a.$box).length)return!1;a.o.autogrowOnEnter&&(a.autogrowOnEnterDontClose=!0),a.saveRange(),a.showOverlay(),a.$btnPane.addClass(o+"disable");var r=u("<div/>",{class:o+"modal "+o+"fixed-top"}).css({top:a.$box.offset().top+a.$btnPane.height(),zIndex:99999}).appendTo(u(a.doc.body));a.$overlay.one("click",function(){return r.trigger(h),!1}),t=n?u("<form/>",{action:"",html:t}).on("submit",function(){return r.trigger(g),!1}).on("reset",function(){return r.trigger(h),!1}).on("submit reset",function(){a.o.autogrowOnEnter&&(a.autogrowOnEnterDontClose=!1)}):t;t=u("<div/>",{class:o+"modal-box",html:t}).css({top:"-"+a.$btnPane.outerHeight(),opacity:0,paddingBottom:n?null:"5%"}).appendTo(r).animate({top:0,opacity:1},100);return e&&u("<span/>",{text:e,class:o+"modal-title"}).prependTo(t),n&&(u("input:first",t).focus(),a.buildModalBtn("submit",t),a.buildModalBtn("reset",t),r.height(t.outerHeight()+10)),u(d).trigger("scroll"),a.$c.trigger("tbwmodalopen"),r},buildModalBtn:function(e,t){var n=this.o.prefix;return u("<button/>",{class:n+"modal-button "+n+"modal-"+e,type:e,text:this.lang[e]||e}).appendTo(u("form",t))},closeModal:function(){var e=this,t=e.o.prefix;e.$btnPane.removeClass(t+"disable"),e.$overlay.off();var n=u("."+t+"modal-box",u(e.doc.body));n.animate({top:"-"+n.height()},100,function(){n.parent().remove(),e.hideOverlay(),e.$c.trigger("tbwmodalclose")}),e.restoreRange()},openModalInsert:function(e,t,n){var s=this,r=s.o.prefix,i=s.lang,l="";return u.each(t,function(e,t){var n=t.label||e,a=t.name||e,o=t.attributes||{},e=Object.keys(o).map(function(e){return e+'="'+o[e]+'"'}).join(" ");l+='<label><input type="'+(t.type||"text")+'" name="'+a+'"'+("checkbox"===t.type&&t.value?' checked="checked"':' value="'+(t.value||"").replace(/"/g,"&quot;"))+'"'+e+'><span class="'+r+'input-infos"><span>'+(i[n]||n)+"</span></span></label>"}),s.openModal(e,l).on(g,function(){var o=u("form",u(this)),r=!0,i={};u.each(t,function(e,t){var n=t.name||e,a=u('input[name="'+n+'"]',o);switch(a.attr("type").toLowerCase()){case"checkbox":i[n]=a.is(":checked");break;case"radio":i[n]=a.filter(":checked").val();break;default:i[n]=u.trim(a.val())}t.required&&""===i[n]?(r=!1,s.addErrorOnModalField(a,s.lang.required)):t.pattern&&!t.pattern.test(i[n])&&(r=!1,s.addErrorOnModalField(a,t.patternError))}),r&&(s.restoreRange(),n(i,t)&&(s.syncCode(),s.$c.trigger("tbwchange"),s.closeModal(),u(this).off(g)))}).one(h,function(){u(this).off(g),s.closeModal()})},addErrorOnModalField:function(e,t){var n=this.o.prefix,a=n+"msg-error",o=e.parent();e.on("change keyup",function(){o.removeClass(n+"input-error"),setTimeout(function(){o.find("."+a).remove()},150)}),o.addClass(n+"input-error").find("input+span").append(u("<span/>",{class:a,text:t}))},getDefaultImgDblClickHandler:function(){var a=this;return function(){var t=u(this),e=t.attr("src"),n="(Base64)";0===e.indexOf("data:image")&&(e=n);e={url:{label:"URL",value:e,required:!0},alt:{label:a.lang.description,value:t.attr("alt")}};return a.o.imageWidthModalEdit&&(e.width={value:t.attr("width")?t.attr("width"):""}),a.openModalInsert(a.lang.insertImage,e,function(e){return e.url!==n&&t.attr({src:e.url}),t.attr({alt:e.alt}),a.o.imageWidthModalEdit&&(0<parseInt(e.width)?t.attr({width:e.width}):t.removeAttr("width")),!0}),!1}},saveRange:function(){var e,t=this,n=t.doc.getSelection();t.range=null,n&&n.rangeCount&&(e=t.range=n.getRangeAt(0),(n=t.doc.createRange()).selectNodeContents(t.$ed[0]),n.setEnd(e.startContainer,e.startOffset),n=(n+"").length,t.metaRange={start:n,end:n+(e+"").length})},restoreRange:function(){var e=this,t=e.metaRange,n=e.range,a=e.doc.getSelection();if(n){if(t&&t.start!==t.end)for(var o,r=0,i=[e.$ed[0]],s=!1,l=!1,d=e.doc.createRange();!l&&(o=i.pop());)if(3===o.nodeType){var c=r+o.length;!s&&t.start>=r&&t.start<=c&&(d.setStart(o,t.start-r),s=!0),s&&t.end>=r&&t.end<=c&&(d.setEnd(o,t.end-r),l=!0),r=c}else for(var u=o.childNodes,g=u.length;0<g;)--g,i.push(u[g]);try{a.removeAllRanges()}catch(e){}a.addRange(d||n)}},getRangeText:function(){return this.range+""},clearButtonPaneStatus:function(){var e=this.o.prefix,t=e+"active-button "+e+"active",n=e+"original-icon";u("."+e+"active-button",this.$btnPane).removeClass(t),u("."+n,this.$btnPane).each(function(){u(this).find("svg use").attr("xlink:href",u(this).data(n))})},updateButtonPaneStatus:function(){var s=this,l=s.o.prefix,d=l+"active-button "+l+"active",c=l+"original-icon",e=s.getTagsRecursive(s.doc.getSelection().focusNode);s.clearButtonPaneStatus(),u.each(e,function(e,t){var n=s.tagToButton[t.toLowerCase()],a=u("."+l+n+"-button",s.$btnPane);if(0<a.length)a.addClass(d);else try{var o=(a=u("."+l+"dropdown ."+l+n+"-dropdown-button",s.$box)).find("svg use"),r=a.parent().data(l+"dropdown"),i=u("."+l+r+"-button",s.$box),r=i.find("svg use");i.addClass(d),s.o.changeActiveDropdownIcon&&0<o.length&&(i.addClass(c).data(c,r.attr("xlink:href")),r.attr("xlink:href",o.attr("xlink:href")))}catch(e){}})},getTagsRecursive:function(n,a){var o=this;if(a=a||(n&&n.tagName?[n.tagName]:[]),!n||!n.parentNode)return a;var e=(n=n.parentNode).tagName;return"DIV"===e?a:("P"===e&&""!==n.style.textAlign&&a.push(n.style.textAlign),u.each(o.tagHandlers,function(e,t){a=a.concat(t(n,o))}),a.push(e),o.getTagsRecursive(n,a).filter(function(e){return null!=e}))},initPlugins:function(){var n=this;n.loadedPlugins=[],u.each(u.trumbowyg.plugins,function(e,t){t.shouldInit&&!t.shouldInit(n)||(t.init(n),t.tagHandler&&n.tagHandlers.push(t.tagHandler),n.loadedPlugins.push(t))})},destroyPlugins:function(){var n=this;u.each(this.loadedPlugins,function(e,t){t.destroy&&t.destroy(n)})}}}(navigator,window,document,jQuery);
\ No newline at end of file
+jQuery.trumbowyg={langs:{en:{viewHTML:"Plain Text",undo:"Undo",redo:"Redo",formatting:"Formatting",p:"Paragraph",blockquote:"Quote",code:"Code",header:"Header",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",underline:"Underline",strong:"Strong",em:"Emphasis",del:"Deleted",superscript:"Superscript",subscript:"Subscript",unorderedList:"Unordered list",orderedList:"Ordered list",insertImage:"Insert Image",link:"Link",createLink:"Insert link",unlink:"Remove link",justifyLeft:"Align Left",justifyCenter:"Align Center",justifyRight:"Align Right",justifyFull:"Align Justify",horizontalRule:"Insert horizontal rule",removeformat:"Remove format",fullscreen:"Fullscreen",close:"Close",submit:"Confirm",reset:"Cancel",required:"Required",description:"Description",title:"Title",text:"Text",target:"Target",width:"Width"}},plugins:{},svgPath:null,svgAbsoluteUseHref:!1,hideButtonTexts:null},Object.defineProperty(jQuery.trumbowyg,"defaultOptions",{value:{lang:"en",fixedBtnPane:!1,fixedFullWidth:!1,autogrow:!1,autogrowOnEnter:!1,imageWidthModalEdit:!1,hideButtonTexts:null,prefix:"trumbowyg-",tagClasses:{},semantic:!0,semanticKeepAttributes:!1,resetCss:!1,removeformatPasted:!1,tabToIndent:!1,tagsToRemove:[],tagsToKeep:["hr","img","embed","iframe","input"],btns:[["viewHTML"],["undo","redo"],["formatting"],["strong","em","del"],["superscript","subscript"],["link"],["insertImage"],["justifyLeft","justifyCenter","justifyRight","justifyFull"],["unorderedList","orderedList"],["horizontalRule"],["removeformat"],["fullscreen"]],btnsDef:{},changeActiveDropdownIcon:!1,inlineElementsSelector:"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u",pasteHandlers:[],plugins:{},urlProtocol:!1,minimalLinks:!1,defaultLinkTarget:void 0,svgPath:null},writable:!1,enumerable:!0,configurable:!1}),function(l,d,c,u){"use strict";var g="tbwconfirm",h="tbwcancel";u.fn.trumbowyg=function(e,t){var n="trumbowyg";if(e===Object(e)||!e)return this.each(function(){u(this).data(n)||u(this).data(n,new o(this,e))});if(1===this.length)try{var a=u(this).data(n);switch(e){case"execCmd":return a.execCmd(t.cmd,t.param,t.forceCss,t.skipTrumbowyg);case"openModal":return a.openModal(t.title,t.content);case"closeModal":return a.closeModal();case"openModalInsert":return a.openModalInsert(t.title,t.fields,t.callback);case"saveRange":return a.saveRange();case"getRange":return a.range;case"getRangeText":return a.getRangeText();case"restoreRange":return a.restoreRange();case"enable":return a.setDisabled(!1);case"disable":return a.setDisabled(!0);case"toggle":return a.toggle();case"destroy":return a.destroy();case"empty":return a.empty();case"html":return a.html(t)}}catch(e){}return!1};var o=function(e,t){var n=this,a="trumbowyg-icons",o=u.trumbowyg;n.doc=e.ownerDocument||c,n.$ta=u(e),n.$c=u(e),null!=(t=t||{}).lang||null!=o.langs[t.lang]?n.lang=u.extend(!0,{},o.langs.en,o.langs[t.lang]):n.lang=o.langs.en,n.hideButtonTexts=(null!=o.hideButtonTexts?o:t).hideButtonTexts;var r,i=(null!=o.svgPath?o:t).svgPath;n.hasSvg=!1!==i,!1===i||!o.svgAbsoluteUseHref&&0!==u("#"+a,n.doc).length||(null==i&&u("script[src]").each(function(e,t){var n=t.src,t=n.match("trumbowyg(.min)?.js");null!=t&&(i=n.substring(0,n.indexOf(t[0]))+"ui/icons.svg")}),null==i?console.warn("You must define svgPath: https://goo.gl/CfTY9U"):o.svgAbsoluteUseHref||((r=n.doc.createElement("div")).id=a,n.doc.body.insertBefore(r,n.doc.body.childNodes[0]),u.ajax({async:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"xml",crossDomain:!0,url:i,data:null,beforeSend:null,complete:null,success:function(e){r.innerHTML=(new XMLSerializer).serializeToString(e.documentElement)}})));var s=n.doc.querySelector("base")?d.location.href.split(/[?#]/)[0]:"";n.svgPath=o.svgAbsoluteUseHref?i:s;a=n.lang.header,s=function(){return(d.chrome||d.Intl&&Intl.v8BreakIterator)&&"CSS"in d};n.btnsDef={viewHTML:{fn:"toggle",class:"trumbowyg-not-disable",name1:"name1"},undo:{isSupported:s,key:"Z"},redo:{isSupported:s,key:"Y"},p:{fn:"formatBlock"},blockquote:{fn:"formatBlock"},h1:{fn:"formatBlock",title:a+" 1"},h2:{fn:"formatBlock",title:a+" 2"},h3:{fn:"formatBlock",title:a+" 3"},h4:{fn:"formatBlock",title:a+" 4"},h5:{fn:"formatBlock",title:a+" 5"},h6:{fn:"formatBlock",title:a+" 6"},subscript:{tag:"sub"},superscript:{tag:"sup"},bold:{key:"B",tag:"b"},italic:{key:"I",tag:"i"},underline:{tag:"u"},strikethrough:{tag:"strike"},strong:{fn:"bold",key:"B"},em:{fn:"italic",key:"I"},del:{fn:"strikethrough"},createLink:{key:"K",tag:"a"},unlink:{},insertImage:{},justifyLeft:{tag:"left",forceCss:!0},justifyCenter:{tag:"center",forceCss:!0},justifyRight:{tag:"right",forceCss:!0},justifyFull:{tag:"justify",forceCss:!0},unorderedList:{fn:"insertUnorderedList",tag:"ul"},orderedList:{fn:"insertOrderedList",tag:"ol"},horizontalRule:{fn:"insertHorizontalRule"},removeformat:{},fullscreen:{class:"trumbowyg-not-disable"},close:{fn:"destroy",class:"trumbowyg-not-disable"},formatting:{dropdown:["p","h1","h2","h3","h4"],ico:"p"},link:{dropdown:["createLink","unlink"]}},n.o=u.extend(!0,{},o.defaultOptions,t),n.o.hasOwnProperty("imgDblClickHandler")||(n.o.imgDblClickHandler=n.getDefaultImgDblClickHandler()),n.urlPrefix=n.setupUrlPrefix(),n.disabled=n.o.disabled||"TEXTAREA"===e.nodeName&&e.disabled,t.btns?n.o.btns=t.btns:n.o.semantic||(n.o.btns[3]=["bold","italic","underline","strikethrough"]),u.each(n.o.btnsDef,function(e,t){n.addBtnDef(e,t)}),n.eventNamespace="trumbowyg-event",n.keys=[],n.tagToButton={},n.tagHandlers=[],n.pasteHandlers=[].concat(n.o.pasteHandlers),n.isIE=-1!==l.userAgent.indexOf("MSIE")||-1!==l.appVersion.indexOf("Trident/"),n.isMac=-1!==l.platform.toUpperCase().indexOf("MAC"),n.init()};o.prototype={DEFAULT_SEMANTIC_MAP:{b:"strong",i:"em",s:"del",strike:"del",div:"p"},init:function(){var e=this;e.height=e.$ta.height(),e.initPlugins();try{e.doc.execCommand("enableObjectResizing",!1,!1),e.doc.execCommand("defaultParagraphSeparator",!1,"p")}catch(e){}e.buildEditor(),e.buildBtnPane(),e.fixedBtnPaneEvents(),e.buildOverlay(),setTimeout(function(){e.disabled&&e.setDisabled(!0),e.$c.trigger("tbwinit")})},addBtnDef:function(e,t){this.btnsDef[e]=u.extend(t,this.btnsDef[e]||{})},setupUrlPrefix:function(){var e=this.o.urlProtocol;if(e)return"string"!=typeof e?"https://":e.replace("://","")+"://"},buildEditor:function(){var a=this,t=a.o.prefix,e="";a.$box=u("<div/>",{class:t+"box "+t+"editor-visible "+t+a.o.lang+" trumbowyg"}),a.isTextarea=a.$ta.is("textarea"),a.isTextarea?(e=a.$ta.val(),a.$ed=u("<div/>"),a.$box.insertAfter(a.$ta).append(a.$ed,a.$ta)):(a.$ed=a.$ta,e=a.$ed.html(),a.$ta=u("<textarea/>",{name:a.$ta.attr("id"),height:a.height}).val(e),a.$box.insertAfter(a.$ed).append(a.$ta,a.$ed),a.syncCode()),a.$ta.addClass(t+"textarea").attr("tabindex",-1),a.$ed.addClass(t+"editor").attr({contenteditable:!0,dir:a.lang._dir||"ltr"}).html(e),a.o.tabindex&&a.$ed.attr("tabindex",a.o.tabindex),a.$c.is("[placeholder]")&&a.$ed.attr("placeholder",a.$c.attr("placeholder")),a.$c.is("[spellcheck]")&&a.$ed.attr("spellcheck",a.$c.attr("spellcheck")),a.o.resetCss&&a.$ed.addClass(t+"reset-css"),a.o.autogrow||a.$ta.add(a.$ed).css({height:a.height}),a.semanticCode(),a.o.autogrowOnEnter&&a.$ed.addClass(t+"autogrow-on-enter");var n,o=!1,r=!1;a.$ed.on("dblclick","img",a.o.imgDblClickHandler).on("keydown",function(e){var t=e.which;if(8!==t&&13!==t&&46!==t||a.toggleSpan(!0),!e.ctrlKey&&!e.metaKey||e.altKey){if(a.o.tabToIndent&&"Tab"===e.key)try{return e.shiftKey?a.execCmd("outdent",!0,null):a.execCmd("indent",!0,null),!1}catch(e){}}else{o=!0;var n=a.keys[String.fromCharCode(e.which).toUpperCase()];try{return a.execCmd(n.fn,n.param),!1}catch(e){}}}).on("compositionstart compositionupdate",function(){r=!0}).on("keyup compositionend",function(e){if("compositionend"===e.type)r=!1;else if(r)return;var t=e.which;37<=t&&t<=40||(8!==t&&13!==t&&46!==t||a.toggleSpan(),!e.ctrlKey&&!e.metaKey||89!==t&&90!==t?o||17===t?void 0===e.which&&a.semanticCode(!1,!1,!0):(e=!a.isIE||"compositionend"===e.type,a.semanticCode(!1,e&&13===t),a.$c.trigger("tbwchange")):(a.semanticCode(!1,!0),a.$c.trigger("tbwchange")),setTimeout(function(){o=!1},50))}).on("mouseup keydown keyup",function(e){(e.ctrlKey||e.metaKey)&&!e.altKey||setTimeout(function(){o=!1},50),clearTimeout(n),n=setTimeout(function(){a.updateButtonPaneStatus()},50)}).on("focus blur",function(e){"blur"===e.type&&a.clearButtonPaneStatus(),a.$c.trigger("tbw"+e.type),a.o.autogrowOnEnter&&(a.autogrowOnEnterDontClose||("focus"===e.type?(a.autogrowOnEnterWasFocused=!0,a.autogrowEditorOnEnter()):a.o.autogrow||(a.$ed.css({height:a.$ed.css("min-height")}),a.$c.trigger("tbwresize"))))}).on("keyup focus",function(){a.$ta.val().match(/<.*>/)||a.$ed.html().match(/<.*>/)||setTimeout(function(){var e=a.isIE?"<p>":"p";a.doc.execCommand("formatBlock",!1,e),a.syncCode()},0)}).on("cut drop",function(){setTimeout(function(){a.semanticCode(!1,!0),a.$c.trigger("tbwchange")},0)}).on("paste",function(n){if(a.o.removeformatPasted){n.preventDefault(),d.getSelection&&d.getSelection().deleteFromDocument&&d.getSelection().deleteFromDocument();try{var t=d.clipboardData.getData("Text");try{a.doc.selection.createRange().pasteHTML(t)}catch(e){a.doc.getSelection().getRangeAt(0).insertNode(a.doc.createTextNode(t))}a.$c.trigger("tbwchange",n)}catch(e){a.execCmd("insertText",(n.originalEvent||n).clipboardData.getData("text/plain"))}}u.each(a.pasteHandlers,function(e,t){t(n)}),setTimeout(function(){a.semanticCode(!1,!0),a.$c.trigger("tbwpaste",n),a.$c.trigger("tbwchange")},0)}),a.$ta.on("keyup",function(){a.$c.trigger("tbwchange")}).on("paste",function(){setTimeout(function(){a.$c.trigger("tbwchange")},0)}),u(a.doc.body).on("keydown."+a.eventNamespace,function(e){if(27===e.which&&1<=u("."+t+"modal-box").length)return a.closeModal(),!1})},autogrowEditorOnEnter:function(){var e=this;e.$ed.removeClass("autogrow-on-enter");var t=e.$ed[0].clientHeight;e.$ed.height("auto");var n=e.$ed[0].scrollHeight;e.$ed.addClass("autogrow-on-enter"),t!==n&&(e.$ed.height(t),setTimeout(function(){e.$ed.css({height:n}),e.$c.trigger("tbwresize")},0))},buildBtnPane:function(){var a=this,o=a.o.prefix,r=a.$btnPane=u("<div/>",{class:o+"button-pane"});u.each(a.o.btns,function(e,t){u.isArray(t)||(t=[t]);var n=u("<div/>",{class:o+"button-group "+(0<=t.indexOf("fullscreen")?o+"right":"")});u.each(t,function(e,t){try{a.isSupportedBtn(t)&&n.append(a.buildBtn(t))}catch(e){}}),0<n.html().trim().length&&r.append(n)}),a.$box.prepend(r)},buildBtn:function(e){var n,a=this,t=a.o.prefix,o=a.btnsDef[e],r=o.dropdown,i=null==o.hasIcon||o.hasIcon,s=a.lang[e]||e,l=u("<button/>",{type:"button",class:t+e+"-button "+(o.class||"")+(i?"":" "+t+"textual-button"),html:!o.name1&&a.hasSvg&&i?'<svg><use xlink:href="'+a.svgPath+"#"+t+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>':a.hideButtonTexts?"":o.text||o.title||a.lang[e]||e,title:(o.title||o.text||s)+(o.key?" ("+(a.isMac?"Cmd":"Ctrl")+" + "+o.key+")":""),tabindex:-1,mousedown:function(){return r&&!u("."+e+"-"+t+"dropdown",a.$box).is(":hidden")||u("body",a.doc).trigger("mousedown"),(!a.$btnPane.hasClass(t+"disable")&&!a.$box.hasClass(t+"disabled")||u(this).hasClass(t+"active")||u(this).hasClass(t+"not-disable"))&&a.execCmd((!r?o.fn:"dropdown")||e,o.param||e,o.forceCss),!1}});return r?(l.addClass(t+"open-dropdown"),(s={class:(i=t+"dropdown")+"-"+e+" "+i+" "+t+"fixed-top "+(o.dropdownClass||"")})["data-"+i]=e,n=u("<div/>",s),u.each(r,function(e,t){a.btnsDef[t]&&a.isSupportedBtn(t)&&n.append(a.buildSubBtn(t))}),a.$box.append(n.hide())):o.key&&(a.keys[o.key]={fn:o.fn||e,param:o.param||e}),r||(a.tagToButton[(o.tag||e).toLowerCase()]=e),l},buildSubBtn:function(e){var t=this,n=t.o.prefix,a=t.btnsDef[e],o=null==a.hasIcon||a.hasIcon;return a.key&&(t.keys[a.key]={fn:a.fn||e,param:a.param||e}),t.tagToButton[(a.tag||e).toLowerCase()]=e,u("<button/>",{type:"button",class:n+e+"-dropdown-button "+(a.class||"")+(a.ico?" "+n+a.ico+"-button":""),html:t.hasSvg&&o?'<svg><use xlink:href="'+t.svgPath+"#"+n+(a.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>'+(a.text||a.title||t.lang[e]||e):a.text||a.title||t.lang[e]||e,title:a.key?"("+(t.isMac?"Cmd":"Ctrl")+" + "+a.key+")":null,style:a.style||null,mousedown:function(){return u("body",t.doc).trigger("mousedown"),t.execCmd(a.fn||e,a.param||e,a.forceCss),!1}})},isSupportedBtn:function(e){try{return this.btnsDef[e].isSupported()}catch(e){}return!0},buildOverlay:function(){return this.$overlay=u("<div/>",{class:this.o.prefix+"overlay"}).appendTo(this.$box),this.$overlay},showOverlay:function(){u(d).trigger("scroll"),this.$overlay.fadeIn(200),this.$box.addClass(this.o.prefix+"box-blur")},hideOverlay:function(){this.$overlay.fadeOut(50),this.$box.removeClass(this.o.prefix+"box-blur")},fixedBtnPaneEvents:function(){var o=this,r=o.o.fixedFullWidth,i=o.$box;o.o.fixedBtnPane&&(o.isFixed=!1,u(d).on("scroll."+o.eventNamespace+" resize."+o.eventNamespace,function(){var e,t,n,a;i&&(o.syncCode(),e=u(d).scrollTop(),t=i.offset().top+1,a=(n=o.$btnPane).outerHeight()-2,0<e-t&&e-t-o.height<0?(o.isFixed||(o.isFixed=!0,n.css({position:"fixed",top:0,left:r?0:"auto",zIndex:7}),o.$box.css({paddingTop:n.height()})),n.css({width:r?"100%":i.width()-1}),u("."+o.o.prefix+"fixed-top",i).css({position:r?"fixed":"absolute",top:r?a:e-t+a,zIndex:15})):o.isFixed&&(o.isFixed=!1,n.removeAttr("style"),o.$box.css({paddingTop:0}),u("."+o.o.prefix+"fixed-top",i).css({position:"absolute",top:a})))}))},setDisabled:function(e){var t=this,n=t.o.prefix;(t.disabled=e)?t.$ta.attr("disabled",!0):t.$ta.removeAttr("disabled"),t.$box.toggleClass(n+"disabled",e),t.$ed.attr("contenteditable",!e)},destroy:function(){var e=this,t=e.o.prefix;e.isTextarea?e.$box.after(e.$ta.css({height:""}).val(e.html()).removeClass(t+"textarea").show()):e.$box.after(e.$ed.css({height:""}).removeClass(t+"editor").removeAttr("contenteditable").removeAttr("dir").html(e.html()).show()),e.$ed.off("dblclick","img"),e.destroyPlugins(),e.$box.remove(),e.$c.removeData("trumbowyg"),u("body").removeClass(t+"body-fullscreen"),e.$c.trigger("tbwclose"),u(d).off("scroll."+e.eventNamespace+" resize."+e.eventNamespace),u(e.doc.body).off("keydown."+e.eventNamespace)},empty:function(){this.$ta.val(""),this.syncCode(!0)},toggle:function(){var e=this,t=e.o.prefix;e.o.autogrowOnEnter&&(e.autogrowOnEnterDontClose=!e.$box.hasClass(t+"editor-hidden")),e.semanticCode(!1,!0),e.$c.trigger("tbwchange"),setTimeout(function(){e.doc.activeElement.blur(),e.$box.toggleClass(t+"editor-hidden "+t+"editor-visible"),e.$btnPane.toggleClass(t+"disable"),e.$btnPane.find(".trumbowyg-viewHTML-button").text(e.$box.hasClass(t+"editor-hidden")?"Formatted Text":"Plain Text").attr("data-original-title",e.$box.hasClass(t+"editor-hidden")?"Formatted Text":"Plain Text"),u("."+t+"viewHTML-button",e.$btnPane).toggleClass(t+"active"),e.$box.hasClass(t+"editor-visible")?e.$ta.attr("tabindex",-1):e.$ta.removeAttr("tabindex"),e.o.autogrowOnEnter&&!e.autogrowOnEnterDontClose&&e.autogrowEditorOnEnter()},0)},toggleSpan:function(e){this.$ed.find("span").each(function(){!0===e?u(this).attr("data-tbw-flag",!0):u(this).attr("data-tbw-flag")?u(this).removeAttr("data-tbw-flag"):u(this).contents().unwrap()})},dropdown:function(e){var t=this,n=u("body",t.doc),a=t.o.prefix,o=u("[data-"+a+"dropdown="+e+"]",t.$box),r=u("."+a+e+"-button",t.$btnPane),e=o.is(":hidden");n.trigger("mousedown"),e&&(e=r.offset().left,r.addClass(a+"active"),o.css({position:"absolute",top:r.offset().top-t.$btnPane.offset().top+r.outerHeight(),left:t.o.fixedFullWidth&&t.isFixed?e:e-t.$btnPane.offset().left}).show(),u(d).trigger("scroll"),n.on("mousedown."+t.eventNamespace,function(e){o.is(e.target)||(u("."+a+"dropdown",t.$box).hide(),u("."+a+"active",t.$btnPane).removeClass(a+"active"),n.off("mousedown."+t.eventNamespace))}))},html:function(e){var t=this;return null!=e?(t.$ta.val(e),t.syncCode(!0),t.$c.trigger("tbwchange"),t):t.$ta.val()},syncTextarea:function(){var e=this;e.$ta.val(0<e.$ed.text().trim().length||0<e.$ed.find(e.o.tagsToKeep.join(",")).length?e.$ed.html():"")},syncCode:function(e){var t,n=this;!e&&n.$ed.is(":visible")?n.syncTextarea():(t=u("<div>").html(n.$ta.val()),t=u("<div>").append(t),u(n.o.tagsToRemove.join(","),t).remove(),n.$ed.html(t.contents().html())),n.o.autogrow&&(n.height=n.$ed.height(),n.height!==n.$ta.css("height")&&(n.$ta.css({height:n.height}),n.$c.trigger("tbwresize"))),n.o.autogrowOnEnter&&(n.$ed.height("auto"),(t=n.autogrowOnEnterWasFocused?n.$ed[0].scrollHeight:n.$ed.css("min-height"))!==n.$ta.css("height")&&(n.$ed.css({height:t}),n.$c.trigger("tbwresize")))},semanticCode:function(e,t,n){var a=this;a.saveRange(),a.syncCode(e);var o,r,i,e=!0;a.range&&a.range.collapsed&&(e=!1),a.o.semantic&&(a.semanticTag("b",a.o.semanticKeepAttributes),a.semanticTag("i",a.o.semanticKeepAttributes),a.semanticTag("s",a.o.semanticKeepAttributes),t&&(o=a.o.inlineElementsSelector,r=":not("+o+")",a.$ed.contents().filter(function(){return 3===this.nodeType&&0<this.nodeValue.trim().length}).wrap("<span data-tbw/>"),(i=function(e){var t;0!==e.length&&(e=(t=e.nextUntil(r).addBack().wrapAll("<p/>").parent()).nextAll(o).first(),t.next("br").remove(),i(e))})(a.$ed.children(o).first()),a.semanticTag("div",!0),u("[data-tbw]",a.$ed).contents().unwrap(),a.$ed.find("p:empty").remove()),!n&&e&&a.restoreRange(),a.syncTextarea())},semanticTag:function(e,a,t){var o,r=this,n=e;if(null!=this.o.semantic&&"object"==typeof this.o.semantic&&this.o.semantic.hasOwnProperty(e))o=this.o.semantic[e];else{if(!0!==this.o.semantic||!this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(e))return;o=this.DEFAULT_SEMANTIC_MAP[e]}t&&(e=o,o=n),u(e,this.$ed).each(function(){var e=!1,t=u(this);if(0===t.contents().length)return!1;r.range.startContainer.parentNode&&r.range.startContainer.parentNode===this&&(e=!0);var n=u("<"+o+"/>");n.insertBefore(t),a&&u.each(t.prop("attributes"),function(){n.attr(this.name,this.value)}),n.html(t.html()),t.remove(),!0===e&&(r.range.selectNodeContents(n.get(0)),r.range.collapse(!1))})},createLink:function(){for(var e,t,n,a=this,o=a.doc.getSelection(),r=o.getRangeAt(0),i=o.focusNode,s=(new XMLSerializer).serializeToString(r.cloneContents())||r+"";["A","DIV"].indexOf(i.nodeName)<0;)i=i.parentNode;i&&"A"===i.nodeName&&(s=(r=u(i)).text(),n=r.attr("href"),a.o.minimalLinks||(e=r.attr("title"),t=r.attr("target")||a.o.defaultLinkTarget),(r=a.doc.createRange()).selectNode(i),o.removeAllRanges(),o.addRange(r)),a.saveRange();s={url:{label:a.lang.linkUrl||"URL",required:!0,value:n},text:{label:a.lang.text,value:s}};a.o.minimalLinks||u.extend(s,{title:{label:a.lang.title,value:e},target:{label:a.lang.target,value:t}}),a.openModalInsert(a.lang.createLink,s,function(e){var t=a.prependUrlPrefix(e.url);if(!t.length)return!1;t=u(['<a href="',t,'">',e.text||e.url,"</a>"].join(""));return e.title&&t.attr("title",e.title),(e.target||a.o.defaultLinkTarget)&&t.attr("target",e.target||a.o.defaultLinkTarget),a.range.deleteContents(),a.range.insertNode(t[0]),a.syncCode(),a.$c.trigger("tbwchange"),!0})},prependUrlPrefix:function(e){if(!this.urlPrefix)return e;if(/^([a-z][-+.a-z0-9]*:|\/|#)/i.test(e))return e;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?"mailto:"+e:this.urlPrefix+e},unlink:function(){var e,t=this.doc.getSelection(),n=t.focusNode;if(t.isCollapsed){for(;["A","DIV"].indexOf(n.nodeName)<0;)n=n.parentNode;n&&"A"===n.nodeName&&((e=this.doc.createRange()).selectNode(n),t.removeAllRanges(),t.addRange(e))}this.execCmd("unlink",void 0,void 0,!0)},insertImage:function(){var n=this;n.saveRange();var e={url:{label:"URL",required:!0},alt:{label:n.lang.description,value:n.getRangeText()}};n.o.imageWidthModalEdit&&(e.width={}),n.openModalInsert(n.lang.insertImage,e,function(e){n.execCmd("insertImage",e.url,!1,!0);var t=u('img[src="'+e.url+'"]:not([alt])',n.$box);return t.attr("alt",e.alt),n.o.imageWidthModalEdit&&t.attr({width:e.width}),n.syncCode(),n.$c.trigger("tbwchange"),!0})},fullscreen:function(){var e=this,t=e.o.prefix,n=t+"fullscreen",a=n+"-placeholder",o=e.$box.outerHeight();e.$box.toggleClass(n),(n=e.$box.hasClass(n))?e.$box.before(u("<div/>",{class:a}).css({height:o})):u("."+a).remove(),u("body").toggleClass(t+"body-fullscreen",n),u(d).trigger("scroll"),e.$c.trigger("tbw"+(n?"open":"close")+"fullscreen")},execCmd:function(t,n,e,a){var o=this;a=!!a||"","dropdown"!==t&&o.$ed.focus(),"strikethrough"===t&&o.o.semantic&&o.semanticTag("strike",o.o.semanticKeepAttributes,!0);try{o.doc.execCommand("styleWithCSS",!1,e||!1)}catch(e){}try{o[t+a](n)}catch(e){try{t(n)}catch(e){"insertHorizontalRule"===t?n=void 0:"formatBlock"===t&&o.isIE&&(n="<"+n+">"),o.doc.execCommand(t,!1,n),o.syncCode(),o.semanticCode(!1,!0);try{var r=d.getSelection().focusNode;u(d.getSelection().focusNode.parentNode).hasClass("trumbowyg-editor")||(r=d.getSelection().focusNode.parentNode);var i=o.o.tagClasses[n];i&&u(r).addClass(i)}catch(e){}}"dropdown"!==t&&(o.updateButtonPaneStatus(),o.$c.trigger("tbwchange"))}},openModal:function(e,t,n){var a=this,o=a.o.prefix;if(n=!1!==n,0<u("."+o+"modal-box",a.$box).length)return!1;a.o.autogrowOnEnter&&(a.autogrowOnEnterDontClose=!0),a.saveRange(),a.showOverlay(),a.$btnPane.addClass(o+"disable");var r=u("<div/>",{class:o+"modal "+o+"fixed-top"}).css({top:a.$box.offset().top+a.$btnPane.height(),zIndex:99999}).appendTo(u(a.doc.body));a.$overlay.one("click",function(){return r.trigger(h),!1}),t=n?u("<form/>",{action:"",html:t}).on("submit",function(){return r.trigger(g),!1}).on("reset",function(){return r.trigger(h),!1}).on("submit reset",function(){a.o.autogrowOnEnter&&(a.autogrowOnEnterDontClose=!1)}):t;t=u("<div/>",{class:o+"modal-box",html:t}).css({top:"-"+a.$btnPane.outerHeight(),opacity:0,paddingBottom:n?null:"5%"}).appendTo(r).animate({top:0,opacity:1},100);return e&&u("<span/>",{text:e,class:o+"modal-title"}).prependTo(t),n&&(u("input:first",t).focus(),a.buildModalBtn("submit",t),a.buildModalBtn("reset",t),r.height(t.outerHeight()+10)),u(d).trigger("scroll"),a.$c.trigger("tbwmodalopen"),r},buildModalBtn:function(e,t){var n=this.o.prefix;return u("<button/>",{class:n+"modal-button "+n+"modal-"+e,type:e,text:this.lang[e]||e}).appendTo(u("form",t))},closeModal:function(){var e=this,t=e.o.prefix;e.$btnPane.removeClass(t+"disable"),e.$overlay.off();var n=u("."+t+"modal-box",u(e.doc.body));n.animate({top:"-"+n.height()},100,function(){n.parent().remove(),e.hideOverlay(),e.$c.trigger("tbwmodalclose")}),e.restoreRange()},openModalInsert:function(e,t,n){var s=this,r=s.o.prefix,i=s.lang,l="";return u.each(t,function(e,t){var n=t.label||e,a=t.name||e,o=t.attributes||{},e=Object.keys(o).map(function(e){return e+'="'+o[e]+'"'}).join(" ");l+='<label><input type="'+(t.type||"text")+'" name="'+a+'"'+("checkbox"===t.type&&t.value?' checked="checked"':' value="'+(t.value||"").replace(/"/g,"&quot;"))+'"'+e+'><span class="'+r+'input-infos"><span>'+(i[n]||n)+"</span></span></label>"}),s.openModal(e,l).on(g,function(){var o=u("form",u(this)),r=!0,i={};u.each(t,function(e,t){var n=t.name||e,a=u('input[name="'+n+'"]',o);switch(a.attr("type").toLowerCase()){case"checkbox":i[n]=a.is(":checked");break;case"radio":i[n]=a.filter(":checked").val();break;default:i[n]=u.trim(a.val())}t.required&&""===i[n]?(r=!1,s.addErrorOnModalField(a,s.lang.required)):t.pattern&&!t.pattern.test(i[n])&&(r=!1,s.addErrorOnModalField(a,t.patternError))}),r&&(s.restoreRange(),n(i,t)&&(s.syncCode(),s.$c.trigger("tbwchange"),s.closeModal(),u(this).off(g)))}).one(h,function(){u(this).off(g),s.closeModal()})},addErrorOnModalField:function(e,t){var n=this.o.prefix,a=n+"msg-error",o=e.parent();e.on("change keyup",function(){o.removeClass(n+"input-error"),setTimeout(function(){o.find("."+a).remove()},150)}),o.addClass(n+"input-error").find("input+span").append(u("<span/>",{class:a,text:t}))},getDefaultImgDblClickHandler:function(){var a=this;return function(){var t=u(this),e=t.attr("src"),n="(Base64)";0===e.indexOf("data:image")&&(e=n);e={url:{label:"URL",value:e,required:!0},alt:{label:a.lang.description,value:t.attr("alt")}};return a.o.imageWidthModalEdit&&(e.width={value:t.attr("width")?t.attr("width"):""}),a.openModalInsert(a.lang.insertImage,e,function(e){return e.url!==n&&t.attr({src:e.url}),t.attr({alt:e.alt}),a.o.imageWidthModalEdit&&(0<parseInt(e.width)?t.attr({width:e.width}):t.removeAttr("width")),!0}),!1}},saveRange:function(){var e,t=this,n=t.doc.getSelection();t.range=null,n&&n.rangeCount&&(e=t.range=n.getRangeAt(0),(n=t.doc.createRange()).selectNodeContents(t.$ed[0]),n.setEnd(e.startContainer,e.startOffset),n=(n+"").length,t.metaRange={start:n,end:n+(e+"").length})},restoreRange:function(){var e=this,t=e.metaRange,n=e.range,a=e.doc.getSelection();if(n){if(t&&t.start!==t.end)for(var o,r=0,i=[e.$ed[0]],s=!1,l=!1,d=e.doc.createRange();!l&&(o=i.pop());)if(3===o.nodeType){var c=r+o.length;!s&&t.start>=r&&t.start<=c&&(d.setStart(o,t.start-r),s=!0),s&&t.end>=r&&t.end<=c&&(d.setEnd(o,t.end-r),l=!0),r=c}else for(var u=o.childNodes,g=u.length;0<g;)--g,i.push(u[g]);try{a.removeAllRanges()}catch(e){}a.addRange(d||n)}},getRangeText:function(){return this.range+""},clearButtonPaneStatus:function(){var e=this.o.prefix,t=e+"active-button "+e+"active",n=e+"original-icon";u("."+e+"active-button",this.$btnPane).removeClass(t),u("."+n,this.$btnPane).each(function(){u(this).find("svg use").attr("xlink:href",u(this).data(n))})},updateButtonPaneStatus:function(){var s=this,l=s.o.prefix,d=l+"active-button "+l+"active",c=l+"original-icon",e=s.getTagsRecursive(s.doc.getSelection().focusNode);s.clearButtonPaneStatus(),u.each(e,function(e,t){var n=s.tagToButton[t.toLowerCase()],a=u("."+l+n+"-button",s.$btnPane);if(0<a.length)a.addClass(d);else try{var o=(a=u("."+l+"dropdown ."+l+n+"-dropdown-button",s.$box)).find("svg use"),r=a.parent().data(l+"dropdown"),i=u("."+l+r+"-button",s.$box),r=i.find("svg use");i.addClass(d),s.o.changeActiveDropdownIcon&&0<o.length&&(i.addClass(c).data(c,r.attr("xlink:href")),r.attr("xlink:href",o.attr("xlink:href")))}catch(e){}})},getTagsRecursive:function(n,a){var o=this;if(a=a||(n&&n.tagName?[n.tagName]:[]),!n||!n.parentNode)return a;var e=(n=n.parentNode).tagName;return"DIV"===e?a:("P"===e&&""!==n.style.textAlign&&a.push(n.style.textAlign),u.each(o.tagHandlers,function(e,t){a=a.concat(t(n,o))}),a.push(e),o.getTagsRecursive(n,a).filter(function(e){return null!=e}))},initPlugins:function(){var n=this;n.loadedPlugins=[],u.each(u.trumbowyg.plugins,function(e,t){t.shouldInit&&!t.shouldInit(n)||(t.init(n),t.tagHandler&&n.tagHandlers.push(t.tagHandler),n.loadedPlugins.push(t))})},destroyPlugins:function(){var n=this;u.each(this.loadedPlugins,function(e,t){t.destroy&&t.destroy(n)})}}}(navigator,window,document,jQuery);
\ No newline at end of file
diff --git a/dashboardv2/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html b/dashboardv2/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html
index 3d316f6..aedb6da 100644
--- a/dashboardv2/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html
+++ b/dashboardv2/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html
@@ -95,9 +95,12 @@
     <div class="form-group" data-id="stringLengthContainer">
         <div class="stringlength-container">
             <label class="control-label col-sm-3 required" for="name">Max length</label>
-            <div class="col-sm-8">
+            <div class="col-sm-6">
                 <input type="number" class="form-control stringLengthVal require" data-id="stringLength" placeholder="Maximum length">
             </div>
+            <label class="control-label">
+                <i class="fa fa-question-circle help-btn" title="<div>String length limit includes any HTML formatting tags used.</div>" data-html="true"></i>
+            </label>
         </div>
     </div>
     <div class="form-group entity-businessMetadata-selector">
diff --git a/dashboardv2/public/js/templates/business_metadata/BusinessMetadataDetailLayoutView_tmpl.html b/dashboardv2/public/js/templates/business_metadata/BusinessMetadataDetailLayoutView_tmpl.html
index d8a2b5b..d7230c0 100644
--- a/dashboardv2/public/js/templates/business_metadata/BusinessMetadataDetailLayoutView_tmpl.html
+++ b/dashboardv2/public/js/templates/business_metadata/BusinessMetadataDetailLayoutView_tmpl.html
@@ -18,9 +18,21 @@
     <div class="fontLoader">
         <i class="fa fa-refresh fa-spin-custom"></i>
     </div>
-    <div class="tagDetail clearfix form-horizontal col-sm-12">
+    <div class="tagDetail clearfix col-sm-12">
         <h1 class="title"><span data-id="title"></span></h1>
-        <p class="form-group col-sm-12" data-id="description"></p>
+        <div class="long-description-container form-group clearfix">
+            <span class="pull-left text-muted">Description:&nbsp;</span>
+            <div class="isTextTypeBtn-wrapper pull-right">
+                <span class="text-muted pull-left">Formatted</span>
+                <label class="switch pull-left">
+                    <input type="checkbox" class="switch-input" name="textType" value="text">
+                    <span class="switch-slider"></span>
+                </label>
+                <span class="text-muted">Plain</span>
+            </div>
+            <div class="longdescription-wrapper form-control col-sm-12">
+                <div class="long-description" name="longDescription" data-id="description" disabled></div>
+            </div>
+        </div>
     </div>
-</div>
 </div>
\ No newline at end of file
diff --git a/dashboardv2/public/js/templates/business_metadata/CreateBusinessMetadataLayoutView_tmpl.html b/dashboardv2/public/js/templates/business_metadata/CreateBusinessMetadataLayoutView_tmpl.html
index a78614d..5a43a76 100644
--- a/dashboardv2/public/js/templates/business_metadata/CreateBusinessMetadataLayoutView_tmpl.html
+++ b/dashboardv2/public/js/templates/business_metadata/CreateBusinessMetadataLayoutView_tmpl.html
@@ -31,7 +31,7 @@
     <div class="form-group">
         <label class="control-label col-sm-2" for="description">Description</label>
         <div class="col-sm-10">
-            <input class="form-control" data-id="description" value="{{description}}" placeholder="Description" />
+            <textarea class="form-control customTextEditor" data-id="description" value="{{description}}" placeholder="Description" ></textarea>
         </div>
     </div>
     {{/if}}
diff --git a/dashboardv2/public/js/templates/glossary/GlossaryDetailLayoutView_tmpl.html b/dashboardv2/public/js/templates/glossary/GlossaryDetailLayoutView_tmpl.html
index c8b55f7..b3c642e 100644
--- a/dashboardv2/public/js/templates/glossary/GlossaryDetailLayoutView_tmpl.html
+++ b/dashboardv2/public/js/templates/glossary/GlossaryDetailLayoutView_tmpl.html
@@ -37,7 +37,7 @@
                 </label>
                 <span class="text-muted">Plain</span>
             </div>
-            <div class="glossary-longdescription-wrapper form-control col-sm-12">
+            <div class="longdescription-wrapper form-control col-sm-12">
                 <div class="long-description" name="longDescription" data-id="longDescription" disabled></div>
             </div>
         </div>
diff --git a/dashboardv2/public/js/templates/tag/CreateTagLayoutView_tmpl.html b/dashboardv2/public/js/templates/tag/CreateTagLayoutView_tmpl.html
index 27ea912..28f0baa 100644
--- a/dashboardv2/public/js/templates/tag/CreateTagLayoutView_tmpl.html
+++ b/dashboardv2/public/js/templates/tag/CreateTagLayoutView_tmpl.html
@@ -30,7 +30,7 @@
     <div class="form-group">
         <label class="control-label col-sm-2 required" for="description">Description</label>
         <div class="col-sm-10">
-            <input class="form-control" data-id="description" value="{{description}}" placeholder="Description(required)" />
+            <textarea class="form-control customTextEditor" data-id="description" value="{{description}}" placeholder="Description(required)" ></textarea>
         </div>
     </div>
     {{#if create}}
diff --git a/dashboardv2/public/js/templates/tag/TagAttributeDetailLayoutView_tmpl.html b/dashboardv2/public/js/templates/tag/TagAttributeDetailLayoutView_tmpl.html
index d12785b..fd68a21 100644
--- a/dashboardv2/public/js/templates/tag/TagAttributeDetailLayoutView_tmpl.html
+++ b/dashboardv2/public/js/templates/tag/TagAttributeDetailLayoutView_tmpl.html
@@ -21,7 +21,20 @@
     <div class="tagDetail clearfix form-horizontal col-sm-12">
         <h1 class="row title"><span data-id="title"></span></h1>
         <button type="button" data-id="editButton" class="btn btn-sm btn-action pull-right"><i class="fa fa-pencil"></i></button>
-        <p class="form-group" data-id="description"></p>
+        <div class="long-description-container form-group clearfix">
+            <span class="pull-left text-muted">Description:&nbsp;</span>
+            <div class="isTextTypeBtn-wrapper pull-right">
+                <span class="text-muted pull-left">Formatted</span>
+                <label class="switch pull-left">
+                    <input type="checkbox" class="switch-input" name="textType" value="text">
+                    <span class="switch-slider"></span>
+                </label>
+                <span class="text-muted">Plain</span>
+            </div>
+            <div class="longdescription-wrapper form-control col-sm-12">
+                <div class="long-description" name="longDescription" data-id="description" disabled></div>
+            </div>
+        </div>
         <div class="superType form-group" style="display:none">
             <label class="control-label-sm-pr pull-left">Direct super-classifications:</label>
             <div data-id="superType" class="btn-inline">
diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index f15b32e..4ce47a1 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -695,9 +695,9 @@
             //Below condition is added for sanitizing the longDescription text against XSS attack.
             if (model) {
                 var longDescriptionContent = isGlossaryView ? model.get('longDescription') : model.longDescription,
-                    sanitizeLongDescriptionContent;
+                    sanitizeLongDescriptionContent = "";
                 if (longDescriptionContent) {
-                    sanitizeLongDescriptionContent = Utils.sanitizeHtmlContent(longDescriptionContent);
+                    sanitizeLongDescriptionContent = Utils.sanitizeHtmlContent({ data: longDescriptionContent });
                     isGlossaryView ? model.set("longDescription", sanitizeLongDescriptionContent) : model.longDescription = sanitizeLongDescriptionContent;
                 }
             }
@@ -718,7 +718,6 @@
                 view = new CreateEditCategoryTermLayoutView({ "glossaryCollection": collection, "modelJSON": model });
                 title = (isTermView ? 'Term' : 'Category');
             }
-
             var modal = new Modal({
                 "title": ((model ? "Update " : "Create ") + title),
                 "content": view,
@@ -726,38 +725,19 @@
                 "okCloses": false,
                 "okText": model ? "Update" : "Create",
                 "allowCancel": true,
-                "width": "765px"
+                "width": "640px"
             }).open();
-            modal.$el.find('input[data-id=shortDescription]').on('input keydown', function(e) {
-                $(this).val($(this).val().replace(/\s+/g, ' '));
-            });
             modal.$el.find('button.ok').attr("disabled", "true");
             var longDescriptionEditor = modal.$el.find('textarea[data-id=longDescription]'),
-                okBtn = modal.$el.find('button.ok');
-            longDescriptionEditor.trumbowyg({
-                btns: [
-                    ['formatting'],
-                    ['strong', 'em', 'underline', 'del'],
-                    ['link'],
-                    ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
-                    ['unorderedList', 'orderedList'],
-                    ['viewHTML']
-                ],
-                removeformatPasted: true,
-                urlProtocol: true,
-                defaultLinkTarget: '_blank'
-            }).on('tbwchange', function() {
-                okBtn.removeAttr("disabled");
-            });
+                okBtn = modal.$el.find('button.ok'),
+                modalOkBtn = function() {
+                    okBtn.removeAttr("disabled");
+                };
+            Utils.addCustomTextEditor({ selector: longDescriptionEditor, callback: modalOkBtn, initialHide: false });
             modal.on('ok', function() {
                 modal.$el.find('button.ok').showButtonLoader();
                 //Below condition is added for sanitizing the longDescription text against XSS attack.
-                var editorContent, cleanContent;
-                editorContent = longDescriptionEditor.trumbowyg('html');
-                if (editorContent !== "") {
-                    cleanContent = Utils.sanitizeHtmlContent(editorContent);
-                    longDescriptionEditor.trumbowyg('html', cleanContent);
-                }
+                longDescriptionEditor.trumbowyg('html', Utils.sanitizeHtmlContent({ selector: longDescriptionEditor }));
                 //End
                 CommonViewFunction.createEditGlossaryCategoryTermSubmit(_.extend({ "ref": view, "modal": modal }, options));
             });
@@ -766,6 +746,7 @@
                 if (options.onModalClose) {
                     options.onModalClose()
                 }
+                longDescriptionEditor.trumbowyg('closeModal');
             });
         });
     }
diff --git a/dashboardv2/public/js/utils/Helper.js b/dashboardv2/public/js/utils/Helper.js
index 0ba1b6c..8efeeb9 100644
--- a/dashboardv2/public/js/utils/Helper.js
+++ b/dashboardv2/public/js/utils/Helper.js
@@ -128,6 +128,12 @@
     $("body").on('click', '.btn', function() {
         $(this).blur();
     });
+    $('body').on('click', function(e) {
+        if ($(e.target).hasClass('trumbowyg-editor-hidden')) {
+            $('.trumbowyg').find('.trumbowyg-button-pane').removeClass('trumbowyg-button-pane-hidden');
+            $('.trumbowyg').css('border', '1px solid #8fa5b1');
+        }
+    });
     $('body').on('keyup input', '.modal-body', function(e) {
         var target = e.target,
             isGlossary = (e.target.dataset.id === "searchTerm" || e.target.dataset.id === "searchCategory") ? true : false; // assign term/category modal
diff --git a/dashboardv2/public/js/utils/Utils.js b/dashboardv2/public/js/utils/Utils.js
index f3126db..eb05889 100644
--- a/dashboardv2/public/js/utils/Utils.js
+++ b/dashboardv2/public/js/utils/Utils.js
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', 'moment', 'store', 'modules/Modal', 'DOMPurify', 'moment-timezone', 'pnotify.buttons', 'pnotify.confirm'], function(require, Globals, pnotify, Messages, Enums, moment, store, Modal, DOMPurify) {
+define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', 'moment', 'store', 'modules/Modal', 'DOMPurify', 'moment-timezone', 'pnotify.buttons', 'pnotify.confirm', 'trumbowyg'], function(require, Globals, pnotify, Messages, Enums, moment, store, Modal, DOMPurify) {
     'use strict';
 
     var Utils = {};
@@ -952,14 +952,7 @@
         }
         return dateValue;
     }
-    //-----------------------------------------DOMPurify--------------------------------------
-    //This below function expects string that needs to be sanitize against XSS attack.
-    Utils.sanitizeHtmlContent = function(string) {
-        if (string) {
-            return DOMPurify.sanitize(string, { FORBID_TAGS: ['img', 'script', 'iframe', 'embed', 'svg', 'meta'], ALLOWED_ATTR: ['target', 'href'] });
-        }
-    }
-    //----------------------------------------------------------------------------------------
+
     //------------------------------------------------idleTimeout-----------------------------
     $.fn.idleTimeout = function(userRuntimeConfig) {
 
@@ -1227,7 +1220,69 @@
 
         });
     };
-
     //------------------------------------------------
+
+    //--------------------------------------Custom Text Editor-----------------------------------//
+    Utils.addCustomTextEditor = function(options) {
+        var selector = options.selector ? options.selector : ".customTextEditor",
+            defaultBtns = [
+                ['formatting'],
+                ['strong', 'em', 'underline', 'del'],
+                ['link'],
+                ['unorderedList', 'orderedList'],
+                ['viewHTML']
+            ],
+            smallTextEditorBtn = [
+                ['strong', 'em', 'underline', 'del'],
+                ['link'],
+                ['unorderedList', 'orderedList'],
+            ],
+            customBtnDefs = {
+                formatting: {
+                    dropdown: ['p', 'h1', 'h2', 'h3', 'h4'],
+                    ico: 'p'
+                }
+            },
+            $btnPane, $parent;
+        $(selector).trumbowyg({
+            btns: options.small ? smallTextEditorBtn : defaultBtns,
+            autogrow: true,
+            removeformatPasted: true,
+            urlProtocol: true,
+            defaultLinkTarget: '_blank',
+            btnsDef: options.small ? {} : customBtnDefs
+        }).on('tbwinit', function() {
+            $btnPane = $(this).parent().find('.trumbowyg-button-pane');
+            $parent = $(this).parent();
+            if (options.small) {
+                $parent.addClass('small-texteditor');
+            }
+            if (!options.initialHide) {
+                $btnPane.addClass('trumbowyg-button-pane-hidden');
+                $parent.css('border', '1px solid #e8e9ee');
+            }
+        }).on('tbwblur', function(e) {
+            $btnPane.addClass('trumbowyg-button-pane-hidden');
+            $parent.css('border', '1px solid #e8e9ee');
+        }).on('tbwfocus', function(e) {
+            $btnPane.removeClass('trumbowyg-button-pane-hidden');
+            $parent.css('border', '1px solid #8fa5b1');
+        }).on('tbwchange', function(e) {
+            options.callback ? options.callback(e) : null;
+        }).on('tbwmodalopen', function(e) {
+            $('input[name="title"], input[name="target"]').parent().css('display', 'none');
+        });
+    }
+
+    Utils.sanitizeHtmlContent = function(options) {
+        var editorContent, cleanedContent;
+        editorContent = options.selector ? $(options.selector).trumbowyg('html') : options.data;
+        if (options && editorContent) {
+            cleanedContent = DOMPurify.sanitize(editorContent, { FORBID_TAGS: ['img', 'script', 'iframe', 'embed', 'svg', 'meta'], ALLOWED_ATTR: ['target', 'href'] });
+        }
+        return cleanedContent;
+    }
+    //-----------------------------------------END---------------------//
+
     return Utils;
 });
diff --git a/dashboardv2/public/js/views/business_metadata/BusinessMetadataDetailLayoutView.js b/dashboardv2/public/js/views/business_metadata/BusinessMetadataDetailLayoutView.js
index 422808b..b3d1ff3 100644
--- a/dashboardv2/public/js/views/business_metadata/BusinessMetadataDetailLayoutView.js
+++ b/dashboardv2/public/js/views/business_metadata/BusinessMetadataDetailLayoutView.js
@@ -32,11 +32,16 @@
             /** ui selector cache */
             ui: {
                 title: '[data-id="title"]',
-                description: '[data-id="description"]'
+                description: '[data-id="description"]',
+                textType: '[name="textType"]'
             },
             /** ui events hash */
             events: function() {
                 var events = {};
+                events["change " + this.ui.textType] = function(e) {
+                    this.isTextTypeChecked = !this.isTextTypeChecked;
+                    this.renderDetail();
+                };
                 return events;
             },
             /**
@@ -46,6 +51,7 @@
             initialize: function(options) {
                 _.extend(this, _.pick(options, 'model'));
                 $('body').addClass("detail-page");
+                this.isTextTypeChecked = false;
             },
             onRender: function() {
                 this.renderDetail();
@@ -53,7 +59,7 @@
             renderDetail: function() {
                 this.ui.title.html('<span>' + this.model.get('name') + '</span>');
                 if (this.model.get('description')) {
-                    this.ui.description.text(this.model.get('description'));
+                    this.isTextTypeChecked ? this.ui.description.text(this.model.get('description')) : this.ui.description.html(this.model.get('description'));
                 }
             },
             onDestroy: function() {
diff --git a/dashboardv2/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js b/dashboardv2/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js
index 6527eeb..ccff1fd 100644
--- a/dashboardv2/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js
+++ b/dashboardv2/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js
@@ -215,6 +215,7 @@
                         isNewBusinessMetadata: isNewBusinessMetadata
                     });
                     that.RModal.show(that.view);
+                    Utils.addCustomTextEditor({ small: false });
                 });
             },
             renderTableLayoutView: function() {
@@ -296,7 +297,11 @@
                         editable: false,
                         formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                             fromRaw: function(rawValue, model) {
-                                return _.escape(model.get('description'));
+                                var description = model.get('description');
+                                if (description.length > 50) {
+                                    description = description.substr(0, 50) + "...";
+                                }
+                                return description;
                             }
                         })
                     },
diff --git a/dashboardv2/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js b/dashboardv2/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js
index 21bb663..165b995 100644
--- a/dashboardv2/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js
+++ b/dashboardv2/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js
@@ -223,7 +223,7 @@
                 };
                 this.loaderStatus(true);
                 var name = this.ui.name.val(),
-                    description = this.ui.description.val();
+                    description = Utils.sanitizeHtmlContent({ data: this.ui.description.val() });
                 var attributeObj = this.collection.toJSON();
                 if (this.collection.length === 1 && this.collection.first().get("name") === "") {
                     attributeObj = [];
@@ -240,7 +240,7 @@
                         "version": 1,
                         "typeVersion": "1.1",
                         "name": name.trim(),
-                        "description": description.trim(),
+                        "description": description ? description.trim() : "",
                         "attributeDefs": attributeObj
                     }]
                 };
diff --git a/dashboardv2/public/js/views/entity/EntityBusinessMetaDataItemView.js b/dashboardv2/public/js/views/entity/EntityBusinessMetaDataItemView.js
index ff28506..ad5e28e 100644
--- a/dashboardv2/public/js/views/entity/EntityBusinessMetaDataItemView.js
+++ b/dashboardv2/public/js/views/entity/EntityBusinessMetaDataItemView.js
@@ -100,6 +100,32 @@
                         }
                     }
                 });
+                this.listenTo(this.searchVent, 'BusinessMetaAttribute:Edit', function() {
+                    _.each(that.model.attributes, function(obj) {
+                        if (obj.key) {
+                            if (obj.typeName === "string") {
+                                obj.value = Utils.sanitizeHtmlContent({ data: obj.value });
+                            }
+                            Utils.addCustomTextEditor({
+                                small: true,
+                                selector: "#" + obj.key,
+                                initialHide: false,
+                                callback: function(e) {
+                                    var key = $(e.target).data("key"),
+                                        businessMetadata = $(e.target).data("businessMetadata"),
+                                        typeName = $(e.target).data("typename"),
+                                        updateObj = that.model.toJSON();
+                                    if (_.isUndefinedNull(updateObj[key])) {
+                                        updateObj[key] = { value: null, typeName: typeName };
+                                    }
+                                    updateObj[key].value = Utils.sanitizeHtmlContent({ selector: "#" + obj.key });
+                                    that.model.set(updateObj);
+                                }
+                            });
+                            $("#" + obj.key).trumbowyg('html', obj.value);
+                        }
+                    });
+                });
                 this.$el.off("change", ".custom-col-1[data-id='value']>[data-key]").on("change", ".custom-col-1[data-id='value']>[data-key]", function(e) {
                     var key = $(this).data("key"),
                         businessMetadata = $(this).data("businessMetadata"),
@@ -176,7 +202,13 @@
                     }
                 }
                 if (typeName === "string" || typeName === "array<string>") {
-                    returnEL = '<' + elType + ' type="text" data-key="' + key + '" data-businessMetadata="' + businessMetadata + '" data-typename="' + typeName + '" data-multi="' + isMultiValued + '" data-tags="true"  placeholder="Enter String" class="form-control" ' + (isMultiValued === false && !_.isUndefinedNull(val) ? 'value="' + val + '"' : "") + '></' + elType + '>';
+                    if (typeName === "string") {
+                        elType = "textarea";
+                        returnEL = '<' + elType + ' type="text" data-key="' + key + '" data-businessMetadata="' + businessMetadata + '" data-typename="' + typeName + '" data-multi="' + isMultiValued + '" data-tags="true"  placeholder="Enter String" class="form-control" ' + (isMultiValued === false && !_.isUndefinedNull(val) ? 'value="' + val + '"' : "") + "id =" + businessMetadata.replace(/ /g, "_") + "_" + key.replace(/ /g, "_") + '></' + elType + '>';
+                    } else {
+                        returnEL = '<' + elType + ' type="text" data-key="' + key + '" data-businessMetadata="' + businessMetadata + '" data-typename="' + typeName + '" data-multi="' + isMultiValued + '" data-tags="true"  placeholder="Enter String" class="form-control" ' + (isMultiValued === false && !_.isUndefinedNull(val) ? 'value="' + val + '"' : "") +
+                            '></' + elType + '>';
+                    }
                 } else if (typeName === "boolean" || typeName === "array<boolean>") {
                     returnEL = '<select data-key="' + key + '" data-businessMetadata="' + businessMetadata + '" data-typename="' + typeName + '" data-multi="' + isMultiValued + '" class="form-control">' + (isMultiValued ? "" : '<option value="">--Select Value--</option>') + '<option value="true" ' + (!_.isUndefinedNull(val) && val == "true" ? "selected" : "") + '>true</option><option value="false" ' + (!_.isUndefinedNull(val) && val == "false" ? "selected" : "") + '>false</option></select>';
                 } else if (typeName === "date" || typeName === "array<date>") {
@@ -267,6 +299,30 @@
                     this.model.clear({ silent: true }).set(tempObj)
                 }
                 valEl.html(this.getAttrElement({ businessMetadata: key[0], key: key[1], val: hasModalData ? hasModalData : { typeName: key[2] } }));
+                if (key[2] === "string") {
+                    var that = this,
+                        selector = '#' +  key[0].replace(/ /g, "_") + "_" + key[1].replace(/ /g, "_");
+                    Utils.addCustomTextEditor({
+                        small: true,
+                        selector: selector,
+                        initialHide: false,
+                        callback: function(e) {
+                            var $parent = $(e.target),
+                                key = $parent.data("key"),
+                                businessMetadata = $parent.data("businessMetadata"),
+                                typeName = $parent.data("typename"),
+                                updateObj = that.model.toJSON();
+                            if (_.isUndefinedNull(updateObj[key])) {
+                                updateObj[key] = { value: null, typeName: typeName };
+                            }
+                            updateObj[key].value = Utils.sanitizeHtmlContent({ selector: selector });
+                            that.model.set(updateObj);
+                        }
+                    });
+                    if(hasModalData && hasModalData.value){
+                        $(selector).trumbowyg('html', hasModalData.value);
+                    }
+                }
                 if (manual === undefined) {
                     this.model.collection.trigger("selected:attr", e.currentTarget.value, this.model);
                 }
diff --git a/dashboardv2/public/js/views/entity/EntityBusinessMetaDataView.js b/dashboardv2/public/js/views/entity/EntityBusinessMetaDataView.js
index 213e7cc..7d66dc9 100644
--- a/dashboardv2/public/js/views/entity/EntityBusinessMetaDataView.js
+++ b/dashboardv2/public/js/views/entity/EntityBusinessMetaDataView.js
@@ -41,7 +41,8 @@
                 editMode: this.editMode,
                 entity: this.entity,
                 businessMetadataCollection: this.businessMetadataCollection,
-                enumDefCollection: this.enumDefCollection
+                enumDefCollection: this.enumDefCollection,
+                searchVent: this.searchVent
             };
         },
         templateHelpers: function() {
@@ -69,13 +70,14 @@
         },
         initialize: function(options) {
             var that = this;
-            _.extend(this, _.pick(options, "entity", "businessMetadataCollection", "enumDefCollection", "guid", "fetchCollection"));
+            _.extend(this, _.pick(options, "entity", "businessMetadataCollection", "enumDefCollection", "guid", "fetchCollection", "searchVent"));
             this.editMode = false;
             this.readOnlyEntity = Enums.entityStateReadOnly[this.entity.status];
             this.$("editBox").hide();
             this.actualCollection = new Backbone.Collection(
                 _.map(this.entity.businessAttributes, function(val, key) {
-                    var foundBusinessMetadata = that.businessMetadataCollection[key];
+                    var foundBusinessMetadata = that.businessMetadataCollection[key],
+                        businessMetadata = key;
                     if (foundBusinessMetadata) {
                         _.each(val, function(aVal, aKey) {
                             var foundAttr = _.find(foundBusinessMetadata, function(o) {
@@ -84,7 +86,10 @@
                             if (foundAttr) {
                                 val[aKey] = { value: aVal, typeName: foundAttr.typeName };
                             }
-                        })
+                            if(foundAttr && foundAttr.typeName === "string"){
+                                val[aKey].key = businessMetadata.replace(/ /g, "_") + "_" + aKey.replace(/ /g, "_");;
+                            }
+                        });
                     }
                     return _.extend({}, val, { __internal_UI_businessMetadataName: key });
                 }));
@@ -124,6 +129,7 @@
                 this.createNameElement();
             } else {
                 this.collection.trigger("reset");
+                this.searchVent.trigger("BusinessMetaAttribute:Edit");
             }
             this.panelOpenClose();
         },
@@ -154,6 +160,9 @@
             this.$el.find('.custom-col-1[data-id="value"] [data-key]').each(function(el) {
                 var val = $(this).val(),
                     elIsSelect2 = $(this).hasClass("select2-hidden-accessible");
+                if (val) {
+                    val = Utils.sanitizeHtmlContent({ data: val });
+                }
                 if (_.isString(val)) {
                     val = val.trim();
                 }
@@ -165,6 +174,9 @@
                         $(this).siblings(".select2").find(".select2-selection").attr("style", "border-color : red !important");
                     } else {
                         $(this).css("borderColor", "red");
+                        if($(this).parent().hasClass("small-texteditor")){
+                            $(this).parent().css("borderColor", "red");
+                        }
                     }
                 } else {
                     if (elIsSelect2) {
@@ -262,7 +274,7 @@
                                 newVal = Utils.formatDate({ date: newVal, zone: false, dateFormat: Globals.dateFormat });
                             }
                         }
-                        attrLi += "<tr><td class='business-metadata-detail-attr-key'>" + _.escape(key) + " (" + _.escape(val.typeName) + ")</td><td>" + _.escape(newVal) + "</td></tr>";
+                        attrLi += "<tr><td class='business-metadata-detail-attr-key'>" + _.escape(key) + " (" + _.escape(val.typeName) + ")</td><td>" + ((val.typeName === "string") ? Utils.sanitizeHtmlContent({ data: newVal }) : _.escape(newVal)) + "</td></tr>";
                     }
                 });
                 li += that.associateAttributePanel(obj, attrLi);
diff --git a/dashboardv2/public/js/views/glossary/GlossaryDetailLayoutView.js b/dashboardv2/public/js/views/glossary/GlossaryDetailLayoutView.js
index b070c55..0260606 100644
--- a/dashboardv2/public/js/views/glossary/GlossaryDetailLayoutView.js
+++ b/dashboardv2/public/js/views/glossary/GlossaryDetailLayoutView.js
@@ -307,7 +307,7 @@
                 var longDescriptionContent = (data && data.longDescription) ? data.longDescription : "",
                     sanitizeLongDescriptionContent = "";
                 if (longDescriptionContent !== "") {
-                    sanitizeLongDescriptionContent = Utils.sanitizeHtmlContent(longDescriptionContent);
+                    sanitizeLongDescriptionContent = Utils.sanitizeHtmlContent({ data: longDescriptionContent });
                 }
                 //End
                 if (data) {
diff --git a/dashboardv2/public/js/views/tag/CreateTagLayoutView.js b/dashboardv2/public/js/views/tag/CreateTagLayoutView.js
index 476007a..a0b2104 100644
--- a/dashboardv2/public/js/views/tag/CreateTagLayoutView.js
+++ b/dashboardv2/public/js/views/tag/CreateTagLayoutView.js
@@ -84,7 +84,8 @@
             },
             bindEvents: function() {},
             onRender: function() {
-                var that = this;
+                var that = this,
+                    modalOkBtn;
                 this.$('.fontLoader').show();
                 if (this.create) {
                     this.tagCollectionList();
@@ -94,6 +95,19 @@
                 if (!('placeholder' in HTMLInputElement.prototype)) {
                     this.ui.createTagForm.find('input,textarea').placeholder();
                 }
+                modalOkBtn = function() {
+                    var editorContent = $(that.ui.description).trumbowyg('html'),
+                        okBtn = $('.modal').find('button.ok');
+                    okBtn.removeAttr("disabled");
+                    if (editorContent === "") {
+                        okBtn.prop('disabled', true);
+                    }
+                    if (that.description === editorContent) {
+                        okBtn.prop('disabled', true);
+                    }
+                };
+                Utils.addCustomTextEditor({ selector: this.ui.description, callback: modalOkBtn, small: false });
+                $(this.ui.description).trumbowyg('html', Utils.sanitizeHtmlContent({ data: this.description }));
                 that.hideLoader();
             },
             tagCollectionList: function() {
diff --git a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
index be33e7c..3b26f0e 100644
--- a/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagAttributeDetailLayoutView.js
@@ -47,13 +47,18 @@
                 publishButton: '[data-id="publishButton"]',
                 superType: "[data-id='superType']",
                 subType: "[data-id='subType']",
-                entityType: "[data-id='entityType']"
+                entityType: "[data-id='entityType']",
+                textType: '[name="textType"]'
             },
             /** ui events hash */
             events: function() {
                 var events = {};
                 events["click " + this.ui.addAttribute] = 'onClickAddTagAttributeBtn';
                 events["click " + this.ui.editButton] = 'onEditButton';
+                events["change " + this.ui.textType] = function(e) {
+                    this.isTextTypeChecked = !this.isTextTypeChecked;
+                    this.isTextTypeChecked ? this.ui.description.text(this.model.get("description")) : this.ui.description.html(this.model.get("description"));
+                };
                 return events;
             },
             /**
@@ -62,6 +67,7 @@
              */
             initialize: function(options) {
                 _.extend(this, _.pick(options, 'tag', 'collection', 'enumDefCollection'));
+                this.isTextTypeChecked = false;
             },
             bindEvents: function() {
                 this.listenTo(this.collection, 'reset', function() {
@@ -121,7 +127,7 @@
                     }
                 this.ui.title.html('<span>' + (Utils.getName(this.model.toJSON())) + '</span>');
                 if (this.model.get("description")) {
-                    this.ui.description.text(this.model.get("description"));
+                    this.isTextTypeChecked ? this.ui.description.text(this.model.get("description")) : this.ui.description.html(this.model.get("description"));
                 }
                 if (attributeDefs) {
                     if (!_.isArray(attributeDefs)) {
diff --git a/dashboardv2/public/js/views/tag/TagLayoutView.js b/dashboardv2/public/js/views/tag/TagLayoutView.js
index f7af026..7de7aea 100644
--- a/dashboardv2/public/js/views/tag/TagLayoutView.js
+++ b/dashboardv2/public/js/views/tag/TagLayoutView.js
@@ -403,7 +403,7 @@
                         }).open();
                     modal.$el.find('button.ok').attr("disabled", "true");
                     view.ui.tagName.on('keyup input', function(e) {
-                        view.ui.description.val($(this).val().replace(/\s+/g, ' '));
+                        $(view.ui.description).trumbowyg('html', $(this).val().replace(/\s+/g, ' '));
                     });
                     view.ui.description.on('input keydown', function(e) {
                         $(this).val($(this).val().replace(/\s+/g, ' '));
@@ -448,7 +448,7 @@
                     return;
                 }
                 this.name = ref.ui.tagName.val();
-                this.description = ref.ui.description.val();
+                this.description = Utils.sanitizeHtmlContent({ data: ref.ui.description.val() });
                 var superTypes = [];
                 if (ref.ui.parentTag.val() && ref.ui.parentTag.val()) {
                     superTypes = ref.ui.parentTag.val();
diff --git a/dashboardv3/public/css/scss/override.scss b/dashboardv3/public/css/scss/override.scss
index fec5f6f..1f4a786 100644
--- a/dashboardv3/public/css/scss/override.scss
+++ b/dashboardv3/public/css/scss/override.scss
@@ -567,7 +567,7 @@
     margin-right: 0px !important;
 }
 
-.glossary-longdescription-wrapper {
+.longdescription-wrapper {
     display: inline-block;
     height: 100px;
     background-color: #fff !important;
@@ -630,4 +630,10 @@
 
 .user-circle {
     display: inline;
+}
+
+.business-metadata-detail-attr {
+    ul {
+        list-style: disc
+    }
 }
\ No newline at end of file
diff --git a/dashboardv3/public/css/scss/texteditor.scss b/dashboardv3/public/css/scss/texteditor.scss
index 275bdcc..e05cf4d 100644
--- a/dashboardv3/public/css/scss/texteditor.scss
+++ b/dashboardv3/public/css/scss/texteditor.scss
@@ -19,14 +19,29 @@
 
 .trumbowyg {
     border-radius: 4px !important;
-    min-height: 150px !important;
+    min-height: 106px !important;
 
     .trumbowyg-button-pane {
-        background-color: #f6f7fb !important;
+        background: none;
+        border-bottom: none;
+        position: absolute;
+        bottom: 0px;
+
+        button {
+            transition: none;
+        }
+    }
+
+    .trumbowyg-button-pane-hidden {
+        display: none;
+    }
+
+    .trumbowyg-button-pane::after {
+        background: none !important;
     }
 
     .trumbowyg-editor {
-        min-height: 150px !important;
+        min-height: 70px !important;
         overflow-wrap: break-word;
     }
 
@@ -35,7 +50,19 @@
     }
 
     .trumbowyg-textarea {
-        min-height: 150px !important;
+        min-height: 106px !important;
+    }
+
+    .trumbowyg-button-pane .trumbowyg-button-group::after {
+        height: 25px;
+        vertical-align: middle;
+    }
+
+    .trumbowyg-button-pane button.trumbowyg-active,
+    .trumbowyg-button-pane button:not(.trumbowyg-disable):focus,
+    .trumbowyg-button-pane button:not(.trumbowyg-disable):hover {
+        background-color: #e8e9ee;
+        border-radius: 20px;
     }
 }
 
@@ -62,15 +89,31 @@
     width: 101px !important;
 }
 
-.trumbowyg-h1-dropdown-button{
+.trumbowyg-h1-dropdown-button {
     font-size: 36px !important;
 }
-.trumbowyg-h2-dropdown-button{
+
+.trumbowyg-h2-dropdown-button {
     font-size: 30px !important;
 }
-.trumbowyg-h3-dropdown-button{
+
+.trumbowyg-h3-dropdown-button {
     font-size: 24px !important;
 }
-.trumbowyg-h4-dropdown-button{
+
+.trumbowyg-h4-dropdown-button {
     font-size: 18px !important;
+}
+
+.small-texteditor {
+    .trumbowyg-button-pane button {
+        width: 25px !important;
+        height: 25px !important;
+    }
+    .trumbowyg-button-pane button.trumbowyg-active,
+    .trumbowyg-button-pane button:not(.trumbowyg-disable):focus,
+    .trumbowyg-button-pane button:not(.trumbowyg-disable):hover {
+        background-color: #e8e9ee;
+        border-radius: 20px;
+    }
 }
\ No newline at end of file
diff --git a/dashboardv3/public/js/external_lib/trumbowyg/trumbowyg.js b/dashboardv3/public/js/external_lib/trumbowyg/trumbowyg.js
index 7ef6d17..fca7664 100644
--- a/dashboardv3/public/js/external_lib/trumbowyg/trumbowyg.js
+++ b/dashboardv3/public/js/external_lib/trumbowyg/trumbowyg.js
@@ -9,4 +9,4 @@
  *         Twitter : @AlexandreDemode
  *         Website : alex-d.fr
  */
-jQuery.trumbowyg={langs:{en:{viewHTML:"Plain Text",undo:"Undo",redo:"Redo",formatting:"Formatting",p:"Paragraph",blockquote:"Quote",code:"Code",header:"Header",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",underline:"Underline",strong:"Strong",em:"Emphasis",del:"Deleted",superscript:"Superscript",subscript:"Subscript",unorderedList:"Unordered list",orderedList:"Ordered list",insertImage:"Insert Image",link:"Link",createLink:"Insert link",unlink:"Remove link",justifyLeft:"Align Left",justifyCenter:"Align Center",justifyRight:"Align Right",justifyFull:"Align Justify",horizontalRule:"Insert horizontal rule",removeformat:"Remove format",fullscreen:"Fullscreen",close:"Close",submit:"Confirm",reset:"Cancel",required:"Required",description:"Description",title:"Title",text:"Text",target:"Target",width:"Width"}},plugins:{},svgPath:null,svgAbsoluteUseHref:!1,hideButtonTexts:null},Object.defineProperty(jQuery.trumbowyg,"defaultOptions",{value:{lang:"en",fixedBtnPane:!1,fixedFullWidth:!1,autogrow:!1,autogrowOnEnter:!1,imageWidthModalEdit:!1,hideButtonTexts:null,prefix:"trumbowyg-",tagClasses:{},semantic:!0,semanticKeepAttributes:!1,resetCss:!1,removeformatPasted:!1,tabToIndent:!1,tagsToRemove:[],tagsToKeep:["hr","img","embed","iframe","input"],btns:[["viewHTML"],["undo","redo"],["formatting"],["strong","em","del"],["superscript","subscript"],["link"],["insertImage"],["justifyLeft","justifyCenter","justifyRight","justifyFull"],["unorderedList","orderedList"],["horizontalRule"],["removeformat"],["fullscreen"]],btnsDef:{},changeActiveDropdownIcon:!1,inlineElementsSelector:"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u",pasteHandlers:[],plugins:{},urlProtocol:!1,minimalLinks:!1,defaultLinkTarget:void 0,svgPath:null},writable:!1,enumerable:!0,configurable:!1}),function(l,d,c,u){"use strict";var g="tbwconfirm",h="tbwcancel";u.fn.trumbowyg=function(e,t){var n="trumbowyg";if(e===Object(e)||!e)return this.each(function(){u(this).data(n)||u(this).data(n,new o(this,e))});if(1===this.length)try{var a=u(this).data(n);switch(e){case"execCmd":return a.execCmd(t.cmd,t.param,t.forceCss,t.skipTrumbowyg);case"openModal":return a.openModal(t.title,t.content);case"closeModal":return a.closeModal();case"openModalInsert":return a.openModalInsert(t.title,t.fields,t.callback);case"saveRange":return a.saveRange();case"getRange":return a.range;case"getRangeText":return a.getRangeText();case"restoreRange":return a.restoreRange();case"enable":return a.setDisabled(!1);case"disable":return a.setDisabled(!0);case"toggle":return a.toggle();case"destroy":return a.destroy();case"empty":return a.empty();case"html":return a.html(t)}}catch(e){}return!1};var o=function(e,t){var n=this,a="trumbowyg-icons",o=u.trumbowyg;n.doc=e.ownerDocument||c,n.$ta=u(e),n.$c=u(e),null!=(t=t||{}).lang||null!=o.langs[t.lang]?n.lang=u.extend(!0,{},o.langs.en,o.langs[t.lang]):n.lang=o.langs.en,n.hideButtonTexts=(null!=o.hideButtonTexts?o:t).hideButtonTexts;var r,i=(null!=o.svgPath?o:t).svgPath;n.hasSvg=!1!==i,!1===i||!o.svgAbsoluteUseHref&&0!==u("#"+a,n.doc).length||(null==i&&u("script[src]").each(function(e,t){var n=t.src,t=n.match("trumbowyg(.min)?.js");null!=t&&(i=n.substring(0,n.indexOf(t[0]))+"ui/icons.svg")}),null==i?console.warn("You must define svgPath: https://goo.gl/CfTY9U"):o.svgAbsoluteUseHref||((r=n.doc.createElement("div")).id=a,n.doc.body.insertBefore(r,n.doc.body.childNodes[0]),u.ajax({async:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"xml",crossDomain:!0,url:i,data:null,beforeSend:null,complete:null,success:function(e){r.innerHTML=(new XMLSerializer).serializeToString(e.documentElement)}})));var s=n.doc.querySelector("base")?d.location.href.split(/[?#]/)[0]:"";n.svgPath=o.svgAbsoluteUseHref?i:s;a=n.lang.header,s=function(){return(d.chrome||d.Intl&&Intl.v8BreakIterator)&&"CSS"in d};n.btnsDef={viewHTML:{fn:"toggle",class:"trumbowyg-not-disable",name1:"name1"},undo:{isSupported:s,key:"Z"},redo:{isSupported:s,key:"Y"},p:{fn:"formatBlock"},blockquote:{fn:"formatBlock"},h1:{fn:"formatBlock",title:a+" 1"},h2:{fn:"formatBlock",title:a+" 2"},h3:{fn:"formatBlock",title:a+" 3"},h4:{fn:"formatBlock",title:a+" 4"},h5:{fn:"formatBlock",title:a+" 5"},h6:{fn:"formatBlock",title:a+" 6"},subscript:{tag:"sub"},superscript:{tag:"sup"},bold:{key:"B",tag:"b"},italic:{key:"I",tag:"i"},underline:{tag:"u"},strikethrough:{tag:"strike"},strong:{fn:"bold",key:"B"},em:{fn:"italic",key:"I"},del:{fn:"strikethrough"},createLink:{key:"K",tag:"a"},unlink:{},insertImage:{},justifyLeft:{tag:"left",forceCss:!0},justifyCenter:{tag:"center",forceCss:!0},justifyRight:{tag:"right",forceCss:!0},justifyFull:{tag:"justify",forceCss:!0},unorderedList:{fn:"insertUnorderedList",tag:"ul"},orderedList:{fn:"insertOrderedList",tag:"ol"},horizontalRule:{fn:"insertHorizontalRule"},removeformat:{},fullscreen:{class:"trumbowyg-not-disable"},close:{fn:"destroy",class:"trumbowyg-not-disable"},formatting:{dropdown:["p","h1","h2","h3","h4"],ico:"p"},link:{dropdown:["createLink","unlink"]}},n.o=u.extend(!0,{},o.defaultOptions,t),n.o.hasOwnProperty("imgDblClickHandler")||(n.o.imgDblClickHandler=n.getDefaultImgDblClickHandler()),n.urlPrefix=n.setupUrlPrefix(),n.disabled=n.o.disabled||"TEXTAREA"===e.nodeName&&e.disabled,t.btns?n.o.btns=t.btns:n.o.semantic||(n.o.btns[3]=["bold","italic","underline","strikethrough"]),u.each(n.o.btnsDef,function(e,t){n.addBtnDef(e,t)}),n.eventNamespace="trumbowyg-event",n.keys=[],n.tagToButton={},n.tagHandlers=[],n.pasteHandlers=[].concat(n.o.pasteHandlers),n.isIE=-1!==l.userAgent.indexOf("MSIE")||-1!==l.appVersion.indexOf("Trident/"),n.isMac=-1!==l.platform.toUpperCase().indexOf("MAC"),n.init()};o.prototype={DEFAULT_SEMANTIC_MAP:{b:"strong",i:"em",s:"del",strike:"del",div:"p"},init:function(){var e=this;e.height=e.$ta.height(),e.initPlugins();try{e.doc.execCommand("enableObjectResizing",!1,!1),e.doc.execCommand("defaultParagraphSeparator",!1,"p")}catch(e){}e.buildEditor(),e.buildBtnPane(),e.fixedBtnPaneEvents(),e.buildOverlay(),setTimeout(function(){e.disabled&&e.setDisabled(!0),e.$c.trigger("tbwinit")})},addBtnDef:function(e,t){this.btnsDef[e]=u.extend(t,this.btnsDef[e]||{})},setupUrlPrefix:function(){var e=this.o.urlProtocol;if(e)return"string"!=typeof e?"https://":e.replace("://","")+"://"},buildEditor:function(){var a=this,t=a.o.prefix,e="";a.$box=u("<div/>",{class:t+"box "+t+"editor-visible "+t+a.o.lang+" trumbowyg"}),a.isTextarea=a.$ta.is("textarea"),a.isTextarea?(e=a.$ta.val(),a.$ed=u("<div/>"),a.$box.insertAfter(a.$ta).append(a.$ed,a.$ta)):(a.$ed=a.$ta,e=a.$ed.html(),a.$ta=u("<textarea/>",{name:a.$ta.attr("id"),height:a.height}).val(e),a.$box.insertAfter(a.$ed).append(a.$ta,a.$ed),a.syncCode()),a.$ta.addClass(t+"textarea").attr("tabindex",-1),a.$ed.addClass(t+"editor").attr({contenteditable:!0,dir:a.lang._dir||"ltr"}).html(e),a.o.tabindex&&a.$ed.attr("tabindex",a.o.tabindex),a.$c.is("[placeholder]")&&a.$ed.attr("placeholder",a.$c.attr("placeholder")),a.$c.is("[spellcheck]")&&a.$ed.attr("spellcheck",a.$c.attr("spellcheck")),a.o.resetCss&&a.$ed.addClass(t+"reset-css"),a.o.autogrow||a.$ta.add(a.$ed).css({height:a.height}),a.semanticCode(),a.o.autogrowOnEnter&&a.$ed.addClass(t+"autogrow-on-enter");var n,o=!1,r=!1;a.$ed.on("dblclick","img",a.o.imgDblClickHandler).on("keydown",function(e){var t=e.which;if(8!==t&&13!==t&&46!==t||a.toggleSpan(!0),!e.ctrlKey&&!e.metaKey||e.altKey){if(a.o.tabToIndent&&"Tab"===e.key)try{return e.shiftKey?a.execCmd("outdent",!0,null):a.execCmd("indent",!0,null),!1}catch(e){}}else{o=!0;var n=a.keys[String.fromCharCode(e.which).toUpperCase()];try{return a.execCmd(n.fn,n.param),!1}catch(e){}}}).on("compositionstart compositionupdate",function(){r=!0}).on("keyup compositionend",function(e){if("compositionend"===e.type)r=!1;else if(r)return;var t=e.which;37<=t&&t<=40||(8!==t&&13!==t&&46!==t||a.toggleSpan(),!e.ctrlKey&&!e.metaKey||89!==t&&90!==t?o||17===t?void 0===e.which&&a.semanticCode(!1,!1,!0):(e=!a.isIE||"compositionend"===e.type,a.semanticCode(!1,e&&13===t),a.$c.trigger("tbwchange")):(a.semanticCode(!1,!0),a.$c.trigger("tbwchange")),setTimeout(function(){o=!1},50))}).on("mouseup keydown keyup",function(e){(e.ctrlKey||e.metaKey)&&!e.altKey||setTimeout(function(){o=!1},50),clearTimeout(n),n=setTimeout(function(){a.updateButtonPaneStatus()},50)}).on("focus blur",function(e){"blur"===e.type&&a.clearButtonPaneStatus(),a.$c.trigger("tbw"+e.type),a.o.autogrowOnEnter&&(a.autogrowOnEnterDontClose||("focus"===e.type?(a.autogrowOnEnterWasFocused=!0,a.autogrowEditorOnEnter()):a.o.autogrow||(a.$ed.css({height:a.$ed.css("min-height")}),a.$c.trigger("tbwresize"))))}).on("keyup focus",function(){a.$ta.val().match(/<.*>/)||a.$ed.html().match(/<.*>/)||setTimeout(function(){var e=a.isIE?"<p>":"p";a.doc.execCommand("formatBlock",!1,e),a.syncCode()},0)}).on("cut drop",function(){setTimeout(function(){a.semanticCode(!1,!0),a.$c.trigger("tbwchange")},0)}).on("paste",function(n){if(a.o.removeformatPasted){n.preventDefault(),d.getSelection&&d.getSelection().deleteFromDocument&&d.getSelection().deleteFromDocument();try{var t=d.clipboardData.getData("Text");try{a.doc.selection.createRange().pasteHTML(t)}catch(e){a.doc.getSelection().getRangeAt(0).insertNode(a.doc.createTextNode(t))}a.$c.trigger("tbwchange",n)}catch(e){a.execCmd("insertText",(n.originalEvent||n).clipboardData.getData("text/plain"))}}u.each(a.pasteHandlers,function(e,t){t(n)}),setTimeout(function(){a.semanticCode(!1,!0),a.$c.trigger("tbwpaste",n),a.$c.trigger("tbwchange")},0)}),a.$ta.on("keyup",function(){a.$c.trigger("tbwchange")}).on("paste",function(){setTimeout(function(){a.$c.trigger("tbwchange")},0)}),u(a.doc.body).on("keydown."+a.eventNamespace,function(e){if(27===e.which&&1<=u("."+t+"modal-box").length)return a.closeModal(),!1})},autogrowEditorOnEnter:function(){var e=this;e.$ed.removeClass("autogrow-on-enter");var t=e.$ed[0].clientHeight;e.$ed.height("auto");var n=e.$ed[0].scrollHeight;e.$ed.addClass("autogrow-on-enter"),t!==n&&(e.$ed.height(t),setTimeout(function(){e.$ed.css({height:n}),e.$c.trigger("tbwresize")},0))},buildBtnPane:function(){var a=this,o=a.o.prefix,r=a.$btnPane=u("<div/>",{class:o+"button-pane"});u.each(a.o.btns,function(e,t){u.isArray(t)||(t=[t]);var n=u("<div/>",{class:o+"button-group "+(0<=t.indexOf("fullscreen")?o+"right":"")});u.each(t,function(e,t){try{a.isSupportedBtn(t)&&n.append(a.buildBtn(t))}catch(e){}}),0<n.html().trim().length&&r.append(n)}),a.$box.prepend(r)},buildBtn:function(e){var n,a=this,t=a.o.prefix,o=a.btnsDef[e],r=o.dropdown,i=null==o.hasIcon||o.hasIcon,s=a.lang[e]||e,l=u("<button/>",{type:"button",class:t+e+"-button "+(o.class||"")+(i?"":" "+t+"textual-button"),html:!o.name1&&a.hasSvg&&i?'<svg><use xlink:href="'+a.svgPath+"#"+t+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>':a.hideButtonTexts?"":o.text||o.title||a.lang[e]||e,title:(o.title||o.text||s)+(o.key?" ("+(a.isMac?"Cmd":"Ctrl")+" + "+o.key+")":""),tabindex:-1,mousedown:function(){return r&&!u("."+e+"-"+t+"dropdown",a.$box).is(":hidden")||u("body",a.doc).trigger("mousedown"),(!a.$btnPane.hasClass(t+"disable")&&!a.$box.hasClass(t+"disabled")||u(this).hasClass(t+"active")||u(this).hasClass(t+"not-disable"))&&a.execCmd((!r?o.fn:"dropdown")||e,o.param||e,o.forceCss),!1}});return r?(l.addClass(t+"open-dropdown"),(s={class:(i=t+"dropdown")+"-"+e+" "+i+" "+t+"fixed-top "+(o.dropdownClass||"")})["data-"+i]=e,n=u("<div/>",s),u.each(r,function(e,t){a.btnsDef[t]&&a.isSupportedBtn(t)&&n.append(a.buildSubBtn(t))}),a.$box.append(n.hide())):o.key&&(a.keys[o.key]={fn:o.fn||e,param:o.param||e}),r||(a.tagToButton[(o.tag||e).toLowerCase()]=e),l},buildSubBtn:function(e){var t=this,n=t.o.prefix,a=t.btnsDef[e],o=null==a.hasIcon||a.hasIcon;return a.key&&(t.keys[a.key]={fn:a.fn||e,param:a.param||e}),t.tagToButton[(a.tag||e).toLowerCase()]=e,u("<button/>",{type:"button",class:n+e+"-dropdown-button "+(a.class||"")+(a.ico?" "+n+a.ico+"-button":""),html:t.hasSvg&&o?'<svg><use xlink:href="'+t.svgPath+"#"+n+(a.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>'+(a.text||a.title||t.lang[e]||e):a.text||a.title||t.lang[e]||e,title:a.key?"("+(t.isMac?"Cmd":"Ctrl")+" + "+a.key+")":null,style:a.style||null,mousedown:function(){return u("body",t.doc).trigger("mousedown"),t.execCmd(a.fn||e,a.param||e,a.forceCss),!1}})},isSupportedBtn:function(e){try{return this.btnsDef[e].isSupported()}catch(e){}return!0},buildOverlay:function(){return this.$overlay=u("<div/>",{class:this.o.prefix+"overlay"}).appendTo(this.$box),this.$overlay},showOverlay:function(){u(d).trigger("scroll"),this.$overlay.fadeIn(200),this.$box.addClass(this.o.prefix+"box-blur")},hideOverlay:function(){this.$overlay.fadeOut(50),this.$box.removeClass(this.o.prefix+"box-blur")},fixedBtnPaneEvents:function(){var o=this,r=o.o.fixedFullWidth,i=o.$box;o.o.fixedBtnPane&&(o.isFixed=!1,u(d).on("scroll."+o.eventNamespace+" resize."+o.eventNamespace,function(){var e,t,n,a;i&&(o.syncCode(),e=u(d).scrollTop(),t=i.offset().top+1,a=(n=o.$btnPane).outerHeight()-2,0<e-t&&e-t-o.height<0?(o.isFixed||(o.isFixed=!0,n.css({position:"fixed",top:0,left:r?0:"auto",zIndex:7}),o.$box.css({paddingTop:n.height()})),n.css({width:r?"100%":i.width()-1}),u("."+o.o.prefix+"fixed-top",i).css({position:r?"fixed":"absolute",top:r?a:e-t+a,zIndex:15})):o.isFixed&&(o.isFixed=!1,n.removeAttr("style"),o.$box.css({paddingTop:0}),u("."+o.o.prefix+"fixed-top",i).css({position:"absolute",top:a})))}))},setDisabled:function(e){var t=this,n=t.o.prefix;(t.disabled=e)?t.$ta.attr("disabled",!0):t.$ta.removeAttr("disabled"),t.$box.toggleClass(n+"disabled",e),t.$ed.attr("contenteditable",!e)},destroy:function(){var e=this,t=e.o.prefix;e.isTextarea?e.$box.after(e.$ta.css({height:""}).val(e.html()).removeClass(t+"textarea").show()):e.$box.after(e.$ed.css({height:""}).removeClass(t+"editor").removeAttr("contenteditable").removeAttr("dir").html(e.html()).show()),e.$ed.off("dblclick","img"),e.destroyPlugins(),e.$box.remove(),e.$c.removeData("trumbowyg"),u("body").removeClass(t+"body-fullscreen"),e.$c.trigger("tbwclose"),u(d).off("scroll."+e.eventNamespace+" resize."+e.eventNamespace),u(e.doc.body).off("keydown."+e.eventNamespace)},empty:function(){this.$ta.val(""),this.syncCode(!0)},toggle:function(){var e=this,t=e.o.prefix;e.o.autogrowOnEnter&&(e.autogrowOnEnterDontClose=!e.$box.hasClass(t+"editor-hidden")),e.semanticCode(!1,!0),e.$c.trigger("tbwchange"),setTimeout(function(){e.doc.activeElement.blur(),e.$box.toggleClass(t+"editor-hidden "+t+"editor-visible"),e.$btnPane.toggleClass(t+"disable"),e.$btnPane.find(".trumbowyg-viewHTML-button").text(e.$box.hasClass(t+"editor-hidden")?"Formatted Text":"Plain Text").attr("data-original-title",e.$box.hasClass(t+"editor-hidden")?"Fomatted Text":"Plain Text"),u("."+t+"viewHTML-button",e.$btnPane).toggleClass(t+"active"),e.$box.hasClass(t+"editor-visible")?e.$ta.attr("tabindex",-1):e.$ta.removeAttr("tabindex"),e.o.autogrowOnEnter&&!e.autogrowOnEnterDontClose&&e.autogrowEditorOnEnter()},0)},toggleSpan:function(e){this.$ed.find("span").each(function(){!0===e?u(this).attr("data-tbw-flag",!0):u(this).attr("data-tbw-flag")?u(this).removeAttr("data-tbw-flag"):u(this).contents().unwrap()})},dropdown:function(e){var t=this,n=u("body",t.doc),a=t.o.prefix,o=u("[data-"+a+"dropdown="+e+"]",t.$box),r=u("."+a+e+"-button",t.$btnPane),e=o.is(":hidden");n.trigger("mousedown"),e&&(e=r.offset().left,r.addClass(a+"active"),o.css({position:"absolute",top:r.offset().top-t.$btnPane.offset().top+r.outerHeight(),left:t.o.fixedFullWidth&&t.isFixed?e:e-t.$btnPane.offset().left}).show(),u(d).trigger("scroll"),n.on("mousedown."+t.eventNamespace,function(e){o.is(e.target)||(u("."+a+"dropdown",t.$box).hide(),u("."+a+"active",t.$btnPane).removeClass(a+"active"),n.off("mousedown."+t.eventNamespace))}))},html:function(e){var t=this;return null!=e?(t.$ta.val(e),t.syncCode(!0),t.$c.trigger("tbwchange"),t):t.$ta.val()},syncTextarea:function(){var e=this;e.$ta.val(0<e.$ed.text().trim().length||0<e.$ed.find(e.o.tagsToKeep.join(",")).length?e.$ed.html():"")},syncCode:function(e){var t,n=this;!e&&n.$ed.is(":visible")?n.syncTextarea():(t=u("<div>").html(n.$ta.val()),t=u("<div>").append(t),u(n.o.tagsToRemove.join(","),t).remove(),n.$ed.html(t.contents().html())),n.o.autogrow&&(n.height=n.$ed.height(),n.height!==n.$ta.css("height")&&(n.$ta.css({height:n.height}),n.$c.trigger("tbwresize"))),n.o.autogrowOnEnter&&(n.$ed.height("auto"),(t=n.autogrowOnEnterWasFocused?n.$ed[0].scrollHeight:n.$ed.css("min-height"))!==n.$ta.css("height")&&(n.$ed.css({height:t}),n.$c.trigger("tbwresize")))},semanticCode:function(e,t,n){var a=this;a.saveRange(),a.syncCode(e);var o,r,i,e=!0;a.range&&a.range.collapsed&&(e=!1),a.o.semantic&&(a.semanticTag("b",a.o.semanticKeepAttributes),a.semanticTag("i",a.o.semanticKeepAttributes),a.semanticTag("s",a.o.semanticKeepAttributes),a.semanticTag("strike",a.o.semanticKeepAttributes),t&&(o=a.o.inlineElementsSelector,r=":not("+o+")",a.$ed.contents().filter(function(){return 3===this.nodeType&&0<this.nodeValue.trim().length}).wrap("<span data-tbw/>"),(i=function(e){var t;0!==e.length&&(e=(t=e.nextUntil(r).addBack().wrapAll("<p/>").parent()).nextAll(o).first(),t.next("br").remove(),i(e))})(a.$ed.children(o).first()),a.semanticTag("div",!0),u("[data-tbw]",a.$ed).contents().unwrap(),a.$ed.find("p:empty").remove()),!n&&e&&a.restoreRange(),a.syncTextarea())},semanticTag:function(e,a,t){var o,r=this,n=e;if(null!=this.o.semantic&&"object"==typeof this.o.semantic&&this.o.semantic.hasOwnProperty(e))o=this.o.semantic[e];else{if(!0!==this.o.semantic||!this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(e))return;o=this.DEFAULT_SEMANTIC_MAP[e]}t&&(e=o,o=n),u(e,this.$ed).each(function(){var e=!1,t=u(this);if(0===t.contents().length)return!1;r.range.startContainer.parentNode&&r.range.startContainer.parentNode===this&&(e=!0);var n=u("<"+o+"/>");n.insertBefore(t),a&&u.each(t.prop("attributes"),function(){n.attr(this.name,this.value)}),n.html(t.html()),t.remove(),!0===e&&(r.range.selectNodeContents(n.get(0)),r.range.collapse(!1))})},createLink:function(){for(var e,t,n,a=this,o=a.doc.getSelection(),r=o.getRangeAt(0),i=o.focusNode,s=(new XMLSerializer).serializeToString(r.cloneContents())||r+"";["A","DIV"].indexOf(i.nodeName)<0;)i=i.parentNode;i&&"A"===i.nodeName&&(s=(r=u(i)).text(),n=r.attr("href"),a.o.minimalLinks||(e=r.attr("title"),t=r.attr("target")||a.o.defaultLinkTarget),(r=a.doc.createRange()).selectNode(i),o.removeAllRanges(),o.addRange(r)),a.saveRange();s={url:{label:a.lang.linkUrl||"URL",required:!0,value:n},text:{label:a.lang.text,value:s}};a.o.minimalLinks||u.extend(s,{title:{label:a.lang.title,value:e},target:{label:a.lang.target,value:t}}),a.openModalInsert(a.lang.createLink,s,function(e){var t=a.prependUrlPrefix(e.url);if(!t.length)return!1;t=u(['<a href="',t,'">',e.text||e.url,"</a>"].join(""));return e.title&&t.attr("title",e.title),(e.target||a.o.defaultLinkTarget)&&t.attr("target",e.target||a.o.defaultLinkTarget),a.range.deleteContents(),a.range.insertNode(t[0]),a.syncCode(),a.$c.trigger("tbwchange"),!0})},prependUrlPrefix:function(e){if(!this.urlPrefix)return e;if(/^([a-z][-+.a-z0-9]*:|\/|#)/i.test(e))return e;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?"mailto:"+e:this.urlPrefix+e},unlink:function(){var e,t=this.doc.getSelection(),n=t.focusNode;if(t.isCollapsed){for(;["A","DIV"].indexOf(n.nodeName)<0;)n=n.parentNode;n&&"A"===n.nodeName&&((e=this.doc.createRange()).selectNode(n),t.removeAllRanges(),t.addRange(e))}this.execCmd("unlink",void 0,void 0,!0)},insertImage:function(){var n=this;n.saveRange();var e={url:{label:"URL",required:!0},alt:{label:n.lang.description,value:n.getRangeText()}};n.o.imageWidthModalEdit&&(e.width={}),n.openModalInsert(n.lang.insertImage,e,function(e){n.execCmd("insertImage",e.url,!1,!0);var t=u('img[src="'+e.url+'"]:not([alt])',n.$box);return t.attr("alt",e.alt),n.o.imageWidthModalEdit&&t.attr({width:e.width}),n.syncCode(),n.$c.trigger("tbwchange"),!0})},fullscreen:function(){var e=this,t=e.o.prefix,n=t+"fullscreen",a=n+"-placeholder",o=e.$box.outerHeight();e.$box.toggleClass(n),(n=e.$box.hasClass(n))?e.$box.before(u("<div/>",{class:a}).css({height:o})):u("."+a).remove(),u("body").toggleClass(t+"body-fullscreen",n),u(d).trigger("scroll"),e.$c.trigger("tbw"+(n?"open":"close")+"fullscreen")},execCmd:function(t,n,e,a){var o=this;a=!!a||"","dropdown"!==t&&o.$ed.focus(),"strikethrough"===t&&o.o.semantic&&o.semanticTag("strike",o.o.semanticKeepAttributes,!0);try{o.doc.execCommand("styleWithCSS",!1,e||!1)}catch(e){}try{o[t+a](n)}catch(e){try{t(n)}catch(e){"insertHorizontalRule"===t?n=void 0:"formatBlock"===t&&o.isIE&&(n="<"+n+">"),o.doc.execCommand(t,!1,n),o.syncCode(),o.semanticCode(!1,!0);try{var r=d.getSelection().focusNode;u(d.getSelection().focusNode.parentNode).hasClass("trumbowyg-editor")||(r=d.getSelection().focusNode.parentNode);var i=o.o.tagClasses[n];i&&u(r).addClass(i)}catch(e){}}"dropdown"!==t&&(o.updateButtonPaneStatus(),o.$c.trigger("tbwchange"))}},openModal:function(e,t,n){var a=this,o=a.o.prefix;if(n=!1!==n,0<u("."+o+"modal-box",a.$box).length)return!1;a.o.autogrowOnEnter&&(a.autogrowOnEnterDontClose=!0),a.saveRange(),a.showOverlay(),a.$btnPane.addClass(o+"disable");var r=u("<div/>",{class:o+"modal "+o+"fixed-top"}).css({top:a.$box.offset().top+a.$btnPane.height(),zIndex:99999}).appendTo(u(a.doc.body));a.$overlay.one("click",function(){return r.trigger(h),!1}),t=n?u("<form/>",{action:"",html:t}).on("submit",function(){return r.trigger(g),!1}).on("reset",function(){return r.trigger(h),!1}).on("submit reset",function(){a.o.autogrowOnEnter&&(a.autogrowOnEnterDontClose=!1)}):t;t=u("<div/>",{class:o+"modal-box",html:t}).css({top:"-"+a.$btnPane.outerHeight(),opacity:0,paddingBottom:n?null:"5%"}).appendTo(r).animate({top:0,opacity:1},100);return e&&u("<span/>",{text:e,class:o+"modal-title"}).prependTo(t),n&&(u("input:first",t).focus(),a.buildModalBtn("submit",t),a.buildModalBtn("reset",t),r.height(t.outerHeight()+10)),u(d).trigger("scroll"),a.$c.trigger("tbwmodalopen"),r},buildModalBtn:function(e,t){var n=this.o.prefix;return u("<button/>",{class:n+"modal-button "+n+"modal-"+e,type:e,text:this.lang[e]||e}).appendTo(u("form",t))},closeModal:function(){var e=this,t=e.o.prefix;e.$btnPane.removeClass(t+"disable"),e.$overlay.off();var n=u("."+t+"modal-box",u(e.doc.body));n.animate({top:"-"+n.height()},100,function(){n.parent().remove(),e.hideOverlay(),e.$c.trigger("tbwmodalclose")}),e.restoreRange()},openModalInsert:function(e,t,n){var s=this,r=s.o.prefix,i=s.lang,l="";return u.each(t,function(e,t){var n=t.label||e,a=t.name||e,o=t.attributes||{},e=Object.keys(o).map(function(e){return e+'="'+o[e]+'"'}).join(" ");l+='<label><input type="'+(t.type||"text")+'" name="'+a+'"'+("checkbox"===t.type&&t.value?' checked="checked"':' value="'+(t.value||"").replace(/"/g,"&quot;"))+'"'+e+'><span class="'+r+'input-infos"><span>'+(i[n]||n)+"</span></span></label>"}),s.openModal(e,l).on(g,function(){var o=u("form",u(this)),r=!0,i={};u.each(t,function(e,t){var n=t.name||e,a=u('input[name="'+n+'"]',o);switch(a.attr("type").toLowerCase()){case"checkbox":i[n]=a.is(":checked");break;case"radio":i[n]=a.filter(":checked").val();break;default:i[n]=u.trim(a.val())}t.required&&""===i[n]?(r=!1,s.addErrorOnModalField(a,s.lang.required)):t.pattern&&!t.pattern.test(i[n])&&(r=!1,s.addErrorOnModalField(a,t.patternError))}),r&&(s.restoreRange(),n(i,t)&&(s.syncCode(),s.$c.trigger("tbwchange"),s.closeModal(),u(this).off(g)))}).one(h,function(){u(this).off(g),s.closeModal()})},addErrorOnModalField:function(e,t){var n=this.o.prefix,a=n+"msg-error",o=e.parent();e.on("change keyup",function(){o.removeClass(n+"input-error"),setTimeout(function(){o.find("."+a).remove()},150)}),o.addClass(n+"input-error").find("input+span").append(u("<span/>",{class:a,text:t}))},getDefaultImgDblClickHandler:function(){var a=this;return function(){var t=u(this),e=t.attr("src"),n="(Base64)";0===e.indexOf("data:image")&&(e=n);e={url:{label:"URL",value:e,required:!0},alt:{label:a.lang.description,value:t.attr("alt")}};return a.o.imageWidthModalEdit&&(e.width={value:t.attr("width")?t.attr("width"):""}),a.openModalInsert(a.lang.insertImage,e,function(e){return e.url!==n&&t.attr({src:e.url}),t.attr({alt:e.alt}),a.o.imageWidthModalEdit&&(0<parseInt(e.width)?t.attr({width:e.width}):t.removeAttr("width")),!0}),!1}},saveRange:function(){var e,t=this,n=t.doc.getSelection();t.range=null,n&&n.rangeCount&&(e=t.range=n.getRangeAt(0),(n=t.doc.createRange()).selectNodeContents(t.$ed[0]),n.setEnd(e.startContainer,e.startOffset),n=(n+"").length,t.metaRange={start:n,end:n+(e+"").length})},restoreRange:function(){var e=this,t=e.metaRange,n=e.range,a=e.doc.getSelection();if(n){if(t&&t.start!==t.end)for(var o,r=0,i=[e.$ed[0]],s=!1,l=!1,d=e.doc.createRange();!l&&(o=i.pop());)if(3===o.nodeType){var c=r+o.length;!s&&t.start>=r&&t.start<=c&&(d.setStart(o,t.start-r),s=!0),s&&t.end>=r&&t.end<=c&&(d.setEnd(o,t.end-r),l=!0),r=c}else for(var u=o.childNodes,g=u.length;0<g;)--g,i.push(u[g]);try{a.removeAllRanges()}catch(e){}a.addRange(d||n)}},getRangeText:function(){return this.range+""},clearButtonPaneStatus:function(){var e=this.o.prefix,t=e+"active-button "+e+"active",n=e+"original-icon";u("."+e+"active-button",this.$btnPane).removeClass(t),u("."+n,this.$btnPane).each(function(){u(this).find("svg use").attr("xlink:href",u(this).data(n))})},updateButtonPaneStatus:function(){var s=this,l=s.o.prefix,d=l+"active-button "+l+"active",c=l+"original-icon",e=s.getTagsRecursive(s.doc.getSelection().focusNode);s.clearButtonPaneStatus(),u.each(e,function(e,t){var n=s.tagToButton[t.toLowerCase()],a=u("."+l+n+"-button",s.$btnPane);if(0<a.length)a.addClass(d);else try{var o=(a=u("."+l+"dropdown ."+l+n+"-dropdown-button",s.$box)).find("svg use"),r=a.parent().data(l+"dropdown"),i=u("."+l+r+"-button",s.$box),r=i.find("svg use");i.addClass(d),s.o.changeActiveDropdownIcon&&0<o.length&&(i.addClass(c).data(c,r.attr("xlink:href")),r.attr("xlink:href",o.attr("xlink:href")))}catch(e){}})},getTagsRecursive:function(n,a){var o=this;if(a=a||(n&&n.tagName?[n.tagName]:[]),!n||!n.parentNode)return a;var e=(n=n.parentNode).tagName;return"DIV"===e?a:("P"===e&&""!==n.style.textAlign&&a.push(n.style.textAlign),u.each(o.tagHandlers,function(e,t){a=a.concat(t(n,o))}),a.push(e),o.getTagsRecursive(n,a).filter(function(e){return null!=e}))},initPlugins:function(){var n=this;n.loadedPlugins=[],u.each(u.trumbowyg.plugins,function(e,t){t.shouldInit&&!t.shouldInit(n)||(t.init(n),t.tagHandler&&n.tagHandlers.push(t.tagHandler),n.loadedPlugins.push(t))})},destroyPlugins:function(){var n=this;u.each(this.loadedPlugins,function(e,t){t.destroy&&t.destroy(n)})}}}(navigator,window,document,jQuery);
\ No newline at end of file
+jQuery.trumbowyg={langs:{en:{viewHTML:"Plain Text",undo:"Undo",redo:"Redo",formatting:"Formatting",p:"Paragraph",blockquote:"Quote",code:"Code",header:"Header",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",underline:"Underline",strong:"Strong",em:"Emphasis",del:"Deleted",superscript:"Superscript",subscript:"Subscript",unorderedList:"Unordered list",orderedList:"Ordered list",insertImage:"Insert Image",link:"Link",createLink:"Insert link",unlink:"Remove link",justifyLeft:"Align Left",justifyCenter:"Align Center",justifyRight:"Align Right",justifyFull:"Align Justify",horizontalRule:"Insert horizontal rule",removeformat:"Remove format",fullscreen:"Fullscreen",close:"Close",submit:"Confirm",reset:"Cancel",required:"Required",description:"Description",title:"Title",text:"Text",target:"Target",width:"Width"}},plugins:{},svgPath:null,svgAbsoluteUseHref:!1,hideButtonTexts:null},Object.defineProperty(jQuery.trumbowyg,"defaultOptions",{value:{lang:"en",fixedBtnPane:!1,fixedFullWidth:!1,autogrow:!1,autogrowOnEnter:!1,imageWidthModalEdit:!1,hideButtonTexts:null,prefix:"trumbowyg-",tagClasses:{},semantic:!0,semanticKeepAttributes:!1,resetCss:!1,removeformatPasted:!1,tabToIndent:!1,tagsToRemove:[],tagsToKeep:["hr","img","embed","iframe","input"],btns:[["viewHTML"],["undo","redo"],["formatting"],["strong","em","del"],["superscript","subscript"],["link"],["insertImage"],["justifyLeft","justifyCenter","justifyRight","justifyFull"],["unorderedList","orderedList"],["horizontalRule"],["removeformat"],["fullscreen"]],btnsDef:{},changeActiveDropdownIcon:!1,inlineElementsSelector:"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u",pasteHandlers:[],plugins:{},urlProtocol:!1,minimalLinks:!1,defaultLinkTarget:void 0,svgPath:null},writable:!1,enumerable:!0,configurable:!1}),function(l,d,c,u){"use strict";var g="tbwconfirm",h="tbwcancel";u.fn.trumbowyg=function(e,t){var n="trumbowyg";if(e===Object(e)||!e)return this.each(function(){u(this).data(n)||u(this).data(n,new o(this,e))});if(1===this.length)try{var a=u(this).data(n);switch(e){case"execCmd":return a.execCmd(t.cmd,t.param,t.forceCss,t.skipTrumbowyg);case"openModal":return a.openModal(t.title,t.content);case"closeModal":return a.closeModal();case"openModalInsert":return a.openModalInsert(t.title,t.fields,t.callback);case"saveRange":return a.saveRange();case"getRange":return a.range;case"getRangeText":return a.getRangeText();case"restoreRange":return a.restoreRange();case"enable":return a.setDisabled(!1);case"disable":return a.setDisabled(!0);case"toggle":return a.toggle();case"destroy":return a.destroy();case"empty":return a.empty();case"html":return a.html(t)}}catch(e){}return!1};var o=function(e,t){var n=this,a="trumbowyg-icons",o=u.trumbowyg;n.doc=e.ownerDocument||c,n.$ta=u(e),n.$c=u(e),null!=(t=t||{}).lang||null!=o.langs[t.lang]?n.lang=u.extend(!0,{},o.langs.en,o.langs[t.lang]):n.lang=o.langs.en,n.hideButtonTexts=(null!=o.hideButtonTexts?o:t).hideButtonTexts;var r,i=(null!=o.svgPath?o:t).svgPath;n.hasSvg=!1!==i,!1===i||!o.svgAbsoluteUseHref&&0!==u("#"+a,n.doc).length||(null==i&&u("script[src]").each(function(e,t){var n=t.src,t=n.match("trumbowyg(.min)?.js");null!=t&&(i=n.substring(0,n.indexOf(t[0]))+"ui/icons.svg")}),null==i?console.warn("You must define svgPath: https://goo.gl/CfTY9U"):o.svgAbsoluteUseHref||((r=n.doc.createElement("div")).id=a,n.doc.body.insertBefore(r,n.doc.body.childNodes[0]),u.ajax({async:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"xml",crossDomain:!0,url:i,data:null,beforeSend:null,complete:null,success:function(e){r.innerHTML=(new XMLSerializer).serializeToString(e.documentElement)}})));var s=n.doc.querySelector("base")?d.location.href.split(/[?#]/)[0]:"";n.svgPath=o.svgAbsoluteUseHref?i:s;a=n.lang.header,s=function(){return(d.chrome||d.Intl&&Intl.v8BreakIterator)&&"CSS"in d};n.btnsDef={viewHTML:{fn:"toggle",class:"trumbowyg-not-disable",name1:"name1"},undo:{isSupported:s,key:"Z"},redo:{isSupported:s,key:"Y"},p:{fn:"formatBlock"},blockquote:{fn:"formatBlock"},h1:{fn:"formatBlock",title:a+" 1"},h2:{fn:"formatBlock",title:a+" 2"},h3:{fn:"formatBlock",title:a+" 3"},h4:{fn:"formatBlock",title:a+" 4"},h5:{fn:"formatBlock",title:a+" 5"},h6:{fn:"formatBlock",title:a+" 6"},subscript:{tag:"sub"},superscript:{tag:"sup"},bold:{key:"B",tag:"b"},italic:{key:"I",tag:"i"},underline:{tag:"u"},strikethrough:{tag:"strike"},strong:{fn:"bold",key:"B"},em:{fn:"italic",key:"I"},del:{fn:"strikethrough"},createLink:{key:"K",tag:"a"},unlink:{},insertImage:{},justifyLeft:{tag:"left",forceCss:!0},justifyCenter:{tag:"center",forceCss:!0},justifyRight:{tag:"right",forceCss:!0},justifyFull:{tag:"justify",forceCss:!0},unorderedList:{fn:"insertUnorderedList",tag:"ul"},orderedList:{fn:"insertOrderedList",tag:"ol"},horizontalRule:{fn:"insertHorizontalRule"},removeformat:{},fullscreen:{class:"trumbowyg-not-disable"},close:{fn:"destroy",class:"trumbowyg-not-disable"},formatting:{dropdown:["p","h1","h2","h3","h4"],ico:"p"},link:{dropdown:["createLink","unlink"]}},n.o=u.extend(!0,{},o.defaultOptions,t),n.o.hasOwnProperty("imgDblClickHandler")||(n.o.imgDblClickHandler=n.getDefaultImgDblClickHandler()),n.urlPrefix=n.setupUrlPrefix(),n.disabled=n.o.disabled||"TEXTAREA"===e.nodeName&&e.disabled,t.btns?n.o.btns=t.btns:n.o.semantic||(n.o.btns[3]=["bold","italic","underline","strikethrough"]),u.each(n.o.btnsDef,function(e,t){n.addBtnDef(e,t)}),n.eventNamespace="trumbowyg-event",n.keys=[],n.tagToButton={},n.tagHandlers=[],n.pasteHandlers=[].concat(n.o.pasteHandlers),n.isIE=-1!==l.userAgent.indexOf("MSIE")||-1!==l.appVersion.indexOf("Trident/"),n.isMac=-1!==l.platform.toUpperCase().indexOf("MAC"),n.init()};o.prototype={DEFAULT_SEMANTIC_MAP:{b:"strong",i:"em",s:"del",strike:"del",div:"p"},init:function(){var e=this;e.height=e.$ta.height(),e.initPlugins();try{e.doc.execCommand("enableObjectResizing",!1,!1),e.doc.execCommand("defaultParagraphSeparator",!1,"p")}catch(e){}e.buildEditor(),e.buildBtnPane(),e.fixedBtnPaneEvents(),e.buildOverlay(),setTimeout(function(){e.disabled&&e.setDisabled(!0),e.$c.trigger("tbwinit")})},addBtnDef:function(e,t){this.btnsDef[e]=u.extend(t,this.btnsDef[e]||{})},setupUrlPrefix:function(){var e=this.o.urlProtocol;if(e)return"string"!=typeof e?"https://":e.replace("://","")+"://"},buildEditor:function(){var a=this,t=a.o.prefix,e="";a.$box=u("<div/>",{class:t+"box "+t+"editor-visible "+t+a.o.lang+" trumbowyg"}),a.isTextarea=a.$ta.is("textarea"),a.isTextarea?(e=a.$ta.val(),a.$ed=u("<div/>"),a.$box.insertAfter(a.$ta).append(a.$ed,a.$ta)):(a.$ed=a.$ta,e=a.$ed.html(),a.$ta=u("<textarea/>",{name:a.$ta.attr("id"),height:a.height}).val(e),a.$box.insertAfter(a.$ed).append(a.$ta,a.$ed),a.syncCode()),a.$ta.addClass(t+"textarea").attr("tabindex",-1),a.$ed.addClass(t+"editor").attr({contenteditable:!0,dir:a.lang._dir||"ltr"}).html(e),a.o.tabindex&&a.$ed.attr("tabindex",a.o.tabindex),a.$c.is("[placeholder]")&&a.$ed.attr("placeholder",a.$c.attr("placeholder")),a.$c.is("[spellcheck]")&&a.$ed.attr("spellcheck",a.$c.attr("spellcheck")),a.o.resetCss&&a.$ed.addClass(t+"reset-css"),a.o.autogrow||a.$ta.add(a.$ed).css({height:a.height}),a.semanticCode(),a.o.autogrowOnEnter&&a.$ed.addClass(t+"autogrow-on-enter");var n,o=!1,r=!1;a.$ed.on("dblclick","img",a.o.imgDblClickHandler).on("keydown",function(e){var t=e.which;if(8!==t&&13!==t&&46!==t||a.toggleSpan(!0),!e.ctrlKey&&!e.metaKey||e.altKey){if(a.o.tabToIndent&&"Tab"===e.key)try{return e.shiftKey?a.execCmd("outdent",!0,null):a.execCmd("indent",!0,null),!1}catch(e){}}else{o=!0;var n=a.keys[String.fromCharCode(e.which).toUpperCase()];try{return a.execCmd(n.fn,n.param),!1}catch(e){}}}).on("compositionstart compositionupdate",function(){r=!0}).on("keyup compositionend",function(e){if("compositionend"===e.type)r=!1;else if(r)return;var t=e.which;37<=t&&t<=40||(8!==t&&13!==t&&46!==t||a.toggleSpan(),!e.ctrlKey&&!e.metaKey||89!==t&&90!==t?o||17===t?void 0===e.which&&a.semanticCode(!1,!1,!0):(e=!a.isIE||"compositionend"===e.type,a.semanticCode(!1,e&&13===t),a.$c.trigger("tbwchange")):(a.semanticCode(!1,!0),a.$c.trigger("tbwchange")),setTimeout(function(){o=!1},50))}).on("mouseup keydown keyup",function(e){(e.ctrlKey||e.metaKey)&&!e.altKey||setTimeout(function(){o=!1},50),clearTimeout(n),n=setTimeout(function(){a.updateButtonPaneStatus()},50)}).on("focus blur",function(e){"blur"===e.type&&a.clearButtonPaneStatus(),a.$c.trigger("tbw"+e.type),a.o.autogrowOnEnter&&(a.autogrowOnEnterDontClose||("focus"===e.type?(a.autogrowOnEnterWasFocused=!0,a.autogrowEditorOnEnter()):a.o.autogrow||(a.$ed.css({height:a.$ed.css("min-height")}),a.$c.trigger("tbwresize"))))}).on("keyup focus",function(){a.$ta.val().match(/<.*>/)||a.$ed.html().match(/<.*>/)||setTimeout(function(){var e=a.isIE?"<p>":"p";a.doc.execCommand("formatBlock",!1,e),a.syncCode()},0)}).on("cut drop",function(){setTimeout(function(){a.semanticCode(!1,!0),a.$c.trigger("tbwchange")},0)}).on("paste",function(n){if(a.o.removeformatPasted){n.preventDefault(),d.getSelection&&d.getSelection().deleteFromDocument&&d.getSelection().deleteFromDocument();try{var t=d.clipboardData.getData("Text");try{a.doc.selection.createRange().pasteHTML(t)}catch(e){a.doc.getSelection().getRangeAt(0).insertNode(a.doc.createTextNode(t))}a.$c.trigger("tbwchange",n)}catch(e){a.execCmd("insertText",(n.originalEvent||n).clipboardData.getData("text/plain"))}}u.each(a.pasteHandlers,function(e,t){t(n)}),setTimeout(function(){a.semanticCode(!1,!0),a.$c.trigger("tbwpaste",n),a.$c.trigger("tbwchange")},0)}),a.$ta.on("keyup",function(){a.$c.trigger("tbwchange")}).on("paste",function(){setTimeout(function(){a.$c.trigger("tbwchange")},0)}),u(a.doc.body).on("keydown."+a.eventNamespace,function(e){if(27===e.which&&1<=u("."+t+"modal-box").length)return a.closeModal(),!1})},autogrowEditorOnEnter:function(){var e=this;e.$ed.removeClass("autogrow-on-enter");var t=e.$ed[0].clientHeight;e.$ed.height("auto");var n=e.$ed[0].scrollHeight;e.$ed.addClass("autogrow-on-enter"),t!==n&&(e.$ed.height(t),setTimeout(function(){e.$ed.css({height:n}),e.$c.trigger("tbwresize")},0))},buildBtnPane:function(){var a=this,o=a.o.prefix,r=a.$btnPane=u("<div/>",{class:o+"button-pane"});u.each(a.o.btns,function(e,t){u.isArray(t)||(t=[t]);var n=u("<div/>",{class:o+"button-group "+(0<=t.indexOf("fullscreen")?o+"right":"")});u.each(t,function(e,t){try{a.isSupportedBtn(t)&&n.append(a.buildBtn(t))}catch(e){}}),0<n.html().trim().length&&r.append(n)}),a.$box.prepend(r)},buildBtn:function(e){var n,a=this,t=a.o.prefix,o=a.btnsDef[e],r=o.dropdown,i=null==o.hasIcon||o.hasIcon,s=a.lang[e]||e,l=u("<button/>",{type:"button",class:t+e+"-button "+(o.class||"")+(i?"":" "+t+"textual-button"),html:!o.name1&&a.hasSvg&&i?'<svg><use xlink:href="'+a.svgPath+"#"+t+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>':a.hideButtonTexts?"":o.text||o.title||a.lang[e]||e,title:(o.title||o.text||s)+(o.key?" ("+(a.isMac?"Cmd":"Ctrl")+" + "+o.key+")":""),tabindex:-1,mousedown:function(){return r&&!u("."+e+"-"+t+"dropdown",a.$box).is(":hidden")||u("body",a.doc).trigger("mousedown"),(!a.$btnPane.hasClass(t+"disable")&&!a.$box.hasClass(t+"disabled")||u(this).hasClass(t+"active")||u(this).hasClass(t+"not-disable"))&&a.execCmd((!r?o.fn:"dropdown")||e,o.param||e,o.forceCss),!1}});return r?(l.addClass(t+"open-dropdown"),(s={class:(i=t+"dropdown")+"-"+e+" "+i+" "+t+"fixed-top "+(o.dropdownClass||"")})["data-"+i]=e,n=u("<div/>",s),u.each(r,function(e,t){a.btnsDef[t]&&a.isSupportedBtn(t)&&n.append(a.buildSubBtn(t))}),a.$box.append(n.hide())):o.key&&(a.keys[o.key]={fn:o.fn||e,param:o.param||e}),r||(a.tagToButton[(o.tag||e).toLowerCase()]=e),l},buildSubBtn:function(e){var t=this,n=t.o.prefix,a=t.btnsDef[e],o=null==a.hasIcon||a.hasIcon;return a.key&&(t.keys[a.key]={fn:a.fn||e,param:a.param||e}),t.tagToButton[(a.tag||e).toLowerCase()]=e,u("<button/>",{type:"button",class:n+e+"-dropdown-button "+(a.class||"")+(a.ico?" "+n+a.ico+"-button":""),html:t.hasSvg&&o?'<svg><use xlink:href="'+t.svgPath+"#"+n+(a.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>'+(a.text||a.title||t.lang[e]||e):a.text||a.title||t.lang[e]||e,title:a.key?"("+(t.isMac?"Cmd":"Ctrl")+" + "+a.key+")":null,style:a.style||null,mousedown:function(){return u("body",t.doc).trigger("mousedown"),t.execCmd(a.fn||e,a.param||e,a.forceCss),!1}})},isSupportedBtn:function(e){try{return this.btnsDef[e].isSupported()}catch(e){}return!0},buildOverlay:function(){return this.$overlay=u("<div/>",{class:this.o.prefix+"overlay"}).appendTo(this.$box),this.$overlay},showOverlay:function(){u(d).trigger("scroll"),this.$overlay.fadeIn(200),this.$box.addClass(this.o.prefix+"box-blur")},hideOverlay:function(){this.$overlay.fadeOut(50),this.$box.removeClass(this.o.prefix+"box-blur")},fixedBtnPaneEvents:function(){var o=this,r=o.o.fixedFullWidth,i=o.$box;o.o.fixedBtnPane&&(o.isFixed=!1,u(d).on("scroll."+o.eventNamespace+" resize."+o.eventNamespace,function(){var e,t,n,a;i&&(o.syncCode(),e=u(d).scrollTop(),t=i.offset().top+1,a=(n=o.$btnPane).outerHeight()-2,0<e-t&&e-t-o.height<0?(o.isFixed||(o.isFixed=!0,n.css({position:"fixed",top:0,left:r?0:"auto",zIndex:7}),o.$box.css({paddingTop:n.height()})),n.css({width:r?"100%":i.width()-1}),u("."+o.o.prefix+"fixed-top",i).css({position:r?"fixed":"absolute",top:r?a:e-t+a,zIndex:15})):o.isFixed&&(o.isFixed=!1,n.removeAttr("style"),o.$box.css({paddingTop:0}),u("."+o.o.prefix+"fixed-top",i).css({position:"absolute",top:a})))}))},setDisabled:function(e){var t=this,n=t.o.prefix;(t.disabled=e)?t.$ta.attr("disabled",!0):t.$ta.removeAttr("disabled"),t.$box.toggleClass(n+"disabled",e),t.$ed.attr("contenteditable",!e)},destroy:function(){var e=this,t=e.o.prefix;e.isTextarea?e.$box.after(e.$ta.css({height:""}).val(e.html()).removeClass(t+"textarea").show()):e.$box.after(e.$ed.css({height:""}).removeClass(t+"editor").removeAttr("contenteditable").removeAttr("dir").html(e.html()).show()),e.$ed.off("dblclick","img"),e.destroyPlugins(),e.$box.remove(),e.$c.removeData("trumbowyg"),u("body").removeClass(t+"body-fullscreen"),e.$c.trigger("tbwclose"),u(d).off("scroll."+e.eventNamespace+" resize."+e.eventNamespace),u(e.doc.body).off("keydown."+e.eventNamespace)},empty:function(){this.$ta.val(""),this.syncCode(!0)},toggle:function(){var e=this,t=e.o.prefix;e.o.autogrowOnEnter&&(e.autogrowOnEnterDontClose=!e.$box.hasClass(t+"editor-hidden")),e.semanticCode(!1,!0),e.$c.trigger("tbwchange"),setTimeout(function(){e.doc.activeElement.blur(),e.$box.toggleClass(t+"editor-hidden "+t+"editor-visible"),e.$btnPane.toggleClass(t+"disable"),e.$btnPane.find(".trumbowyg-viewHTML-button").text(e.$box.hasClass(t+"editor-hidden")?"Formatted Text":"Plain Text").attr("data-original-title",e.$box.hasClass(t+"editor-hidden")?"Formatted Text":"Plain Text"),u("."+t+"viewHTML-button",e.$btnPane).toggleClass(t+"active"),e.$box.hasClass(t+"editor-visible")?e.$ta.attr("tabindex",-1):e.$ta.removeAttr("tabindex"),e.o.autogrowOnEnter&&!e.autogrowOnEnterDontClose&&e.autogrowEditorOnEnter()},0)},toggleSpan:function(e){this.$ed.find("span").each(function(){!0===e?u(this).attr("data-tbw-flag",!0):u(this).attr("data-tbw-flag")?u(this).removeAttr("data-tbw-flag"):u(this).contents().unwrap()})},dropdown:function(e){var t=this,n=u("body",t.doc),a=t.o.prefix,o=u("[data-"+a+"dropdown="+e+"]",t.$box),r=u("."+a+e+"-button",t.$btnPane),e=o.is(":hidden");n.trigger("mousedown"),e&&(e=r.offset().left,r.addClass(a+"active"),o.css({position:"absolute",top:r.offset().top-t.$btnPane.offset().top+r.outerHeight(),left:t.o.fixedFullWidth&&t.isFixed?e:e-t.$btnPane.offset().left}).show(),u(d).trigger("scroll"),n.on("mousedown."+t.eventNamespace,function(e){o.is(e.target)||(u("."+a+"dropdown",t.$box).hide(),u("."+a+"active",t.$btnPane).removeClass(a+"active"),n.off("mousedown."+t.eventNamespace))}))},html:function(e){var t=this;return null!=e?(t.$ta.val(e),t.syncCode(!0),t.$c.trigger("tbwchange"),t):t.$ta.val()},syncTextarea:function(){var e=this;e.$ta.val(0<e.$ed.text().trim().length||0<e.$ed.find(e.o.tagsToKeep.join(",")).length?e.$ed.html():"")},syncCode:function(e){var t,n=this;!e&&n.$ed.is(":visible")?n.syncTextarea():(t=u("<div>").html(n.$ta.val()),t=u("<div>").append(t),u(n.o.tagsToRemove.join(","),t).remove(),n.$ed.html(t.contents().html())),n.o.autogrow&&(n.height=n.$ed.height(),n.height!==n.$ta.css("height")&&(n.$ta.css({height:n.height}),n.$c.trigger("tbwresize"))),n.o.autogrowOnEnter&&(n.$ed.height("auto"),(t=n.autogrowOnEnterWasFocused?n.$ed[0].scrollHeight:n.$ed.css("min-height"))!==n.$ta.css("height")&&(n.$ed.css({height:t}),n.$c.trigger("tbwresize")))},semanticCode:function(e,t,n){var a=this;a.saveRange(),a.syncCode(e);var o,r,i,e=!0;a.range&&a.range.collapsed&&(e=!1),a.o.semantic&&(a.semanticTag("b",a.o.semanticKeepAttributes),a.semanticTag("i",a.o.semanticKeepAttributes),a.semanticTag("s",a.o.semanticKeepAttributes),t&&(o=a.o.inlineElementsSelector,r=":not("+o+")",a.$ed.contents().filter(function(){return 3===this.nodeType&&0<this.nodeValue.trim().length}).wrap("<span data-tbw/>"),(i=function(e){var t;0!==e.length&&(e=(t=e.nextUntil(r).addBack().wrapAll("<p/>").parent()).nextAll(o).first(),t.next("br").remove(),i(e))})(a.$ed.children(o).first()),a.semanticTag("div",!0),u("[data-tbw]",a.$ed).contents().unwrap(),a.$ed.find("p:empty").remove()),!n&&e&&a.restoreRange(),a.syncTextarea())},semanticTag:function(e,a,t){var o,r=this,n=e;if(null!=this.o.semantic&&"object"==typeof this.o.semantic&&this.o.semantic.hasOwnProperty(e))o=this.o.semantic[e];else{if(!0!==this.o.semantic||!this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(e))return;o=this.DEFAULT_SEMANTIC_MAP[e]}t&&(e=o,o=n),u(e,this.$ed).each(function(){var e=!1,t=u(this);if(0===t.contents().length)return!1;r.range.startContainer.parentNode&&r.range.startContainer.parentNode===this&&(e=!0);var n=u("<"+o+"/>");n.insertBefore(t),a&&u.each(t.prop("attributes"),function(){n.attr(this.name,this.value)}),n.html(t.html()),t.remove(),!0===e&&(r.range.selectNodeContents(n.get(0)),r.range.collapse(!1))})},createLink:function(){for(var e,t,n,a=this,o=a.doc.getSelection(),r=o.getRangeAt(0),i=o.focusNode,s=(new XMLSerializer).serializeToString(r.cloneContents())||r+"";["A","DIV"].indexOf(i.nodeName)<0;)i=i.parentNode;i&&"A"===i.nodeName&&(s=(r=u(i)).text(),n=r.attr("href"),a.o.minimalLinks||(e=r.attr("title"),t=r.attr("target")||a.o.defaultLinkTarget),(r=a.doc.createRange()).selectNode(i),o.removeAllRanges(),o.addRange(r)),a.saveRange();s={url:{label:a.lang.linkUrl||"URL",required:!0,value:n},text:{label:a.lang.text,value:s}};a.o.minimalLinks||u.extend(s,{title:{label:a.lang.title,value:e},target:{label:a.lang.target,value:t}}),a.openModalInsert(a.lang.createLink,s,function(e){var t=a.prependUrlPrefix(e.url);if(!t.length)return!1;t=u(['<a href="',t,'">',e.text||e.url,"</a>"].join(""));return e.title&&t.attr("title",e.title),(e.target||a.o.defaultLinkTarget)&&t.attr("target",e.target||a.o.defaultLinkTarget),a.range.deleteContents(),a.range.insertNode(t[0]),a.syncCode(),a.$c.trigger("tbwchange"),!0})},prependUrlPrefix:function(e){if(!this.urlPrefix)return e;if(/^([a-z][-+.a-z0-9]*:|\/|#)/i.test(e))return e;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?"mailto:"+e:this.urlPrefix+e},unlink:function(){var e,t=this.doc.getSelection(),n=t.focusNode;if(t.isCollapsed){for(;["A","DIV"].indexOf(n.nodeName)<0;)n=n.parentNode;n&&"A"===n.nodeName&&((e=this.doc.createRange()).selectNode(n),t.removeAllRanges(),t.addRange(e))}this.execCmd("unlink",void 0,void 0,!0)},insertImage:function(){var n=this;n.saveRange();var e={url:{label:"URL",required:!0},alt:{label:n.lang.description,value:n.getRangeText()}};n.o.imageWidthModalEdit&&(e.width={}),n.openModalInsert(n.lang.insertImage,e,function(e){n.execCmd("insertImage",e.url,!1,!0);var t=u('img[src="'+e.url+'"]:not([alt])',n.$box);return t.attr("alt",e.alt),n.o.imageWidthModalEdit&&t.attr({width:e.width}),n.syncCode(),n.$c.trigger("tbwchange"),!0})},fullscreen:function(){var e=this,t=e.o.prefix,n=t+"fullscreen",a=n+"-placeholder",o=e.$box.outerHeight();e.$box.toggleClass(n),(n=e.$box.hasClass(n))?e.$box.before(u("<div/>",{class:a}).css({height:o})):u("."+a).remove(),u("body").toggleClass(t+"body-fullscreen",n),u(d).trigger("scroll"),e.$c.trigger("tbw"+(n?"open":"close")+"fullscreen")},execCmd:function(t,n,e,a){var o=this;a=!!a||"","dropdown"!==t&&o.$ed.focus(),"strikethrough"===t&&o.o.semantic&&o.semanticTag("strike",o.o.semanticKeepAttributes,!0);try{o.doc.execCommand("styleWithCSS",!1,e||!1)}catch(e){}try{o[t+a](n)}catch(e){try{t(n)}catch(e){"insertHorizontalRule"===t?n=void 0:"formatBlock"===t&&o.isIE&&(n="<"+n+">"),o.doc.execCommand(t,!1,n),o.syncCode(),o.semanticCode(!1,!0);try{var r=d.getSelection().focusNode;u(d.getSelection().focusNode.parentNode).hasClass("trumbowyg-editor")||(r=d.getSelection().focusNode.parentNode);var i=o.o.tagClasses[n];i&&u(r).addClass(i)}catch(e){}}"dropdown"!==t&&(o.updateButtonPaneStatus(),o.$c.trigger("tbwchange"))}},openModal:function(e,t,n){var a=this,o=a.o.prefix;if(n=!1!==n,0<u("."+o+"modal-box",a.$box).length)return!1;a.o.autogrowOnEnter&&(a.autogrowOnEnterDontClose=!0),a.saveRange(),a.showOverlay(),a.$btnPane.addClass(o+"disable");var r=u("<div/>",{class:o+"modal "+o+"fixed-top"}).css({top:a.$box.offset().top+a.$btnPane.height(),zIndex:99999}).appendTo(u(a.doc.body));a.$overlay.one("click",function(){return r.trigger(h),!1}),t=n?u("<form/>",{action:"",html:t}).on("submit",function(){return r.trigger(g),!1}).on("reset",function(){return r.trigger(h),!1}).on("submit reset",function(){a.o.autogrowOnEnter&&(a.autogrowOnEnterDontClose=!1)}):t;t=u("<div/>",{class:o+"modal-box",html:t}).css({top:"-"+a.$btnPane.outerHeight(),opacity:0,paddingBottom:n?null:"5%"}).appendTo(r).animate({top:0,opacity:1},100);return e&&u("<span/>",{text:e,class:o+"modal-title"}).prependTo(t),n&&(u("input:first",t).focus(),a.buildModalBtn("submit",t),a.buildModalBtn("reset",t),r.height(t.outerHeight()+10)),u(d).trigger("scroll"),a.$c.trigger("tbwmodalopen"),r},buildModalBtn:function(e,t){var n=this.o.prefix;return u("<button/>",{class:n+"modal-button "+n+"modal-"+e,type:e,text:this.lang[e]||e}).appendTo(u("form",t))},closeModal:function(){var e=this,t=e.o.prefix;e.$btnPane.removeClass(t+"disable"),e.$overlay.off();var n=u("."+t+"modal-box",u(e.doc.body));n.animate({top:"-"+n.height()},100,function(){n.parent().remove(),e.hideOverlay(),e.$c.trigger("tbwmodalclose")}),e.restoreRange()},openModalInsert:function(e,t,n){var s=this,r=s.o.prefix,i=s.lang,l="";return u.each(t,function(e,t){var n=t.label||e,a=t.name||e,o=t.attributes||{},e=Object.keys(o).map(function(e){return e+'="'+o[e]+'"'}).join(" ");l+='<label><input type="'+(t.type||"text")+'" name="'+a+'"'+("checkbox"===t.type&&t.value?' checked="checked"':' value="'+(t.value||"").replace(/"/g,"&quot;"))+'"'+e+'><span class="'+r+'input-infos"><span>'+(i[n]||n)+"</span></span></label>"}),s.openModal(e,l).on(g,function(){var o=u("form",u(this)),r=!0,i={};u.each(t,function(e,t){var n=t.name||e,a=u('input[name="'+n+'"]',o);switch(a.attr("type").toLowerCase()){case"checkbox":i[n]=a.is(":checked");break;case"radio":i[n]=a.filter(":checked").val();break;default:i[n]=u.trim(a.val())}t.required&&""===i[n]?(r=!1,s.addErrorOnModalField(a,s.lang.required)):t.pattern&&!t.pattern.test(i[n])&&(r=!1,s.addErrorOnModalField(a,t.patternError))}),r&&(s.restoreRange(),n(i,t)&&(s.syncCode(),s.$c.trigger("tbwchange"),s.closeModal(),u(this).off(g)))}).one(h,function(){u(this).off(g),s.closeModal()})},addErrorOnModalField:function(e,t){var n=this.o.prefix,a=n+"msg-error",o=e.parent();e.on("change keyup",function(){o.removeClass(n+"input-error"),setTimeout(function(){o.find("."+a).remove()},150)}),o.addClass(n+"input-error").find("input+span").append(u("<span/>",{class:a,text:t}))},getDefaultImgDblClickHandler:function(){var a=this;return function(){var t=u(this),e=t.attr("src"),n="(Base64)";0===e.indexOf("data:image")&&(e=n);e={url:{label:"URL",value:e,required:!0},alt:{label:a.lang.description,value:t.attr("alt")}};return a.o.imageWidthModalEdit&&(e.width={value:t.attr("width")?t.attr("width"):""}),a.openModalInsert(a.lang.insertImage,e,function(e){return e.url!==n&&t.attr({src:e.url}),t.attr({alt:e.alt}),a.o.imageWidthModalEdit&&(0<parseInt(e.width)?t.attr({width:e.width}):t.removeAttr("width")),!0}),!1}},saveRange:function(){var e,t=this,n=t.doc.getSelection();t.range=null,n&&n.rangeCount&&(e=t.range=n.getRangeAt(0),(n=t.doc.createRange()).selectNodeContents(t.$ed[0]),n.setEnd(e.startContainer,e.startOffset),n=(n+"").length,t.metaRange={start:n,end:n+(e+"").length})},restoreRange:function(){var e=this,t=e.metaRange,n=e.range,a=e.doc.getSelection();if(n){if(t&&t.start!==t.end)for(var o,r=0,i=[e.$ed[0]],s=!1,l=!1,d=e.doc.createRange();!l&&(o=i.pop());)if(3===o.nodeType){var c=r+o.length;!s&&t.start>=r&&t.start<=c&&(d.setStart(o,t.start-r),s=!0),s&&t.end>=r&&t.end<=c&&(d.setEnd(o,t.end-r),l=!0),r=c}else for(var u=o.childNodes,g=u.length;0<g;)--g,i.push(u[g]);try{a.removeAllRanges()}catch(e){}a.addRange(d||n)}},getRangeText:function(){return this.range+""},clearButtonPaneStatus:function(){var e=this.o.prefix,t=e+"active-button "+e+"active",n=e+"original-icon";u("."+e+"active-button",this.$btnPane).removeClass(t),u("."+n,this.$btnPane).each(function(){u(this).find("svg use").attr("xlink:href",u(this).data(n))})},updateButtonPaneStatus:function(){var s=this,l=s.o.prefix,d=l+"active-button "+l+"active",c=l+"original-icon",e=s.getTagsRecursive(s.doc.getSelection().focusNode);s.clearButtonPaneStatus(),u.each(e,function(e,t){var n=s.tagToButton[t.toLowerCase()],a=u("."+l+n+"-button",s.$btnPane);if(0<a.length)a.addClass(d);else try{var o=(a=u("."+l+"dropdown ."+l+n+"-dropdown-button",s.$box)).find("svg use"),r=a.parent().data(l+"dropdown"),i=u("."+l+r+"-button",s.$box),r=i.find("svg use");i.addClass(d),s.o.changeActiveDropdownIcon&&0<o.length&&(i.addClass(c).data(c,r.attr("xlink:href")),r.attr("xlink:href",o.attr("xlink:href")))}catch(e){}})},getTagsRecursive:function(n,a){var o=this;if(a=a||(n&&n.tagName?[n.tagName]:[]),!n||!n.parentNode)return a;var e=(n=n.parentNode).tagName;return"DIV"===e?a:("P"===e&&""!==n.style.textAlign&&a.push(n.style.textAlign),u.each(o.tagHandlers,function(e,t){a=a.concat(t(n,o))}),a.push(e),o.getTagsRecursive(n,a).filter(function(e){return null!=e}))},initPlugins:function(){var n=this;n.loadedPlugins=[],u.each(u.trumbowyg.plugins,function(e,t){t.shouldInit&&!t.shouldInit(n)||(t.init(n),t.tagHandler&&n.tagHandlers.push(t.tagHandler),n.loadedPlugins.push(t))})},destroyPlugins:function(){var n=this;u.each(this.loadedPlugins,function(e,t){t.destroy&&t.destroy(n)})}}}(navigator,window,document,jQuery);
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html b/dashboardv3/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html
index 3d316f6..aedb6da 100644
--- a/dashboardv3/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html
+++ b/dashboardv3/public/js/templates/business_metadata/BusinessMetadataAttributeItemView_tmpl.html
@@ -95,9 +95,12 @@
     <div class="form-group" data-id="stringLengthContainer">
         <div class="stringlength-container">
             <label class="control-label col-sm-3 required" for="name">Max length</label>
-            <div class="col-sm-8">
+            <div class="col-sm-6">
                 <input type="number" class="form-control stringLengthVal require" data-id="stringLength" placeholder="Maximum length">
             </div>
+            <label class="control-label">
+                <i class="fa fa-question-circle help-btn" title="<div>String length limit includes any HTML formatting tags used.</div>" data-html="true"></i>
+            </label>
         </div>
     </div>
     <div class="form-group entity-businessMetadata-selector">
diff --git a/dashboardv3/public/js/templates/business_metadata/BusinessMetadataDetailLayoutView_tmpl.html b/dashboardv3/public/js/templates/business_metadata/BusinessMetadataDetailLayoutView_tmpl.html
index 2ad5ba5..a3eddc7 100644
--- a/dashboardv3/public/js/templates/business_metadata/BusinessMetadataDetailLayoutView_tmpl.html
+++ b/dashboardv3/public/js/templates/business_metadata/BusinessMetadataDetailLayoutView_tmpl.html
@@ -23,7 +23,20 @@
     </div>
     <div class="tagDetail clearfix form-horizontal col-sm-12">
         <h1 class="title"><span data-id="title"></span></h1>
-        <p class="form-group col-sm-12" data-id="description"></p>
+        <div class="long-description-container form-group clearfix">
+            <span class="pull-left text-muted">Description:&nbsp;</span>
+            <div class="isTextTypeBtn-wrapper pull-right">
+                <span class="text-muted pull-left">Formatted</span>
+                <label class="switch pull-left">
+                    <input type="checkbox" class="switch-input" name="textType" value="text">
+                    <span class="switch-slider"></span>
+                </label>
+                <span class="text-muted">Plain</span>
+            </div>
+            <div class="longdescription-wrapper form-control col-sm-12">
+                <div class="long-description" name="longDescription" data-id="description" disabled></div>
+            </div>
+        </div>
     </div>
 </div>
 </div>
\ No newline at end of file
diff --git a/dashboardv3/public/js/templates/business_metadata/CreateBusinessMetadataLayoutView_tmpl.html b/dashboardv3/public/js/templates/business_metadata/CreateBusinessMetadataLayoutView_tmpl.html
index a78614d..5a43a76 100644
--- a/dashboardv3/public/js/templates/business_metadata/CreateBusinessMetadataLayoutView_tmpl.html
+++ b/dashboardv3/public/js/templates/business_metadata/CreateBusinessMetadataLayoutView_tmpl.html
@@ -31,7 +31,7 @@
     <div class="form-group">
         <label class="control-label col-sm-2" for="description">Description</label>
         <div class="col-sm-10">
-            <input class="form-control" data-id="description" value="{{description}}" placeholder="Description" />
+            <textarea class="form-control customTextEditor" data-id="description" value="{{description}}" placeholder="Description" ></textarea>
         </div>
     </div>
     {{/if}}
diff --git a/dashboardv3/public/js/templates/glossary/GlossaryDetailLayoutView_tmpl.html b/dashboardv3/public/js/templates/glossary/GlossaryDetailLayoutView_tmpl.html
index 64e6031..5933d1d 100644
--- a/dashboardv3/public/js/templates/glossary/GlossaryDetailLayoutView_tmpl.html
+++ b/dashboardv3/public/js/templates/glossary/GlossaryDetailLayoutView_tmpl.html
@@ -40,7 +40,7 @@
                 </label>
                 <span class="text-muted">Plain</span>
             </div>
-            <div class="glossary-longdescription-wrapper form-control">
+            <div class="longdescription-wrapper form-control">
                 <div class="long-description" name="longDescription" data-id="longDescription" disabled></div>
             </div>
         </div>
diff --git a/dashboardv3/public/js/templates/tag/CreateTagLayoutView_tmpl.html b/dashboardv3/public/js/templates/tag/CreateTagLayoutView_tmpl.html
index 27ea912..28f0baa 100644
--- a/dashboardv3/public/js/templates/tag/CreateTagLayoutView_tmpl.html
+++ b/dashboardv3/public/js/templates/tag/CreateTagLayoutView_tmpl.html
@@ -30,7 +30,7 @@
     <div class="form-group">
         <label class="control-label col-sm-2 required" for="description">Description</label>
         <div class="col-sm-10">
-            <input class="form-control" data-id="description" value="{{description}}" placeholder="Description(required)" />
+            <textarea class="form-control customTextEditor" data-id="description" value="{{description}}" placeholder="Description(required)" ></textarea>
         </div>
     </div>
     {{#if create}}
diff --git a/dashboardv3/public/js/templates/tag/TagAttributeDetailLayoutView_tmpl.html b/dashboardv3/public/js/templates/tag/TagAttributeDetailLayoutView_tmpl.html
index c999fe1..21f6628 100644
--- a/dashboardv3/public/js/templates/tag/TagAttributeDetailLayoutView_tmpl.html
+++ b/dashboardv3/public/js/templates/tag/TagAttributeDetailLayoutView_tmpl.html
@@ -24,7 +24,20 @@
     <div class="tagDetail clearfix form-horizontal col-sm-12">
         <h1 class="title"><span data-id="title"></span></h1>
         <button type="button" data-id="editButton" class="btn btn-sm btn-action pull-right"><i class="fa fa-pencil"></i></button>
-        <p class="form-group col-sm-12" data-id="description"></p>
+        <div class="long-description-container form-group clearfix">
+            <span class="pull-left text-muted">Description:&nbsp;</span>
+            <div class="isTextTypeBtn-wrapper pull-right">
+                <span class="text-muted pull-left">Formatted</span>
+                <label class="switch pull-left">
+                    <input type="checkbox" class="switch-input" name="textType" value="text">
+                    <span class="switch-slider"></span>
+                </label>
+                <span class="text-muted">Plain</span>
+            </div>
+            <div class="longdescription-wrapper form-control col-sm-12">
+                <div class="long-description" name="longDescription" data-id="description" disabled></div>
+            </div>
+        </div>
         <div class="superType form-group col-sm-12" style="display:none">
             <label class="control-label-sm-pr pull-left">Direct super-classifications:</label>
             <div data-id="superType" class="btn-inline">
diff --git a/dashboardv3/public/js/utils/CommonViewFunction.js b/dashboardv3/public/js/utils/CommonViewFunction.js
index 7aacb98..7d8f03d 100644
--- a/dashboardv3/public/js/utils/CommonViewFunction.js
+++ b/dashboardv3/public/js/utils/CommonViewFunction.js
@@ -715,12 +715,13 @@
             //Below condition is added for sanitizing the longDescription text against XSS attack.
             if (model) {
                 var longDescriptionContent = isGlossaryView ? model.get('longDescription') : model.longDescription,
-                    sanitizeLongDescriptionContent;
+                    sanitizeLongDescriptionContent = "";
                 if (longDescriptionContent) {
-                    sanitizeLongDescriptionContent = Utils.sanitizeHtmlContent(longDescriptionContent)
+                    sanitizeLongDescriptionContent = Utils.sanitizeHtmlContent({ data: longDescriptionContent });
                     isGlossaryView ? model.set("longDescription", sanitizeLongDescriptionContent) : model.longDescription = sanitizeLongDescriptionContent;
                 }
             }
+            //End
         }
         require([
             'views/glossary/CreateEditCategoryTermLayoutView',
@@ -745,38 +746,22 @@
                 "okCloses": false,
                 "okText": model ? "Update" : "Create",
                 "allowCancel": true,
-                "width": "765px"
+                "width": "640px"
             }).open();
             modal.$el.find('input[data-id=shortDescription]').on('input keydown', function(e) {
                 $(this).val($(this).val().replace(/\s+/g, ' '));
             });
             modal.$el.find('button.ok').attr("disabled", "true");
             var longDescriptionEditor = modal.$el.find('textarea[data-id=longDescription]'),
-                okBtn = modal.$el.find('button.ok');
-            longDescriptionEditor.trumbowyg({
-                btns: [
-                    ['formatting'],
-                    ['strong', 'em', 'underline', 'del'],
-                    ['link'],
-                    ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
-                    ['unorderedList', 'orderedList'],
-                    ['viewHTML']
-                ],
-                removeformatPasted: true,
-                urlProtocol: true,
-                defaultLinkTarget: '_blank'
-            }).on('tbwchange', function() {
-                okBtn.removeAttr("disabled");
-            });
+                okBtn = modal.$el.find('button.ok'),
+                modalOkBtn = function() {
+                    okBtn.removeAttr("disabled");
+                };
+            Utils.addCustomTextEditor({ selector: longDescriptionEditor, callback: modalOkBtn, initialHide: false });
             modal.on('ok', function() {
                 modal.$el.find('button.ok').showButtonLoader();
                 //Below condition is added for sanitizing the longDescription text against XSS attack.
-                var editorContent, cleanContent;
-                editorContent = longDescriptionEditor.trumbowyg('html');
-                if (editorContent !== "") {
-                    cleanContent = Utils.sanitizeHtmlContent(editorContent);
-                    longDescriptionEditor.trumbowyg('html', cleanContent);
-                }
+                longDescriptionEditor.trumbowyg('html', Utils.sanitizeHtmlContent({ selector: longDescriptionEditor }));
                 //End
                 CommonViewFunction.createEditGlossaryCategoryTermSubmit(_.extend({ "ref": view, "modal": modal }, options));
             });
@@ -785,6 +770,7 @@
                 if (options.onModalClose) {
                     options.onModalClose()
                 }
+                longDescriptionEditor.trumbowyg('closeModal');
             });
         });
     }
diff --git a/dashboardv3/public/js/utils/Helper.js b/dashboardv3/public/js/utils/Helper.js
index 164beac..71101a7 100644
--- a/dashboardv3/public/js/utils/Helper.js
+++ b/dashboardv3/public/js/utils/Helper.js
@@ -134,6 +134,12 @@
     $("body").on('click', '.btn', function() {
         $(this).blur();
     });
+    $('body').on('click', function(e) {
+        if ($(e.target).hasClass('trumbowyg-editor-hidden')) {
+            $('.trumbowyg').find('.trumbowyg-button-pane').removeClass('trumbowyg-button-pane-hidden');
+            $('.trumbowyg').css('border', '1px solid #8fa5b1');
+        }
+    });
     $('body').on('keyup input', '.modal-body', function(e) {
         var target = e.target,
             isGlossary = (e.target.dataset.id === "searchTerm" || e.target.dataset.id === "searchCategory") ? true : false; // assign term/category modal
diff --git a/dashboardv3/public/js/utils/Utils.js b/dashboardv3/public/js/utils/Utils.js
index d4db9f4..0d8722f 100644
--- a/dashboardv3/public/js/utils/Utils.js
+++ b/dashboardv3/public/js/utils/Utils.js
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', 'moment', 'store', 'modules/Modal', 'DOMPurify', 'moment-timezone', 'pnotify.buttons', 'pnotify.confirm'], function(require, Globals, pnotify, Messages, Enums, moment, store, Modal, DOMPurify) {
+define(['require', 'utils/Globals', 'pnotify', 'utils/Messages', 'utils/Enums', 'moment', 'store', 'modules/Modal', 'DOMPurify', 'moment-timezone', 'pnotify.buttons', 'pnotify.confirm', 'trumbowyg'], function(require, Globals, pnotify, Messages, Enums, moment, store, Modal, DOMPurify) {
     'use strict';
 
     var Utils = {};
@@ -964,14 +964,7 @@
         }
         return dateValue;
     }
-    //-----------------------------------------DOMPurify--------------------------------------
-    //This below function expects string that needs to be sanitize against XSS attack.
-    Utils.sanitizeHtmlContent = function(string) {
-        if (string) {
-            return DOMPurify.sanitize(string, { FORBID_TAGS: ['img', 'script', 'iframe', 'embed', 'svg', 'meta'], ALLOWED_ATTR: ['target', 'href'] });
-        }
-    }
-    //----------------------------------------------------------------------------------------
+
     //------------------------------------------------idleTimeout-----------------------------
     $.fn.idleTimeout = function(userRuntimeConfig) {
 
@@ -1237,5 +1230,68 @@
     };
 
     //------------------------------------------------
+
+    //--------------------------------------Custom Text Editor-----------------------------------//
+    Utils.addCustomTextEditor = function(options) {
+        var selector = options.selector ? options.selector : ".customTextEditor",
+            defaultBtns = [
+                ['formatting'],
+                ['strong', 'em', 'underline', 'del'],
+                ['link'],
+                ['unorderedList', 'orderedList'],
+                ['viewHTML']
+            ],
+            smallTextEditorBtn = [
+                ['strong', 'em', 'underline', 'del'],
+                ['link'],
+                ['unorderedList', 'orderedList'],
+            ],
+            customBtnDefs = {
+                formatting: {
+                    dropdown: ['p', 'h1', 'h2', 'h3', 'h4'],
+                    ico: 'p'
+                }
+            },
+            $btnPane, $parent;
+        $(selector).trumbowyg({
+            btns: options.small ? smallTextEditorBtn : defaultBtns,
+            autogrow: true,
+            removeformatPasted: true,
+            urlProtocol: true,
+            defaultLinkTarget: '_blank',
+            btnsDef: options.small ? {} : customBtnDefs
+        }).on('tbwinit', function() {
+            $btnPane = $(this).parent().find('.trumbowyg-button-pane');
+            $parent = $(this).parent();
+            if (options.small) {
+                $parent.addClass('small-texteditor');
+            }
+            if (!options.initialHide) {
+                $btnPane.addClass('trumbowyg-button-pane-hidden');
+                $parent.css('border', '1px solid #e8e9ee');
+            }
+        }).on('tbwblur', function(e) {
+            $btnPane.addClass('trumbowyg-button-pane-hidden');
+            $parent.css('border', '1px solid #e8e9ee');
+        }).on('tbwfocus', function(e) {
+            $btnPane.removeClass('trumbowyg-button-pane-hidden');
+            $parent.css('border', '1px solid #8fa5b1');
+        }).on('tbwchange', function(e) {
+            options.callback ? options.callback(e) : null;
+        }).on('tbwmodalopen', function(e) {
+            $('input[name="title"], input[name="target"]').parent().css('display', 'none');
+        });
+    }
+
+    Utils.sanitizeHtmlContent = function(options) {
+        var editorContent, cleanedContent;
+        editorContent = options.selector ? $(options.selector).trumbowyg('html') : options.data;
+        if (options && editorContent) {
+            cleanedContent = DOMPurify.sanitize(editorContent, { FORBID_TAGS: ['img', 'script', 'iframe', 'embed', 'svg', 'meta'], ALLOWED_ATTR: ['target', 'href'] });
+        }
+        return cleanedContent;
+    }
+    //-----------------------------------------END---------------------//
+
     return Utils;
 });
diff --git a/dashboardv3/public/js/views/business_metadata/BusinessMetadataDetailLayoutView.js b/dashboardv3/public/js/views/business_metadata/BusinessMetadataDetailLayoutView.js
index ee5b84b..0921d43 100644
--- a/dashboardv3/public/js/views/business_metadata/BusinessMetadataDetailLayoutView.js
+++ b/dashboardv3/public/js/views/business_metadata/BusinessMetadataDetailLayoutView.js
@@ -33,7 +33,8 @@
             ui: {
                 title: '[data-id="title"]',
                 description: '[data-id="description"]',
-                backButton: '[data-id="backButton"]'
+                backButton: '[data-id="backButton"]',
+                textType: '[name="textType"]'
             },
             /** ui events hash */
             events: function() {
@@ -41,6 +42,10 @@
                 events["click " + this.ui.backButton] = function() {
                     Utils.backButtonClick();
                 };
+                events["change " + this.ui.textType] = function(e) {
+                    this.isTextTypeChecked = !this.isTextTypeChecked;
+                    this.renderDetail();
+                };
                 return events;
             },
             /**
@@ -49,6 +54,7 @@
              */
             initialize: function(options) {
                 _.extend(this, _.pick(options, 'model'));
+                this.isTextTypeChecked = false;
             },
             onRender: function() {
                 this.renderDetail();
@@ -56,7 +62,7 @@
             renderDetail: function() {
                 this.ui.title.html('<span>' + this.model.get('name') + '</span>');
                 if (this.model.get('description')) {
-                    this.ui.description.text(this.model.get('description'));
+                    this.isTextTypeChecked ? this.ui.description.text(this.model.get('description')) : this.ui.description.html(this.model.get('description'));
                 }
             }
         });
diff --git a/dashboardv3/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js b/dashboardv3/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js
index 80932ce..2e8d7c1 100644
--- a/dashboardv3/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js
+++ b/dashboardv3/public/js/views/business_metadata/BusinessMetadataTableLayoutView.js
@@ -215,6 +215,7 @@
                         isNewBusinessMetadata: isNewBusinessMetadata
                     });
                     that.RModal.show(that.view);
+                    Utils.addCustomTextEditor({ small: false });
                 });
             },
             renderTableLayoutView: function() {
@@ -296,7 +297,11 @@
                         editable: false,
                         formatter: _.extend({}, Backgrid.CellFormatter.prototype, {
                             fromRaw: function(rawValue, model) {
-                                return _.escape(model.get('description'));
+                                var description = model.get('description');
+                                if (description.length > 50) {
+                                    description = description.substr(0, 50) + "...";
+                                }
+                                return description;
                             }
                         })
                     },
diff --git a/dashboardv3/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js b/dashboardv3/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js
index 21bb663..165b995 100644
--- a/dashboardv3/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js
+++ b/dashboardv3/public/js/views/business_metadata/CreateBusinessMetadataLayoutView.js
@@ -223,7 +223,7 @@
                 };
                 this.loaderStatus(true);
                 var name = this.ui.name.val(),
-                    description = this.ui.description.val();
+                    description = Utils.sanitizeHtmlContent({ data: this.ui.description.val() });
                 var attributeObj = this.collection.toJSON();
                 if (this.collection.length === 1 && this.collection.first().get("name") === "") {
                     attributeObj = [];
@@ -240,7 +240,7 @@
                         "version": 1,
                         "typeVersion": "1.1",
                         "name": name.trim(),
-                        "description": description.trim(),
+                        "description": description ? description.trim() : "",
                         "attributeDefs": attributeObj
                     }]
                 };
diff --git a/dashboardv3/public/js/views/entity/EntityBusinessMetaDataItemView.js b/dashboardv3/public/js/views/entity/EntityBusinessMetaDataItemView.js
index 913cc0f..2fb835e 100644
--- a/dashboardv3/public/js/views/entity/EntityBusinessMetaDataItemView.js
+++ b/dashboardv3/public/js/views/entity/EntityBusinessMetaDataItemView.js
@@ -100,6 +100,32 @@
                         }
                     }
                 });
+                this.listenTo(this.searchVent, 'BusinessMetaAttribute:Edit', function() {
+                    _.each(that.model.attributes, function(obj) {
+                        if (obj.key) {
+                            if (obj.typeName === "string") {
+                                obj.value = Utils.sanitizeHtmlContent({ data: obj.value });
+                            }
+                            Utils.addCustomTextEditor({
+                                small: true,
+                                selector: "#" + obj.key,
+                                initialHide: false,
+                                callback: function(e) {
+                                    var key = $(e.target).data("key"),
+                                        businessMetadata = $(e.target).data("businessMetadata"),
+                                        typeName = $(e.target).data("typename"),
+                                        updateObj = that.model.toJSON();
+                                    if (_.isUndefinedNull(updateObj[key])) {
+                                        updateObj[key] = { value: null, typeName: typeName };
+                                    }
+                                    updateObj[key].value = Utils.sanitizeHtmlContent({ selector: "#" + obj.key });
+                                    that.model.set(updateObj);
+                                }
+                            });
+                            $("#" + obj.key).trumbowyg('html', obj.value);
+                        }
+                    });
+                });
                 this.$el.off("change", ".custom-col-1[data-id='value']>[data-key]").on("change", ".custom-col-1[data-id='value']>[data-key]", function(e) {
                     var key = $(this).data("key"),
                         businessMetadata = $(this).data("businessMetadata"),
@@ -177,8 +203,14 @@
                     }
                 }
                 if (typeName === "string" || typeName === "array<string>") {
-                    returnEL = '<' + elType + ' type="text" data-key="' + key + '" data-businessMetadata="' + businessMetadata + '" data-typename="' + typeName + '" data-multi="' + isMultiValued + '" data-tags="true"  placeholder="Enter String" class="form-control" ' + (isMultiValued === false && !_.isUndefinedNull(val) ? 'value="' + val + '"' : "") + '></' + elType + '>';
-                } else if (typeName === "boolean" || typeName === "array<boolean>") {
+                    if (typeName === "string") {
+                        elType = "textarea";
+                        returnEL = '<' + elType + ' type="text" data-key="' + key + '" data-businessMetadata="' + businessMetadata + '" data-typename="' + typeName + '" data-multi="' + isMultiValued + '" data-tags="true"  placeholder="Enter String" class="form-control" ' + (isMultiValued === false && !_.isUndefinedNull(val) ? 'value="' + val + '"' : "") + "id =" + businessMetadata.replace(/ /g, "_") + "_" + key.replace(/ /g, "_") + '></' + elType + '>';
+                    } else {
+                        returnEL = '<' + elType + ' type="text" data-key="' + key + '" data-businessMetadata="' + businessMetadata + '" data-typename="' + typeName + '" data-multi="' + isMultiValued + '" data-tags="true"  placeholder="Enter String" class="form-control" ' + (isMultiValued === false && !_.isUndefinedNull(val) ? 'value="' + val + '"' : "") +
+                            '></' + elType + '>';
+                    }
+                }  else if (typeName === "boolean" || typeName === "array<boolean>") {
                     returnEL = '<select data-key="' + key + '" data-businessMetadata="' + businessMetadata + '" data-typename="' + typeName + '" data-multi="' + isMultiValued + '" class="form-control">' + (isMultiValued ? "" : '<option value="">--Select Value--</option>') + '<option value="true" ' + (!_.isUndefinedNull(val) && val == "true" ? "selected" : "") + '>true</option><option value="false" ' + (!_.isUndefinedNull(val) && val == "false" ? "selected" : "") + '>false</option></select>';
                 } else if (typeName === "date" || typeName === "array<date>") {
                     returnEL = '<' + (isMultiValued ? "textarea" : "input") + ' type="text" data-key="' + key + '" data-businessMetadata="' + businessMetadata + '" data-typename="' + typeName + '"data-multi="' + isMultiValued + '" data-type="date" class="form-control" ' + (isMultiValued === false && !_.isUndefinedNull(val) ? 'value="' + val + '"' : "") + '>' + (isMultiValued === true && !_.isUndefinedNull(val) ? val : "") + (isMultiValued ? "</textarea>" : "");
@@ -268,6 +300,30 @@
                     this.model.clear({ silent: true }).set(tempObj)
                 }
                 valEl.html(this.getAttrElement({ businessMetadata: key[0], key: key[1], val: hasModalData ? hasModalData : { typeName: key[2] } }));
+                if (key[2] === "string") {
+                    var that = this,
+                        selector = '#' +  key[0].replace(/ /g, "_") + "_" + key[1].replace(/ /g, "_");
+                    Utils.addCustomTextEditor({
+                        small: true,
+                        selector: selector,
+                        initialHide: false,
+                        callback: function(e) {
+                            var $parent = $(e.target),
+                                key = $parent.data("key"),
+                                businessMetadata = $parent.data("businessMetadata"),
+                                typeName = $parent.data("typename"),
+                                updateObj = that.model.toJSON();
+                            if (_.isUndefinedNull(updateObj[key])) {
+                                updateObj[key] = { value: null, typeName: typeName };
+                            }
+                            updateObj[key].value = Utils.sanitizeHtmlContent({ selector: selector });
+                            that.model.set(updateObj);
+                        }
+                    });
+                    if(hasModalData && hasModalData.value){
+                        $(selector).trumbowyg('html', hasModalData.value);
+                    }
+                }
                 if (manual === undefined) {
                     this.model.collection.trigger("selected:attr", e.currentTarget.value, this.model);
                 }
diff --git a/dashboardv3/public/js/views/entity/EntityBusinessMetaDataView.js b/dashboardv3/public/js/views/entity/EntityBusinessMetaDataView.js
index 81db893..cb023ba 100644
--- a/dashboardv3/public/js/views/entity/EntityBusinessMetaDataView.js
+++ b/dashboardv3/public/js/views/entity/EntityBusinessMetaDataView.js
@@ -41,7 +41,8 @@
                 editMode: this.editMode,
                 entity: this.entity,
                 businessMetadataCollection: this.businessMetadataCollection,
-                enumDefCollection: this.enumDefCollection
+                enumDefCollection: this.enumDefCollection,
+                searchVent: this.searchVent
             };
         },
         templateHelpers: function() {
@@ -69,13 +70,14 @@
         },
         initialize: function(options) {
             var that = this;
-            _.extend(this, _.pick(options, "entity", "businessMetadataCollection", "enumDefCollection", "guid", "fetchCollection"));
+            _.extend(this, _.pick(options, "entity", "businessMetadataCollection", "enumDefCollection", "guid", "fetchCollection", "searchVent"));
             this.editMode = false;
             this.readOnlyEntity = Enums.entityStateReadOnly[this.entity.status];
             this.$("editBox").hide();
             this.actualCollection = new Backbone.Collection(
                 _.map(this.entity.businessAttributes, function(val, key) {
-                    var foundBusinessMetadata = that.businessMetadataCollection[key];
+                    var foundBusinessMetadata = that.businessMetadataCollection[key],
+                        businessMetadata = key;
                     if (foundBusinessMetadata) {
                         _.each(val, function(aVal, aKey) {
                             var foundAttr = _.find(foundBusinessMetadata, function(o) {
@@ -84,7 +86,10 @@
                             if (foundAttr) {
                                 val[aKey] = { value: aVal, typeName: foundAttr.typeName };
                             }
-                        })
+                            if (foundAttr && foundAttr.typeName === "string") {
+                                val[aKey].key = businessMetadata.replace(/ /g, "_") + "_" + aKey.replace(/ /g, "_");
+                            }
+                        });
                     }
                     return _.extend({}, val, { __internal_UI_businessMetadataName: key });
                 }));
@@ -124,6 +129,7 @@
                 this.createNameElement();
             } else {
                 this.collection.trigger("reset");
+                this.searchVent.trigger("BusinessMetaAttribute:Edit");
             }
             this.panelOpenClose();
         },
@@ -154,6 +160,9 @@
             this.$el.find('.custom-col-1[data-id="value"] [data-key]').each(function(el) {
                 var val = $(this).val(),
                     elIsSelect2 = $(this).hasClass("select2-hidden-accessible");
+                if (val) {
+                    val = Utils.sanitizeHtmlContent({ data: val });
+                }
                 if (_.isString(val)) {
                     val = val.trim();
                 }
@@ -165,6 +174,9 @@
                         $(this).siblings(".select2").find(".select2-selection").attr("style", "border-color : red !important");
                     } else {
                         $(this).css("borderColor", "red");
+                        if($(this).parent().hasClass("small-texteditor")){
+                            $(this).parent().css("borderColor", "red");
+                        }
                     }
                 } else {
                     if (elIsSelect2) {
@@ -261,9 +273,8 @@
                             if (val.typeName === "date") {
                                 newVal = Utils.formatDate({ date: newVal, zone: false, dateFormat: Globals.dateFormat });
                             }
-
                         }
-                        attrLi += "<tr><td class='business-metadata-detail-attr-key'>" + _.escape(key) + " (" + _.escape(val.typeName) + ")</td><td>" + _.escape(newVal) + "</td></tr>";
+                        attrLi += "<tr><td class='business-metadata-detail-attr-key'>" + _.escape(key) + " (" + _.escape(val.typeName) + ")</td><td>" + ((val.typeName === "string") ? Utils.sanitizeHtmlContent({ data: newVal }) : _.escape(newVal)) + "</td></tr>";
                     }
                 });
                 li += that.associateAttributePanel(obj, attrLi);
diff --git a/dashboardv3/public/js/views/glossary/GlossaryDetailLayoutView.js b/dashboardv3/public/js/views/glossary/GlossaryDetailLayoutView.js
index 845ace1..019cd9d 100644
--- a/dashboardv3/public/js/views/glossary/GlossaryDetailLayoutView.js
+++ b/dashboardv3/public/js/views/glossary/GlossaryDetailLayoutView.js
@@ -321,7 +321,7 @@
                 var longDescriptionContent = (data && data.longDescription) ? data.longDescription : "",
                     sanitizeLongDescriptionContent = "";
                 if (longDescriptionContent !== "") {
-                    sanitizeLongDescriptionContent = Utils.sanitizeHtmlContent(longDescriptionContent);
+                    sanitizeLongDescriptionContent = Utils.sanitizeHtmlContent({ data: longDescriptionContent });
                 }
                 //End
                 if (data) {
diff --git a/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js b/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js
index e31260d..1883dfb 100644
--- a/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js
+++ b/dashboardv3/public/js/views/search/tree/ClassificationTreeLayoutView.js
@@ -687,7 +687,7 @@
                     }).open();
                 modal.$el.find("button.ok").attr("disabled", "true");
                 view.ui.tagName.on('keyup input', function(e) {
-                    view.ui.description.val($(this).val().replace(/\s+/g, ' '));
+                    $(view.ui.description).trumbowyg('html', $(this).val().replace(/\s+/g, ' '));
                 });
                 view.ui.description.on('input keydown', function(e) {
                     $(this).val($(this).val().replace(/\s+/g, ' '));
@@ -732,7 +732,7 @@
             }
 
             var name = ref.ui.tagName.val(),
-                description = ref.ui.description.val(),
+                description = Utils.sanitizeHtmlContent({ data: ref.ui.description.val() }),
                 superTypes = [],
                 parentTagVal = ref.ui.parentTag.val();
             if (parentTagVal && parentTagVal.length) {
diff --git a/dashboardv3/public/js/views/tag/CreateTagLayoutView.js b/dashboardv3/public/js/views/tag/CreateTagLayoutView.js
index 476007a..a0b2104 100644
--- a/dashboardv3/public/js/views/tag/CreateTagLayoutView.js
+++ b/dashboardv3/public/js/views/tag/CreateTagLayoutView.js
@@ -84,7 +84,8 @@
             },
             bindEvents: function() {},
             onRender: function() {
-                var that = this;
+                var that = this,
+                    modalOkBtn;
                 this.$('.fontLoader').show();
                 if (this.create) {
                     this.tagCollectionList();
@@ -94,6 +95,19 @@
                 if (!('placeholder' in HTMLInputElement.prototype)) {
                     this.ui.createTagForm.find('input,textarea').placeholder();
                 }
+                modalOkBtn = function() {
+                    var editorContent = $(that.ui.description).trumbowyg('html'),
+                        okBtn = $('.modal').find('button.ok');
+                    okBtn.removeAttr("disabled");
+                    if (editorContent === "") {
+                        okBtn.prop('disabled', true);
+                    }
+                    if (that.description === editorContent) {
+                        okBtn.prop('disabled', true);
+                    }
+                };
+                Utils.addCustomTextEditor({ selector: this.ui.description, callback: modalOkBtn, small: false });
+                $(this.ui.description).trumbowyg('html', Utils.sanitizeHtmlContent({ data: this.description }));
                 that.hideLoader();
             },
             tagCollectionList: function() {
diff --git a/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js b/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js
index 52ff043..2a22d32 100644
--- a/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js
+++ b/dashboardv3/public/js/views/tag/TagAttributeDetailLayoutView.js
@@ -48,7 +48,8 @@
                 superType: "[data-id='superType']",
                 subType: "[data-id='subType']",
                 entityType: "[data-id='entityType']",
-                backButton: '[data-id="backButton"]'
+                backButton: '[data-id="backButton"]',
+                textType: '[name="textType"]'
             },
             /** ui events hash */
             events: function() {
@@ -58,6 +59,10 @@
                 events["click " + this.ui.backButton] = function() {
                     Utils.backButtonClick();
                 };
+                events["change " + this.ui.textType] = function(e) {
+                    this.isTextTypeChecked = !this.isTextTypeChecked;
+                    this.isTextTypeChecked ? this.ui.description.text(this.model.get("description")) : this.ui.description.html(this.model.get("description"));
+                };
                 return events;
             },
             /**
@@ -66,6 +71,7 @@
              */
             initialize: function(options) {
                 _.extend(this, _.pick(options, 'tag', 'collection', 'enumDefCollection'));
+                this.isTextTypeChecked = false;
             },
             bindEvents: function() {
                 this.listenTo(this.collection, 'reset', function() {
@@ -125,7 +131,7 @@
                     }
                 this.ui.title.html('<span>' + (Utils.getName(this.model.toJSON())) + '</span>');
                 if (this.model.get("description")) {
-                    this.ui.description.text(this.model.get("description"));
+                    this.isTextTypeChecked ? this.ui.description.text(this.model.get("description")) : this.ui.description.html(this.model.get("description"));
                 }
                 if (attributeDefs) {
                     if (!_.isArray(attributeDefs)) {