jqwidgets-framework
Version:
jQWidgets is an advanced Angular, Vue, Blazor, React, Web Components, jquery, ASP .NET MVC, Custom Elements and HTML5 UI framework.
8 lines (7 loc) • 85.6 kB
JavaScript
/*
jQWidgets v14.0.0 (2022-May)
Copyright (c) 2011-2022 jQWidgets.
License: https://jqwidgets.com/license/
*/
/* eslint-disable */
(function(b){b.jqx.jqxWidget("jqxEditor","",{});b.extend(b.jqx._jqxEditor.prototype,{defineInstance:function(){var d={width:null,height:null,disabled:false,pasteMode:"html",editable:true,lineBreak:"default",changeType:null,toolbarPosition:"top",fontFamily:"sans-serif",commands:{bold:{tooltip:"Bold",command:"bold",type:"toggleButton"},italic:{tooltip:"Italic",command:"italic",type:"toggleButton"},underline:{tooltip:"Underline",command:"underline",type:"toggleButton"},format:{placeHolder:"Format Block",tooltip:"Format Block",command:"formatblock",value:[{value:"p",label:"Paragraph"},{value:"h1",label:"Header 1"},{value:"h2",label:"Header 2"},{value:"h3",label:"Header 3"},{value:"h4",label:"Header 4"}],type:"list",width:120,dropDownWidth:190,height:25},font:{placeHolder:"Font",tooltip:"Font Name",command:"fontname",value:[{label:"Arial",value:"Arial, Helvetica, sans-serif"},{label:"Comic Sans MS",value:'"Comic Sans MS", cursive, sans-serif'},{label:"Courier New",value:'"Courier New", Courier, monospace'},{label:"Georgia",value:"Georgia,serif"},{label:"Impact",value:"Impact,Charcoal,sans-serif"},{label:"Lucida Console",value:"'Lucida Console',Monaco,monospace"},{label:"Tahoma",value:"Tahoma,Geneva,sans-serif"},{label:"Times New Roman",value:"'Times New Roman',Times,serif"},{label:"Trebuchet MS",value:'"Trebuchet MS",Helvetica,sans-serif'},{label:"Verdana",value:"Verdana,Geneva,sans-serif"}],type:"list",width:160,height:25,dropDownWidth:160},size:{placeHolder:"Size",tooltip:"Font Size",command:"fontsize",value:[{label:"1 (8pt)",value:"xx-small"},{label:"2 (10pt)",value:"x-small"},{label:"3 (12pt)",value:"small"},{label:"4 (14pt)",value:"medium"},{label:"5 (18pt)",value:"large"},{label:"6 (24pt)",value:"x-large"},{label:"7 (36pt)",value:"xx-large"}],type:"list",width:45,height:25,dropDownWidth:160},color:{tooltip:"Text Color",command:"forecolor",value:"#000",type:"colorPicker"},background:{tooltip:"Fill Color",command:"backcolor",value:"#fff",type:"colorPicker"},left:{tooltip:"Align Left",command:"justifyleft",type:"toggleButton"},center:{tooltip:"Align Center",command:"justifycenter",type:"toggleButton"},right:{tooltip:"Align Right",command:"justifyright",type:"toggleButton"},outdent:{tooltip:"Indent Less",command:"outdent",type:"button"},indent:{tooltip:"Indent More",command:"indent",type:"button"},ul:{tooltip:"Insert unordered list",command:"insertunorderedlist",type:"toggleButton"},ol:{tooltip:"Insert ordered list",command:"insertorderedlist",type:"toggleButton"},image:{tooltip:"Insert image",command:"insertimage",type:"button"},link:{tooltip:"Insert link",command:"createlink",type:"toggleButton"},html:{tooltip:"View source",command:"viewsource",type:"toggleButton"},clean:{tooltip:"Remove Formatting",command:"removeformat",type:"button"}},createCommand:null,defaultLocalization:{bold:"Bold",italic:"Italic",underline:"Underline",format:"Format Block",font:"Font Name",size:"Font Size",color:"Text Color",background:"Fill Color",left:"Align Left",center:"Align Center",right:"Align Right",outdent:"Indent Less",indent:"Indent More",ul:"Insert unordered list",ol:"Insert ordered list",image:"Insert image",link:"Insert link",html:"View source",clean:"Remove Formatting",Remove:"Remove",Ok:"Ok",Cancel:"Cancel",Change:"Change","Go to link":"Go to link","Open in a new window/tab":"Open in a new window/tab",Align:"Align",VSpace:"VSpace",HSpace:"HSpace",Width:"Width",Height:"Height",Title:"Title",URL:"URL","Insert Image":"Insert Image","Insert Link":"Insert Link","Alt Text":"Alt Text","not set":"<not set>",Left:"Left",Right:"Right",Paragraph:"Paragraph",Header:"Header",Arial:"Arial","Comic Sans MS":"Comic Sans MS","Courier New":"Courier New",Georgia:"Georgia",Impact:"Impact","Lucida Console":"Lucida Console",Tahoma:"Tahoma","Times New Roman":"Times New Roman","Trebuchet MS":"Trebuchet MS",Verdana:"Verdana"},localization:null,tools:"bold italic underline | format font size | color background | left center right | outdent indent | ul ol | image | link | clean | html",readOnly:false,stylesheets:new Array(),rtl:false,colorPickerTemplate:'<div class="jqx-editor-color-picker"><div role="grid"><table class="jqx-editor-color-picker-table" cellspacing="0" cellpadding="0"><tbody><tr><td aria-label="RGB (0, 0, 0)"><div title="RGB (0, 0, 0)" style="background-color: rgb(0, 0, 0);"></div></td><td aria-label="RGB (68, 68, 68)"><div title="RGB (68, 68, 68)" style="background-color: rgb(68, 68, 68);"></div></td><td aria-label="RGB (102, 102, 102)"><div title="RGB (102, 102, 102)" style="background-color: rgb(102, 102, 102);"></div></td><td aria-label="RGB (153, 153, 153)"><div title="RGB (153, 153, 153)" style="background-color: rgb(153, 153, 153);"></div></td><td aria-label="RGB (204, 204, 204)"><div title="RGB (204, 204, 204)" style="background-color: rgb(204, 204, 204);"></div></td><td aria-label="RGB (238, 238, 238)"><div title="RGB (238, 238, 238)" style="background-color: rgb(238, 238, 238);"></div></td><td aria-label="RGB (243, 243, 243)"><div title="RGB (243, 243, 243)" style="background-color: rgb(243, 243, 243);"></div></td><td aria-label="RGB (255, 255, 255)"><div title="RGB (255, 255, 255)" style="background-color: rgb(255, 255, 255);"></div></td></tr></tbody></table></div><div role="grid"><table class="jqx-editor-color-picker-table" cellspacing="0" cellpadding="0"><tbody><tr><td aria-label="RGB (255, 0, 0)"><div title="RGB (255, 0, 0)" style="background-color: rgb(255, 0, 0);"></div></td><td aria-label="RGB (255, 153, 0)"><div title="RGB (255, 153, 0)" style="background-color: rgb(255, 153, 0);"></div></td><td aria-label="RGB (255, 255, 0)"><div title="RGB (255, 255, 0)" style="background-color: rgb(255, 255, 0);"></div></td><td aria-label="RGB (0, 255, 0)"><div title="RGB (0, 255, 0)" style="background-color: rgb(0, 255, 0);"></div></td><td aria-label="RGB (0, 255, 255)"><div title="RGB (0, 255, 255)" style="background-color: rgb(0, 255, 255);"></div></td><td aria-label="RGB (0, 0, 255)"><div title="RGB (0, 0, 255)" style="background-color: rgb(0, 0, 255);"></div></td><td aria-label="RGB (153, 0, 255)"><div title="RGB (153, 0, 255)" style="background-color: rgb(153, 0, 255);"></div></td><td aria-label="RGB (255, 0, 255)"><div title="RGB (255, 0, 255)" style="background-color: rgb(255, 0, 255);"></div></td></tr></tbody></table></div><div role="grid"><table class="jqx-editor-color-picker-table" cellspacing="0" cellpadding="0"><tbody><tr><td aria-label="RGB (244, 204, 204)"><div title="RGB (244, 204, 204)" style="background-color: rgb(244, 204, 204);"></div></td><td aria-label="RGB (252, 229, 205)"><div title="RGB (252, 229, 205)" style="background-color: rgb(252, 229, 205);"></div></td><td aria-label="RGB (255, 242, 204)"><div title="RGB (255, 242, 204)" style="background-color: rgb(255, 242, 204);"></div></td><td aria-label="RGB (217, 234, 211)"><div title="RGB (217, 234, 211)" style="background-color: rgb(217, 234, 211);"></div></td><td aria-label="RGB (208, 224, 227)"><div title="RGB (208, 224, 227)" style="background-color: rgb(208, 224, 227);"></div></td><td aria-label="RGB (207, 226, 243)"><div title="RGB (207, 226, 243)" style="background-color: rgb(207, 226, 243);"></div></td><td aria-label="RGB (217, 210, 233)"><div title="RGB (217, 210, 233)" style="background-color: rgb(217, 210, 233);"></div></td><td aria-label="RGB (234, 209, 220)"><div title="RGB (234, 209, 220)" style="background-color: rgb(234, 209, 220);"></div></td></tr><tr><td id="T-Kw-Jn88" aria-label="RGB (234, 153, 153)"><div title="RGB (234, 153, 153)" style="background-color: rgb(234, 153, 153);"></div></td><td aria-label="RGB (249, 203, 156)"><div title="RGB (249, 203, 156)" style="background-color: rgb(249, 203, 156);"></div></td><td aria-label="RGB (255, 229, 153)"><div title="RGB (255, 229, 153)" style="background-color: rgb(255, 229, 153);"></div></td><td aria-label="RGB (182, 215, 168)"><div title="RGB (182, 215, 168)" style="background-color: rgb(182, 215, 168);"></div></td><td aria-label="RGB (162, 196, 201)"><div title="RGB (162, 196, 201)" style="background-color: rgb(162, 196, 201);"></div></td><td aria-label="RGB (159, 197, 232)"><div title="RGB (159, 197, 232)" style="background-color: rgb(159, 197, 232);"></div></td><td aria-label="RGB (180, 167, 214)"><div title="RGB (180, 167, 214)" style="background-color: rgb(180, 167, 214);"></div></td><td aria-label="RGB (213, 166, 189)"><div title="RGB (213, 166, 189)" style="background-color: rgb(213, 166, 189);"></div></td></tr><tr><td aria-label="RGB (224, 102, 102)"><div title="RGB (224, 102, 102)" style="background-color: rgb(224, 102, 102);"></div></td><td aria-label="RGB (246, 178, 107)"><div title="RGB (246, 178, 107)" style="background-color: rgb(246, 178, 107);"></div></td><td aria-label="RGB (255, 217, 102)"><div title="RGB (255, 217, 102)" style="background-color: rgb(255, 217, 102);"></div></td><td aria-label="RGB (147, 196, 125)"><div title="RGB (147, 196, 125)" style="background-color: rgb(147, 196, 125);"></div></td><td aria-label="RGB (118, 165, 175)"><div title="RGB (118, 165, 175)" style="background-color: rgb(118, 165, 175);"></div></td><td aria-label="RGB (111, 168, 220)"><div title="RGB (111, 168, 220)" style="background-color: rgb(111, 168, 220);"></div></td><td aria-label="RGB (142, 124, 195)"><div title="RGB (142, 124, 195)" style="background-color: rgb(142, 124, 195);"></div></td><td aria-label="RGB (194, 123, 160)"><div title="RGB (194, 123, 160)" style="background-color: rgb(194, 123, 160);"></div></td></tr><tr><td id="T-Kw-Jn104" aria-label="RGB (204, 0, 0)"><div title="RGB (204, 0, 0)" style="background-color: rgb(204, 0, 0);"></div></td><td aria-label="RGB (230, 145, 56)"><div title="RGB (230, 145, 56)" style="background-color: rgb(230, 145, 56);"></div></td><td aria-label="RGB (241, 194, 50)"><div title="RGB (241, 194, 50)" style="background-color: rgb(241, 194, 50);"></div></td><td aria-label="RGB (106, 168, 79)"><div title="RGB (106, 168, 79)" style="background-color: rgb(106, 168, 79);"></div></td><td aria-label="RGB (69, 129, 142)"><div title="RGB (69, 129, 142)" style="background-color: rgb(69, 129, 142);"></div></td><td aria-label="RGB (61, 133, 198)"><div title="RGB (61, 133, 198)" style="background-color: rgb(61, 133, 198);"></div></td><td aria-label="RGB (103, 78, 167)"><div title="RGB (103, 78, 167)" style="background-color: rgb(103, 78, 167);"></div></td><td aria-label="RGB (166, 77, 121)"><div title="RGB (166, 77, 121)" style="background-color: rgb(166, 77, 121);"></div></td></tr><tr><td aria-label="RGB (153, 0, 0)"><div title="RGB (153, 0, 0)" style="background-color: rgb(153, 0, 0);"></div></td><td aria-label="RGB (180, 95, 6)"><div title="RGB (180, 95, 6)" style="background-color: rgb(180, 95, 6);"></div></td><td aria-label="RGB (191, 144, 0)"><div title="RGB (191, 144, 0)" style="background-color: rgb(191, 144, 0);"></div></td><td aria-label="RGB (56, 118, 29)"><div title="RGB (56, 118, 29)" style="background-color: rgb(56, 118, 29);"></div></td><td aria-label="RGB (19, 79, 92)"><div title="RGB (19, 79, 92)" style="background-color: rgb(19, 79, 92);"></div></td><td aria-label="RGB (11, 83, 148)"><div title="RGB (11, 83, 148)" style="background-color: rgb(11, 83, 148);"></div></td><td aria-label="RGB (53, 28, 117)"><div title="RGB (53, 28, 117)" style="background-color: rgb(53, 28, 117);"></div></td><td aria-label="RGB (116, 27, 71)"><div title="RGB (116, 27, 71)" style="background-color: rgb(116, 27, 71);"></div></td></tr><tr><td aria-label="RGB (102, 0, 0)"><div title="RGB (102, 0, 0)" style="background-color: rgb(102, 0, 0);"></div></td><td aria-label="RGB (120, 63, 4)"><div title="RGB (120, 63, 4)" style="background-color: rgb(120, 63, 4);"></div></td><td aria-label="RGB (127, 96, 0)"><div title="RGB (127, 96, 0)" style="background-color: rgb(127, 96, 0);"></div></td><td aria-label="RGB (39, 78, 19)"><div title="RGB (39, 78, 19)" style="background-color: rgb(39, 78, 19);"></div></td><td aria-label="RGB (12, 52, 61)"><div title="RGB (12, 52, 61)" style="background-color: rgb(12, 52, 61);"></div></td><td aria-label="RGB (7, 55, 99)"><div title="RGB (7, 55, 99)" style="background-color: rgb(7, 55, 99);"></div></td><td aria-label="RGB (32, 18, 77)"><div title="RGB (32, 18, 77)" style="background-color: rgb(32, 18, 77);"></div></td><td aria-label="RGB (76, 17, 48)"><div title="RGB (76, 17, 48)" style="background-color: rgb(76, 17, 48);"></div></td></tr></tbody></table></div></div>',touchMode:false,keyPressed:null,events:["change"]};if(this===b.jqx._jqxEditor.prototype){return d}b.extend(true,this,d);this.localization=this.defaultLocalization;return d},createInstance:function(f){var j=this;j.textArea=j.host;var d=j.host.attr("contenteditable");j.host.addClass(j.toThemeProperty("jqx-widget"));if(d==true||d=="true"){j.inline=true;j.widget=j.host;j.editorDocument=document;j.selection=new a(j.editorDocument);var i=b("<div class='jqx-editor-toolbar-container' unselectable='on' aria-label='Formatting options' role='toolbar'><div class='jqx-editor-toolbar'></div>");i.insertBefore(j.host);j.toolbarContainer=i;j.toolbar=i.find(".jqx-editor-toolbar");j.editor=j.host;j.contentEditableElement=j.element}else{var g=b("<div class='jqx-editor'><div class='jqx-editor-container'><div class='jqx-editor-toolbar-container' aria-label='Formatting options' role='toolbar'><div class='jqx-editor-toolbar'></div></div><div class='jqx-editor-content'><iframe src='javascript:\"<html></html>\"' allowtransparency='true' frameborder='0'></iframe></div></div></div>");j.widget=g;j.widget[0].className=j.widget[0].className+" "+j.element.className;try{j.widget[0].style=j.element.style}catch(e){}var h=b.trim(j.host.html())+"​";if(j.lineBreak=="default"||j.lineBreak=="div"){h="<div>"+h+"</div>"}else{if(j.lineBreak=="p"){h="<p>"+h+"</p>"}}h=h.replace(/</ig,"<");h=h.replace(/>/ig,">");j.host.css("display","none");j.host.after(g);g.find("iframe").after(j.host);j.container=g.find(".jqx-editor-container");j.toolbarContainer=g.find(".jqx-editor-toolbar-container");j.toolbar=g.find(".jqx-editor-toolbar");j.iframe=g.find("iframe");j.content=g.find(".jqx-editor-content");var k=function(){j.editorDocument=j.iframe[0].contentWindow.document;j.selection=new a(j.editorDocument);var o=0;j.addHandler(j.iframe,"load",function(){o++;if(o>1){j.iframe.off("load");j.content.find("iframe").remove();var q=b("<iframe src='javascript:\"<html></html>\"' allowtransparency='true' frameborder='0'></iframe>").appendTo(j.content);j.iframe=g.find("iframe");k()}});if(!b.jqx.browser.mozilla){j.editorDocument.designMode="On"}j.editorDocument.open();var m=j.rtl?"direction:rtl;":"";var l=b.jqx.browser.msie?"::selection{color: #fff; background: #328EFD;};::-moz-selection{color: #fff; background: #328eD;};::selection:window-inactive {background: #c7c7c7; color: #000;}::-moz-selection:window-inactive {background: #c7c7c7; color: #000;}html{font-size:13px; height:100%;}body{padding-top:1px;margin-top:-1px; padding-right: 1px; overflow-x: hidden;word-wrap: break-word;-webkit-nbsp-mode: space;-webkit-line-break: after-white-space;":"";j.editorDocument.write("<!DOCTYPE html><html><head><meta charset='utf-8' /><style>html,body{padding:0; margin:0; font-size: 13px; font-family: "+j.fontFamily+"; background:#fff; min-height:100%; "+m+"}"+l+"}h1{font-size:2em;margin:.67em 0}h2{font-size: 1.5em; margin: .75em 0}h3{font-size: 1.17em; margin: .83em 0}h4{font-size:1em; margin: 1.12em 0 }h5{font-size: .83em; margin: 1.5em 0}h6{font-size: .75em; margin: 1.67em 0}p{margin: 0px;padding:0 .2em}ul,ol{padding-left:2.5em}a{color:#00a}code{font-size:1.23em}.jqx-editor-paste-element {position: absolute; left: -1000px; height: 1px; overflow: hidden; top: -1000px;}.jqx-editor-focus {border: 1px solid #aaa !important;}</style>"+b.map(j.stylesheets,function(q){return"<link rel='stylesheet' href='"+q+"'>"}).join("")+"</head><body autocorrect='off' contenteditable='true'></body></html>");j.contentEditableElement=j.editorDocument.body;if(j.host.is("textarea")){j._textArea=j.element;var n=j.host.data();n.jqxEditor.host=g;n.jqxEditor.element=g[0];j.element=g[0];g[0].id=j._textArea.id;j._textArea.id=j._textArea.id+"TextArea";b(j.element).addClass(j.toThemeProperty("jqx-widget"));j.host=b(j.element);j.host.data(n)}else{var n=j.host.data();n.jqxEditor.host=g;n.jqxEditor.element=g[0];j.element=g[0];j.host=b(j.element);j.host.data(n)}try{j.editorDocument.execCommand("useCSS",false,false);j.editorDocument.execCommand("enableInlineTableEditing",null,false)}catch(p){}try{j.editorDocument.execCommand("styleWithCSS",0,true)}catch(p){}j.editorDocument.close();j.editor=b(j.editorDocument.body);j.editor.html(h).attr("spellcheck",false).attr("autocorrect","off")};k();b.jqx.utilities.resize(j.host,function(){j.widget.css("width",j.width);j.widget.css("height",j.height);j._arrange()})}},focus:function(){var e=this;if(b.jqx.browser.mozilla){if(!e.focused){if(e.iframe){e.iframe.focus()}e.selection.selectNode(e.editor[0].firstChild,true);e.selection.getRange().collapse(true)}}e.editor.focus();var d=e.range!=null?e.range:e.getRange();e.selectRange(d)},print:function(){var d=window.open("","_blank","width=450,height=470,left=400,top=100,menubar=yes,toolbar=no,location=no,scrollbars=yes");d.document.open();d.document.write('<!doctype html><html><head><title>Print</title></head><body onload="print();">'+this.val()+"</body></html>");d.document.close()},refresh:function(d){var m=this;b.each(this.defaultLocalization,function(i,r){if(!m.localization[i]){m.localization[i]=r}});m._removeHandlers();m.toolbar.addClass(m.toThemeProperty("jqx-widget-header"));if(m.content){m.widget.css("width",m.width);m.widget.css("height",m.height);m.widget.addClass(m.toThemeProperty("jqx-editor"));m.widget.addClass(m.toThemeProperty("jqx-widget"));m.widget.addClass(m.toThemeProperty("jqx-rc-all"));m.widget.addClass(m.toThemeProperty("jqx-widget-header"));m.content.addClass(m.toThemeProperty("jqx-widget-content"));m.container.addClass(m.toThemeProperty("jqx-editor-container"))}else{m.toolbarContainer.addClass(m.toThemeProperty("jqx-widget-header"));m.toolbarContainer.addClass(m.toThemeProperty("jqx-editor-toolbar-inline"));m.toolbarContainer.addClass(m.toThemeProperty("jqx-widget"));m.toolbarContainer.addClass(m.toThemeProperty("jqx-rc-all"));m.toolbarContainer.hide();m.toolbarContainer.css("position","absolute");m.editor.addClass(m.toThemeProperty("jqx-editor-inline"));m.toolbarContainer.css("width",m.host.outerWidth()+"px")}var n=m.toolbarContainer.index();if(m.toolbarPosition=="top"&&n!=0||m.toolbarPosition=="bottom"&&n!=1){switch(m.toolbarPosition){case"bottom":m.toolbarContainer.insertAfter(m.content);break;case"top":default:m.toolbarContainer.insertBefore(m.content);break}}var h=m.tools;if(h!==false){var l=h.split(" ");var p=h.split(" | ");var q=function(i,r){b.each(r,function(y,F){var u=m.commands[this];if(!u){if(m.createCommand){u=m.createCommand(this.toString());if(!u){return true}if(!m.commands[this]){m.commands[this]=u}}else{return true}}else{if(m.createCommand){var x=m.createCommand(this.toString());u=b.extend(u,x)}}if(m.localization[this]){u.tooltip=m.localization[this]}switch(u.type){case"list":if(u.widget){u.widget.jqxDropDownList("destroy")}var A=function(R,Q,S){if(u.command=="formatblock"){return"<"+S+' unselectable="on" style="padding: 0px; margin: 0px;">'+Q+"</"+S+">"}else{if(u.command=="fontname"){return'<span unselectable="on" style="font-family: '+S+';">'+Q+"<span>"}else{if(u.command=="fontsize"){return'<span unselectable="on" style="font-size: '+S+';">'+Q+"<span>"}}}};var t=function(){var Q=m.toThemeProperty("jqx-editor-toolbar-icon")+" "+m.toThemeProperty("jqx-editor-toolbar-icon-"+u.command);var R="<div unselectable='on' style='margin-top: 0px; padding:0px;' class='"+Q+"'></div>";return R};var C=u.command=="formatblock"||u.command=="fontname"||u.command=="fontsize";var z=u.value||[];var N=new Array();var J=u.placeHolder||"Please Choose:";if(u.command=="fontname"){b.each(z,function(){var Q=m.localization[this.label];N.push({label:Q,value:this.value})})}else{if(u.command=="formatblock"){J=m.localization.format;b.each(z,function(){if(this.label.indexOf("Header")>=0){var Q=this.label.replace("Header",m.localization.Header)}else{var Q=m.localization[this.label]}N.push({label:Q,value:this.value})})}else{N=z}}var P={enableBrowserBoundsDetection:true,touchMode:m.touchMode,width:u.width||100,height:u.height||25,dropDownWidth:u.dropDownWidth||"auto",autoDropDownHeight:(u.value&&u.value.length)<12?true:false,placeHolder:J,source:N,theme:m.theme,hint:false,keyboardSelection:false,focusable:false,disabled:m.disabled,rtl:m.rtl,selectionRenderer:u.command=="fontsize"?t:null,renderer:C?A:null};var D="jqx-disableselect "+m.toThemeProperty("jqx-editor-dropdownlist")+" "+m.toThemeProperty("jqx-editor-toolbar-item");var w=b("<div unselectable='on' class='"+D+"'></div>");w.appendTo(i);w.jqxDropDownList(P);if(u.init){u.init(w)}var F=null;var E=null;var K="";m.addHandler(w,"mousedown",function(R){if(b(".jqx-editor-dropdownpicker").length>0){b(".jqx-editor-dropdownpicker").jqxDropDownButton("close")}if(b(".jqx-editor-dropdownlist").length>0){var Q=b(".jqx-editor-dropdownlist");b.each(Q,function(S,T){if(T!=w[0]){b(T).jqxDropDownList("close")}})}});m.addHandler(w,"open",function(Q){if(!m.focused){m.focus()}m.updating=true;m.activeElement=w;F=w.val();K=""});m.addHandler(w,"change",function(Q){m.updating=false;m.activeElement=null;E=w.val();K=Q.args.type;if(b.jqx.browser.msie&&b.jqx.browser.version<9){m.focus()}});m.addHandler(w,"close",function(Q){m.updating=false;m.activeElement=null;if(F!=E){if(K=="mouse"||K=="keyboard"){m._refreshTools()}}});m._addCommandHandler(w,"change",u.command,null,u);break;case"colorPicker":if(u.widget){b(u.colorPicker).remove();u.widget.jqxDropDownButton("destroy")}var B=b('<div unselectable="on" style="padding-top: 4px;"></div>').attr("id","picker-"+u.command);var D="jqx-disableselect "+m.toThemeProperty("jqx-editor-dropdownpicker")+" "+m.toThemeProperty("jqx-editor-toolbar-item");var w=b("<div unselectable='on' class='"+D+"'></div>");w.appendTo(i);w.append(B);w.jqxDropDownButton({hint:false,touchMode:m.touchMode,disabled:m.disabled,enableBrowserBoundsDetection:true,width:u.width||45,height:u.height||25,rtl:m.rtl,focusable:false,theme:m.theme});var I=b('<div unselectable="on" style="z-index: 55;">');var s=m.toThemeProperty("jqx-editor-toolbar-icon")+" "+m.toThemeProperty("jqx-editor-toolbar-icon-"+u.command);var O=b("<div unselectable='on' class='"+s+"'></div>");I.append(O);var L=b('<div unselectable="on" class="jqx-editor-color-bar">').attr("id","bar-"+u.command).css("background-color",u.value);I.append(L);w.jqxDropDownButton("setContent",I);B.append(b(m.colorPickerTemplate));u.colorPicker=B;if(u.init){u.init(w)}B.find("tr").attr("role","row").attr("unselectable","on");B.find("td").attr("role","gridcell").attr("unselectable","on").css("-webkit-user-select","none");B.find("div").attr("unselectable","on");m.addHandler(w,"mousedown",function(R){if(b(".jqx-editor-dropdownlist").length>0){b(".jqx-editor-dropdownlist").jqxDropDownList("close")}if(b(".jqx-editor-dropdownpicker").length>0){var Q=b(".jqx-editor-dropdownpicker");b.each(Q,function(S,T){if(T!=w[0]){b(T).jqxDropDownButton("close")}})}});m.addHandler(w,"open",function(){if(!m.focused){m.focus()}m.updating=true;m.activeElement=B});m.addHandler(w,"close",function(Q){m.updating=false;m.activeElement=null;if(F!=E){if(K=="mouse"||K=="keyboard"){m._refreshTools()}}});m.addHandler(B,"keydown",function(Q){var Y=Q.keyCode;var V=b(B).find(".jqx-editor-color-picker-selected-cell");var aa=B.find("tr");var T=aa.length;var S=V.parent().children().length;var U=V.index();var W=-999;var Z=V.parent();b.each(aa,function(ab,ac){if(this==Z[0]){W=ab;return false}});switch(Y){case 27:w.jqxDropDownButton("close");break;case 13:b(V).trigger("mousedown");break;case 38:W--;break;case 40:W++;break;case 39:U++;break;case 37:U--;break}if(W>=0&&W<=T){if(U>=0&&U<=S){var Z=B.find("tr")[W];var X=b(Z).children()[U];var R=b(X).children().css("background-color");u.val(R)}}});var M=b(B).find("td");u.val=function(Q){var R=m._rgbToHex(Q);b.each(M,function(){var S=b(this).children().css("background-color");var T=m._rgbToHex(S);if(T==R){M.removeClass("jqx-editor-color-picker-selected-cell");b(this).addClass("jqx-editor-color-picker-selected-cell");b("#bar-"+u.command).css("background",S);return false}})};u.val(u.value);m._addCommandHandler(M,"mousedown",u.command,null,u);break;case"button":case"toggleButton":default:if(u.widget){if(u.type=="button"){u.widget.jqxButton("destroy")}else{u.widget.jqxToggleButton("destroy")}}var v=u.command;var H=u.action;var s=m.toThemeProperty("jqx-editor-toolbar-icon")+" "+m.toThemeProperty("jqx-editor-toolbar-icon-"+v);var O=b("<div unselectable='on' class='"+s+"'></div>");var w=b("<div unselectable='on'></div>").addClass("jqx-disableselect").addClass(m.toThemeProperty("jqx-editor-toolbar-button"));if(!u.init){w.append(O)}else{if(v){w.append(O)}}w.appendTo(i);if(u.type=="button"){w.jqxButton({disabled:m.disabled,rtl:m.rtl,theme:m.theme})}else{if(u.type=="toggleButton"){w.jqxToggleButton({disabled:m.disabled,rtl:m.rtl,uiToggle:false,theme:m.theme})}}if(u.init){u.init(w)}u.toggled=false;u.toggle=function(){u.toggled=!u.toggled};m.addHandler(w,"mousedown",function(Q){if(Q.preventDefault){Q.preventDefault()}if(Q.stopPropagation){Q.stopPropagation()}return false});if(!b.jqx.mobile.isTouchDevice()){m._addCommandHandler(w,"click",v,H,u)}else{m._addCommandHandler(w,"mousedown",v,H,u)}break}u.widget=w;if(w){try{if(u.tooltip!=""){u.widget.attr("title",u.tooltip);u.widget.attr("data-tooltip",u.tooltip)}if(u.command){u.widget.attr("data-command",u.command)}u.widget.attr("aria-label",u.tooltip)}catch(G){}if(u.type=="button"||u.type=="toggleButton"){if(r.length>2){if(y==0){w.css("border-right-radius","0px");w.addClass(m.toThemeProperty("jqx-rc-l"))}else{if(y==r.length-1){w.css("border-left-radius","0px");w.addClass(m.toThemeProperty("jqx-rc-r"))}}w.removeClass(m.toThemeProperty("jqx-rc-all"))}if(y!=0&&y!=r.length-1&&r.length>2){w.css("border-left-radius","0px");w.css("border-right-radius","0px");w.removeClass(m.toThemeProperty("jqx-rc-all"))}else{if(r.length==2){if(y==0){w.css("border-right-radius","0px");w.addClass(m.toThemeProperty("jqx-rc-l"))}else{w.css("border-left-radius","0px");w.addClass(m.toThemeProperty("jqx-rc-r"))}w.removeClass(m.toThemeProperty("jqx-rc-all"))}else{if(r.length==1){w.css("margin-right","0px")}}}}}})};m.toolbar.css("direction",!this.rtl?"ltr":"rtl");if(p.length==0){q(m.toolbar,l)}else{for(var j=0;j<p.length;j++){var f=p[j];var l=f.split(" ");var o=m.toThemeProperty("jqx-editor-toolbar-group")+" "+m.toThemeProperty("jqx-fill-state-normal");var k=b("<div class='"+o+"'></div>");k.addClass(m.toThemeProperty("jqx-rc-all"));m.toolbar.append(k);q(k,l)}var g=m.toolbar.find(".jqx-editor-toolbar-group");var e=g.length;for(var j=0;j<e;j++){if(b(g[j]).children().length==0){b(g[j]).remove()}}}if(b.jqx.browser.msie&&b.jqx.browser.version<8){b(".jqx-editor-toolbar-group").css("float","left");b(".jqx-editor-toolbar-group").children().css("float","left");b(".jqx-editor-toolbar-group").css("zoom","1");b(".jqx-editor-toolbar-group").children().css("zoom","1")}}m._arrange();m._addHandlers()},_arrange:function(){var d=this;if(d.content){if(d.tools==""||d.tools==false){d.content.height(d.container.outerHeight()-parseInt(d.container.css("padding-top"))-parseInt(d.container.css("padding-bottom"))-6);d.content.css("margin-top","4px");d.toolbar.hide()}else{d.toolbar.show();d.content.css("margin-top","0px");d.content.height(d.container.outerHeight()-d.toolbar.outerHeight()-parseInt(d.container.css("padding-top"))-parseInt(d.container.css("padding-bottom"))-2);if(d.toolbarPosition!="top"){d.content.css("margin-top","4px");d.content.css("margin-bottom","0px")}}if(b.jqx.browser.msie&&b.jqx.browser.version<8){d.content.css("margin-top","4px");d.content.height(d.container.height()-d.toolbar.outerHeight()-2*parseInt(d.container.css("padding-bottom"))-10);d.content.width(d.container.width()-2*parseInt(d.container.css("padding-left"))-2)}if(d.editor.height()<d.content.height()){d.editor.height(d.content.height())}}},propertyChangedHandler:function(d,e,h,g){var f=d;if(f.isInitialized==undefined||f.isInitialized==false){return}if(e=="pasteMode"||e=="lineBreak"||e=="editable"){return}if(e=="disabled"){d._refreshTools()}if(e=="width"||e=="height"||e=="toolbarPosition"){d._arrange();return}if(e=="theme"){b.jqx.utilities.setTheme(h,g,d.host)}d.refresh()},selectRange:function(d){var e=this;if(!d){d=e.getRange()}e.selection.selectRange(d)},getRange:function(){var d=this;return d.selection.getRange()},getSelectedElement:function(){var h,k,d,g;var i=this;try{if(i.editorDocument.getSelection){var l=i.editorDocument.getSelection();h=l.getRangeAt(l.rangeCount-1);d=h.startContainer;g=h.endContainer;k=h.commonAncestorContainer;if(d.nodeName=="#text"){k=k.parentNode}if(d.nodeName=="#text"){d=d.parentNode}if(d.nodeName.toLowerCase()=="body"){d=d.firstChild}if(g.nodeName=="#text"){g=g.parentNode}if(g.nodeName.toLowerCase()=="body"){g=g.lastChild}if(d==g){k=d}return g}else{if(i.editorDocument.selection){h=i.editorDocument.selection.createRange();if(!h.duplicate){return null}k=h.parentElement();var f=h.duplicate();var e=h.duplicate();f.collapse(true);e.moveToElementText(f.parentElement());e.setEndPoint("EndToStart",f);d=f.parentElement();f=h.duplicate();e=h.duplicate();e.collapse(false);f.moveToElementText(e.parentElement());f.setEndPoint("StartToEnd",e);g=e.parentElement();if(d.nodeName.toLowerCase()=="body"){d=d.firstChild}if(g.nodeName.toLowerCase()=="body"){g=g.lastChild}if(d==g){k=d}return g}}}catch(j){return null}return null},_addHandlers:function(){var e=this;e.addHandler(e.toolbar,"mousedown.editor"+e.element.id,function(g){if(g.preventDefault){g.preventDefault()}if(g.stopPropagation){g.stopPropagation()}return false});var f=function(){if(e._textArea){if(!e.updating){e._textArea.value=e.val()}}if(e.changed){e._raiseEvent("change");e.changed=false}e.focused=false;if(e.inline){e.host.removeClass(e.toThemeProperty("jqx-fill-state-focus"));e.host.removeClass(e.toThemeProperty("jqx-editor-inline-focus"));if(e.tools==""||e.tools==null){return}e.toolbarContainer.fadeOut("fast")}};var d=function(){e.focused=true;if(e.inline){e.host.addClass(e.toThemeProperty("jqx-fill-state-focus"));e.host.addClass(e.toThemeProperty("jqx-editor-inline-focus"));e.host.addClass(e.toThemeProperty("jqx-rc-all"));if(e.tools==""||e.tools==null){return}e.toolbarContainer.fadeIn("fast");var g=e.host.coord();if(e.toolbarPosition!="bottom"){e.toolbarContainer.offset({left:g.left,top:g.top-e.toolbarContainer.outerHeight()-5})}else{e.toolbarContainer.offset({left:g.left,top:g.top+5+e.host.height()})}}};if(b.jqx.browser.mozilla){this.addHandler(b(document),"mousedown.editor"+e.element.id,function(g){f()})}e.addHandler(e.editor,"blur.editor"+e.element.id,function(g){f()});e.addHandler(e.editor,"focus.editor"+e.element.id,function(g){d()});e.addHandler(e.editor,"beforedeactivate.editor"+e.element.id,function(g){e.range=e.getRange()});e.addHandler(e.editor,"mousedown.editor"+e.element.id,function(g){if(!g.target.href){if(e.linkPopup){e.linkPopup.remove()}}e.range=e.getRange();if(b.jqx.browser.mozilla){d();g.stopPropagation()}if(b(".jqx-editor-dropdownpicker").length>0){b(".jqx-editor-dropdownpicker").jqxDropDownButton("close")}if(b(".jqx-editor-dropdownlist").length>0){b(".jqx-editor-dropdownlist").jqxDropDownList("close")}if(e.inline){e.editor.focus()}});if(b.jqx.mobile.isTouchDevice()){e.addHandler(b(e.editorDocument),"selectionchange.editor"+e.element.id,function(){if(e.editorDocument.activeElement!=e.editor[0]){setTimeout(function(){if(e.iframe){e.iframe[0].contentWindow.focus()}},500)}});e.addHandler(b(e.editorDocument),"touchstart.editor"+e.element.id,function(){setTimeout(function(){if(e.iframe){e.iframe[0].contentWindow.focus()}},500)})}e.addHandler(e.editor,"mouseup.editor"+e.element.id,function(g){if(e._documentMode=="source"){return true}e.range=e.getRange();e._refreshTools(null,true)});e.addHandler(e.editor,"keydown.editor"+e.element.id,function(g){if(e.keyPressed){e.keyPressed(g)}if(e._documentMode=="source"){return true}if(b.jqx.browser.mozilla){if(!e.focused){d()}}e.changeType="keyboard";if(e.disabled){if(g.preventDefault){g.preventDefault()}return false}if(e.updating){if(e.activeElement){var m=b.Event("keydown");b.extend(m,g);e.activeElement.trigger(m)}if(g.preventDefault){g.preventDefault()}return false}var n=g||window.event;var q=n.keyCode;var r=String.fromCharCode(q).toLowerCase();if(!e.editable){var l=[9,33,34,35,36,37,38,39,40,40,45];if(b.inArray(n.keyCode,l)==-1&&!(n.ctrlKey&&r=="c")&&!(n.ctrlKey&&r=="a")){g.preventDefault()}}if(e.selection.getText().length>0||e.linkPopup){var l=[8,9,13,33,34,35,36,37,38,39,40,40,45,46];if(!b.inArray(n.keyCode,l)!=-1||(n.keyCode==65&&n.ctrlKey&&!n.altKey&&!n.shiftKey)){if(e._refreshToolsTimer){clearTimeout(e._refreshToolsTimer)}e._refreshToolsTimer=setTimeout(function(){e._refreshTools(null,true,n.keyCode)},10)}}if(q==13&&e.lineBreak!="default"){var k=e.getSelectedElement();if(k){var o=k.nodeName.toLowerCase();switch(o){case"pre":case"li":case"ul":case"ol":case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return true}var p=k;while(p!=null){if(p.nodeName=="#document"){p=e.editorDocument.body;break}if(p.parentNode==e.editorDocument.body||p==e.editorDocument.body){break}p=p.parentNode}}if(p){var j=e.getRange();if(e.editorDocument.body.innerHTML=="<div></div>"&&e.lineBreak!="br"){e.selection.insertContent("​")}if(e.lineBreak=="div"){if(p==e.editorDocument.body){b(p).append("<div>​</div><span id='INSERTION_MARKER'> </span>")}else{b("<div>​</div><span id='INSERTION_MARKER'> </span>").insertAfter(p)}}else{if(e.lineBreak=="p"){if(p==e.editorDocument.body){b(p).append("<p>​</p><span id='INSERTION_MARKER'> </span>")}else{b("<p>​</p><span id='INSERTION_MARKER'> </span>").insertAfter(p)}}else{e.execute("insertHTML","<br/>​<span id='INSERTION_MARKER'> </span>")}}e.selectRange(j);var i=b(e.editorDocument).find("#INSERTION_MARKER");if(e.lineBreak!="br"){e.selection.selectNode(b(i).prev()[0],true)}else{e.selection.selectNode(i[0],true);if(e.getRange().setStartAfter){e.getRange().setStartAfter(i[0])}}i.remove();e.selection.collapse(false);if(p&&p.nodeName&&e.lineBreak=="br"){if(p.nodeName.toLowerCase()!="#text"){e.selection.selectNode(p,true);if(e.getRange().setStartAfter){e.getRange().setStartAfter(p)}e.selection.collapse(false)}}if(e.lineBreak!="br"){j=e.getRange();if(j.select){j.select()}}if(g.preventDefault){g.preventDefault()}return false}}if(n.ctrlKey&&(r=="k"||r=="u"||r=="b"||r=="i")){if(g.preventDefault){g.preventDefault()}var h=null;switch(r){case"k":h="link";break;case"u":h="underline";break;case"b":h="bold";break;case"i":h="italic";break}if(e.commands[h].widget){e.commands[h].widget.trigger("click")}return false}});e.addHandler(e.editor,"paste.editor"+e.element.id,function(g){if(e._documentMode=="source"){return true}if(e.readOnly){return true}e.updating=true;e.readOnly=true;var k=g;try{var h=function(r,q){if(q){if(!e.paragraphise){r=r.replace(/\n/g,"<br />")}else{r="<p>"+r+"</p>";r=r.replace(/\n/g,"</p><p>");r=r.replace(/<p>\s<\/p>/gi,"")}}else{r=r.replace(/<html[^>]*?>(.*)/gim,"$1");r=r.replace(/<\/html>/gi,"");r=r.replace(/<body[^>]*?>(.*)/gi,"$1");r=r.replace(/<\/body>/gi,"");r=r.replace(/<style[^>]*?>[\s\S]*?<\/style[^>]*>/gi,"");r=r.replace(/<(?:meta|link)[^>]*>\s*/gi,"");r=r.replace(/<\\?\?xml[^>]*>/gi,"");r=r.replace(/<w:[^>]*>[\s\S]*?<\/w:[^>]*>/gi,"");r=r.replace(/<o:p>\s*<\/o:p>/g,"");r=r.replace(/<o:p>[\s\S]*?<\/o:p>/g," ");r=r.replace(/<\/?\w+:[^>]*>/gi,"");r=r.replace(/<\!--[\s\S]*?-->/g,"");r=r.replace(/<\!\[[\s\S]*?\]>/g,"");r=r.replace(/\s*mso-[^:]+:[^;"']+;?/gi,"");r=r.replace(/<(\w[^>]*) style='([^\']*)'([^>]*)/gim,"<$1$3");r=r.replace(/<(\w[^>]*) style="([^\"]*)"([^>]*)/gim,"<$1$3");r=r.replace(/\s*margin: 0cm 0cm 0pt\s*;/gi,"");r=r.replace(/\s*margin: 0cm 0cm 0pt\s*"/gi,'"');r=r.replace(/\s*text-indent: 0cm\s*;/gi,"");r=r.replace(/\s*text-indent: 0cm\s*"/gi,'"');r=r.replace(/\s*text-align: [^\s;]+;?"/gi,'"');r=r.replace(/\s*page-break-before: [^\s;]+;?"/gi,'"');r=r.replace(/\s*font-variant: [^\s;]+;?"/gi,'"');r=r.replace(/\s*tab-stops:[^;"']*;?/gi,"");r=r.replace(/\s*tab-stops:[^"']*/gi,"");r=r.replace(/\s*face="[^"']*"/gi,"");r=r.replace(/\s*face=[^ >]*/gi,"");r=r.replace(/\s*font-family:[^;"']*;?/gi,"");r=r.replace(/\s*font-size:[^;"']*;?/gi,"");r=r.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");r=r.replace(/<(\w+)[^>]*\sstyle="[^"']*display\s?:\s?none[\s \S]*?<\/\1>/ig,"");r=r.replace(/\s*style='\s*'/gi,"");r=r.replace(/\s*style="\s*"/gi,"");r=r.replace(/<span\s*[^>]*>\s* \s*<\/span>/gi," ");r=r.replace(/<span\s*[^>]*><\/span>/gi,"");r=r.replace(/<(\w[^>]*) align=([^ |>]*)([^>]*)/gi,"<$1$3");r=r.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");r=r.replace(/<span([^>]*)>([\s\S]*?)<\/span>/gi,"$2");r=r.replace(/<font\s*>([\s\S]*?)<\/font>/gi,"$1");r=r.replace(/<(u|i|strike)> <\/\1>/gi," ");r=r.replace(/<h\d>\s*<\/h\d>/gi,"");r=r.replace(/<(\w[^>]*) language=([^ |>]*)([^>]*)/gi,"<$1$3");r=r.replace(/<(\w[^>]*) onmouseover="([^\"']*)"([^>]*)/gi,"<$1$3");r=r.replace(/<(\w[^>]*) onmouseout="([^\"']*)"([^>]*)/gi,"<$1$3");r=r.replace(/<h(\d)([^>]*)>/gi,"<h$1>");r=r.replace(/<(h\d)><font[^>]*>([\s\S]*?)<\/font><\/\1>/gi,"<$1>$2</$1>");r=r.replace(/<(h\d)><em>([\s\S]*?)<\/em><\/\1>/gi,"<$1>$2</$1>");r=r.replace(/<b\b[^>]*>(.*?)<\/b[^>]*>/gi,"<strong>$1</strong>");r=r.replace(/<i\b[^>]*>(.*?)<\/i[^>]*>/gi,"<em>$1</em>");r=r.replace(/<\s+[^>]*>/gi,"");r=r.replace(/<span>([\s\S]*?)<\/span>/gi,"$1");r=r.replace(/<span>([\s\S]*?)<\/span>/gi,"$1");r=r.replace(/<div>([\s\S]*?)<\/div>/gi,"$1");r=r.replace(/<div>([\s\S]*?)<\/div>/gi,"$1");r=r.replace(/<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g,"");r=r.replace(/<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g,"");r=r.replace(/<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g,"");if(r.trim){r=r.trim()}if(!e.paragraphise){r.replace(/<p>/gi,"<br />");r.replace(/<\/p>/gi,"")}else{var p=r.substr(0,2);if("<p"!==p){r="<p>"+r+"</p>";r=r.replace(/\n/g,"</p><p>");r=r.replace(/<br[^>]*>/gi,"</p><p>")}}r=r.replace(/<br>/gi,"<br />");r=r.replace(/<br[^>]*><\/p>/gim,"</p>");r=r.replace(/<p> <\/p>/gi,"");r=r.replace(/<p>\s<\/p>/gi,"");r=r.replace(/<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g,"");r=r.replace(/MsoNormal/gi,"");r=r.replace(/<\/?meta[^>]*>/gi,"");r=r.replace(/<\/?xml[^>]*>/gi,"");r=r.replace(/<\?xml[^>]*\/>/gi,"");r=r.replace(/<!--(.*)-->/gi,"");r=r.replace(/<!--(.*)>/gi,"");r=r.replace(/<!(.*)-->/gi,"");r=r.replace(/<w:[^>]*>(.*)<\/w:[^>]*>/gi,"");r=r.replace(/<w:[^>]*\/>/gi,"");r=r.replace(/<\/?w:[^>]*>/gi,"");r=r.replace(/<m:[^>]*\/>/gi,"");r=r.replace(/<m:[^>]>(.*)<\/m:[^>]*>/gi,"");r=r.replace(/<o:[^>]*>(.*)<\/o:[^>]*>/gi,"");r=r.replace(/<o:[^>]*\/>/gi,"");r=r.replace(/<\/?m:[^>]*>/gi,"");r=r.replace(/style=\"([^>]*)\"/gi,"");r=r.replace(/style=\'([^>]*)\'/gi,"");r=r.replace(/class=\"(.*)\"/gi,"");r=r.replace(/class=\'(.*)\'/gi,"");r=r.replace(/<b>/gi,"<strong>");r=r.replace(/<\/b>/gi,"</strong>");r=r.replace(/<p[^>]*>/gi,"<p>");r=r.replace(/<\/p[^>]*>/gi,"</p>");r=r.replace(/<span[^>]*>/gi,"");r=r.replace(/<\/span[^>]*>/gi,"");r=r.replace(/<st1:[^>]*>/gi,"");r=r.replace(/<\/st1:[^>]*>/gi,"");r=r.replace(/<font[^>]*>/gi,"");r=r.replace(/<\/font[^>]*>/gi,"");r=r.replace(" ","");r=r.replace(/<strong><\/strong>/gi,"");r=r.replace(/<p><\/p>/gi,"");r=r.replace(/\/\*(.*)\*\//gi,"");r=r.replace(/<!--/gi,"");r=r.replace(/-->/gi,"");r=r.replace(/<style[^>]*>[^<]*<\/style[^>]*>/gi,"");r=r.trim()}return r};var m=e.getRange();if(e.pasteMode=="text"&&!b.jqx.browser.mozilla){e.selection.insertContent('<textarea cols="50" contenteditable="false" class="jqx-editor-paste-element"></textarea>')}else{e.selection.insertContent('<div class="jqx-editor-paste-element"> </div>')}var n=b(window).scrollTop();var i=b(e.editorDocument).find(".jqx-editor-paste-element");i.css("top",n+"px");if(e.editor[0].createTextRange){g.preventDefault();var o=e.editor[0].createTextRange();o.moveToElementText(i[0]);o.execCommand("Paste")}else{var j=e.editorDocument.createRange();j.selectNodeContents(i[0]);e.selectRange(j)}if(e.pasteMode=="text"&&!b.jqx.browser.mozilla){i.select()}e.marker=i;setTimeout(function(){e.selectRange(m);var s=function(B){var z=e.editorDocument.createElement("div");var A=e.editorDocument.createDocumentFragment();z.innerHTML=B;while(z.firstChild){A.appendChild(z.firstChild)}return A};if(e.pasteMode!="text"){var y=s(e.marker.html());if(y.firstChild&&y.firstChild.className==="jqx-editor-paste-element"){var q=[];for(var v=0,t=y.childNodes.length;v<t;v++){q.push(y.childNodes[v].innerHTML)}y=s(q.join("<br />"))}var p=document.createElement("div");p.appendChild(y.cloneNode(true));var x=p.innerHTML}else{var x=e.marker.val();if(e.marker.html()!=""&&e.marker.val().indexOf("\n")==-1){var x=e.marker.html();x=x.replace(/ /gm,"");x=x.replace(/\n\n/gm,"\n");x=x.replace(/<br[^>]*>/gi,"\n");x=x.replace(/<li[^>]*>/gi,"\n");x=x.replace(/<p[^>]*>/gi,"\n");e.marker.html(x);var x=e.marker.text()}}var r=h(x,e.pasteMode=="text");var w=e.getRange();e.selection.insertContent(r+"<span id='INSERTION_MARKER'> </span>");e.marker.remove();var u=b(e.editorDocument).find("#INSERTION_MARKER");e.selection.selectNode(u[0],true);if(e.getRange().setStartAfter){e.getRange().setStartAfter(u[0])}u.remove();e.selection.collapse(false);u.removeAttr("id");e._refreshTools();e.changed=true},100);e.updating=false;e.readOnly=false}catch(l){if(console){console.log(l)}}});e.addHandler(e.editor,"keyup.editor"+e.element.id,function(i){if(e._documentMode=="source"){return true}if(e.updating||e.disabled||!e.editable){if(i.preventDefault){i.preventDefault()}if(i.stopPropagation){i.stopPropagation()}return false}e.range=e.getRange();e.changed=true;var h=i||window.event;var g=h.keyCode;var j=[8,9,13,33,34,35,36,37,38,39,40,40,45,46];if(b.inArray(h.keyCode,j)!=-1||(h.keyCode==65&&h.ctrlKey&&!h.altKey&&!h.shiftKey)){e._refreshTools(null,true,h.keyCode)}});e.addHandler(e.editor,"click.editor"+e.element.id,function(g){if(e._documentMode=="source"){return true}if(e.editImage){b(e.editImage).removeClass("jqx-editor-focus");e.editImage=null}if(g.target.tagName.toLowerCase()=="img"){var h=g.target;e.editImage=h;b(e.editImage).addClass("jqx-editor-focus")}});e.addHandler(e.editor,"dblclick.editor"+e.element.id,function(g){if(e._documentMode=="source"){return true}if(g.target.tagName.toLowerCase()=="img"){var h=g.target;if(b("#imageWindow"+this.element.id).length>0){e.editImage=h;e._updateImageWindow()}}})},_updateLinkWindow:function(){var g=this;var i=b("#linkWindow"+this.element.id);i.jqxWindow({position:{center:g.widget}});i.jqxWindow("open");var e=i.find("input");var h=i.find(".jqx-editor-link-checkbox");var f=i.find("button:first");var d=b(i.find("button")[1]);if(g.editLink&&g.editLink.href){e[0].value=g.editLink.href||"";e[1].value=b(g.editLink).text()||g.editLink.href;h.val(b(g.editLink).attr("target")=="_blank");d.show()}else{e[0].value="";e[1].value="";if(!g.selection.isCollapsed()){var j=g.selection.getText();if(j.match(/^(?!:\/\/)([a-zA-Z0-9]+\.)?[a-zA-Z0-9][a-zA-Z0-9-]+\.[a-zA-Z]{2,6}?$/i)){e[0].value=j}else{e[1].value=j}}h.val(false);d.hide()}if(e[0].value.length>0){f.jqxButton({disabled:false})}else{f.jqxButton({disabled:true})}},_updateImageWindow:function(){var g=this;var i=g.editImage;if(!i){i=b("<img>")[0]}var h=b("#imageWindow"+this.element.id);h.jqxWindow({position:{center:g.widget}});h.jqxWindow("open");var e=h.find("input");var d=b(h.find("button")[1]);if(g.editImage){d.show()}else{d.hide()}e[0].value=i.src;if(e[0].value==""){e[0].value=""}e[1].value=i.alt;if(i.style.width!="auto"){e[2].value=i.style.width}else{e[2].value=""}if(i.style.height!="auto"){e[3].value=i.style.height}else{e[3].value=""}if(i.style.marginLeft&&i.style.marginLeft!="0px"){e[4].value=i.style.marginLeft}else{e[4].value=""}if(i.style.marginTop&&i.style.marginTop!="0px"){e[5].value=i.style.marginTop}else{e[5].value=""}var j=h.find(".jqx-editor-align");var f=b(i).css("float");if(f=="left"){j.jqxDropDownList({selectedIndex:1})}else{if(f=="right"){j.jqxDropDownList({selectedIndex:2})}else{j.jqxDropDownList({selectedIndex:0})}}},_removeHandlers:function(){var d=this;if(d.editor){d.removeHandler(d.editor,"paste.editor"+d.element.id);d.removeHandler(d.editor,"blur.editor"+d.element.id);d.removeHandler(d.editor,"focus.editor"+d.element.id);d.removeHandler(d.editor,"click.editor"+d.element.id);d.removeHandler(d.editor,"mousedown.editor"+d.element.id);d.removeHandler(d.editor,"mouseup.editor"+d.element.id);d.removeHandler(d.editor,"keyup.editor"+d.element.id);d.removeHandler(d.editor,"keydown.editor"+d.element.id);d.removeHandler(d.editor,"beforedeactivate.editor"+d.element.id);d.removeHandler(d.editor,"dblclick.editor"+d.element.id)}if(d.toolbar){d.removeHandler(d.toolbar,"mousedown.editor"+d.element.id)}},getParentByTag:function(e,d){var d=d.toLowerCase(),f=e;do{if(d==""||f.nodeName.toLowerCase()==d){return f}}while(f=f.parentNode);return e},isStyleProperty:function(g,f,j,i){var f=f.toLowerCase(),h=g;do{if(h.nodeName.toLowerCase()==f&&h.style[j]==i){return !0}}while(h=h.parentNode);return !1},setStyleProperty:function(e,d){this.style[d]=!1;var f=this.getParentByTag(e,d);f&&f.tagName.toLowerCase()==d&&(this.style[d]=!0);if(d=="del"&&this.getParentByTag(e,"strike")&&this.getParentByTag(e,"strike").tagName.toLowerCase()=="strike"){this.style.del=!0}},updateStyle:function(f){var g=this;var f=g.getSelectedElement()?g.getSelectedElement():f;if(!f||!g.setStyleProperty){return}try{if(window.getComputedStyle){if(f.nodeName.toLowerCase()=="#text"){f=g.editor[0]}var d=window.getComputedStyle(f,null);var i=((d.getPropertyValue("font-weight")==401)?700:d.getPropertyValue("font-weight"));g.style={fontStyle:d.getPropertyValue("font-style"),fontSize:d.getPropertyValue("font-size"),textDecoration:d.getPropertyValue("text-decoration"),fontWeight:i,fontFamily:d.getPropertyValue("font-family"),textAlign:d.getPropertyValue("text-align"),color:g._rgbToHex(d.color),backColor:g._rgbToHex(d.backgroundColor)};g.style.fontStyle=d.getPropertyValue("font-style");g.style.vAlign=d.getPropertyValue("vertical-align");g.style.del=g.isStyleProperty(f,"span","textDecoration","line-through");g.style.u=g.isStyleProperty(f,"span","textDecoration","underline");var h=function(l){var k="transparent";var e="rgba(0, 0, 0, 0)";while(l&&(window.getComputedStyle(l).backgroundColor==k||window.getComputedStyle(l).backgroundColor==e)){l=l.parentNode}return l?window.getComputedStyle(l).backgroundColor:k};if(!g.style.backColor){g.style.backColor=g._rgbToHex(h(f))}}else{var d=f.currentStyle;g.style={fontStyle:d.fontStyle,fontSize:d.fontSize,textDecoration:d.textDecoration,fontWeight:d.fontWeight,fontFamily:d.fontFamily,textAlign:d.textAlign,color:g._rgbToHex(d.color),backColor:g._rgbToHex(d.backgroundColor)}}g.setStyleProperty(f,"h1");g.setStyleProperty(f,"h2");g.setStyleProperty(f,"h3");g.setStyleProperty(f,"h4");g.setStyleProperty(f,"h5");g.setStyleProperty(f,"h6");g.setStyleProperty(f,"del");g.setStyleProperty(f,"sub");g.setStyleProperty(f,"sup");g.setStyleProperty(f,"u");if(f.nodeName.toLowerCase()=="a"){if(g.style.textDecoration=="underline"){g.style.u=true}}if(g.style.h1||g.style.h2||g.style.h3||g.style.h4||g.style.h5||g.style.h6){g.style.heading=true}}catch(j){return null}},_refreshTools:function(e,f,n){var k=this;if(k.updating){return}var e=k.getSelectedElement()?k.getSelectedElement():e;if(!e||!k.setStyleProperty){return}k.updateStyle(e);var o=k.readOnly;k.readOnly=true;if(k.tools!==false){var j=k.tools.split(" ");var l=k.tools.split(" | ");var m=function(i){b.each(i,function(q,r){var p=k.commands[this];if(!p){return true}switch(p.type){case"list":p.widget.jqxDropDownList("clearSelection");p.widget.jqxDropDownList({disabled:k.disabled});break;case"colorPicker":p.val(p.value);p.widget.jqxDropDownButton({disabled:k.disabled});break;case"toggleButton":p.widget.jqxToggleButton("unCheck");p.widget.jqxToggleButton({disabled:k.disabled});break;case"button":default:p.widget.jqxButton({disabled:k.disabled});break}})};if(l.length==0){m(j)}else{for(var h=0;h<l.length;h++){var d=l[h];var j=d.split(" ");m(j)}}if(k.style){var g=function(i){b.each(i,function(x,E){var t=k.commands[this];if(!t){return true}if(t.refresh){t.refresh(t.widget,k.style);return true}switch(t.type){case"list":if(t.command=="fontname"){var B=-1;var D=999;for(var H=0;H<t.value.length;H++){var E=t.value[H].label.toLowerCase();var w=k.style.fontFamily.toLowerCase().indexOf(E);if(w>=0){if(w<D){B=H}D=Math.min(D,w)}}t.widget.jqxDropDownList("selectIndex",B)}else{if(t.command=="formatblock"){var E=null;if(k.style.h1){E="h1"}else{if(k.style.h2){E="h2"}else{if(k.style.h3){E="h3"}else{if(k.style.h4){E="h4"}else{if(k.style.h5){E="h5"}else{if(k.style.h6){E="h6"}}}}}}t.widget.jqxDropDownList("selectItem",E)}else{if(t.command=="fontsize"){var A="xx-small,x-small,small,medium,large,x-large,xx-large".split(",");var C=-1;try{var C=e.getAttribute("size")-1;if(C==-1){C=k.editorDocument.queryCommandValue(t.command)-1}}catch(I){}var s=A[C];t.widget.val(s)}}}break;case"colorPicker":var r=function(J){if(typeof J!="number"){return J}return"rgb("+(J&255)+", "+((J&65280)>>8)+", "+((J&16711680)>>16)+")"};var F=r(k.editorDocument.queryCommandValue(t.command));if(t.command=="backcolor"){if(k.style.backColor==null){F="#FFFFFF"}}var z=k._rgbToHex(F);if(z){t.val(z)}else{if(t.command=="forecolor"){t.val(k.style.color)}else{if(t.command=="backcolor"){t.val(k.style.backColor)}}}break;case"toggleButton":if(t.command=="viewsource"){return}if(!t.command){return}var q=false;var p=k.editorDocument.queryCommandState(t.command)&