UNPKG

ns-components-angular

Version:

Angular Wrapper Components for NSComponents

1 lines 398 kB
export declare const NSEditorCode = "var nsModuleExport = function(root,name,prototype)\r\n\t{\r\n\t\tif(typeof exports === 'object' && typeof module === 'object')\r\n\t\t{\r\n\t\t\tmodule.exports[name] = prototype;\r\n\t\t}\r\n\t\telse if (typeof define === \"function\" && define.amd)\r\n\t\t{\r\n\t\t\tdefine(name,[], function () {return prototype;});\r\n\t\t}\r\n\t\telse if(typeof exports === 'object')\r\n\t\t{\r\n\t\t\texports[name] = prototype;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\troot[name] = prototype;\r\n\t\t}\r\n\t};var nsIsWeb = function(root)\r\n\t{\r\n\t\tif(typeof exports === 'object' && typeof module === 'object')\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse if (typeof define === \"function\" && define.amd)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse if(typeof exports === 'object')\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}\r\n\t};if(!nsIsWeb())\r\n\t\t{\r\nvar nsutilRef = require('./nsUtil.min.js');\r\nvar NSUtil = nsutilRef.NSUtil;\r\nvar nscontainerbaseRef = require('./nsContainerBase.min.js');\r\nvar nsExtendPrototype = nscontainerbaseRef.nsExtendPrototype;\r\nvar NSContainerBase = nscontainerbaseRef.NSContainerBase;\r\n\r\n\t\t}\r\nvar NSEditor = (function()\r\n{\r\n\tfunction NSEditor(component,setting) \r\n\t{\r\n\t\tthis.__orignalTextArea = component;\r\n\t\tthis.__setting = setting;\r\n\t\t\r\n\t\tthis.__context = window;\r\n\t\t\r\n\t\tthis.editorUtil = null;\r\n\t\tthis.__config = null;\r\n\t\tthis.__selection = null;\r\n\t\tthis.__toolBar = null;\r\n\t\tthis.__execCommand = null;\r\n\t\tthis.__stack = null;\r\n\t\t\r\n\t\tthis.__divOuterContainer = null;\r\n\t\tthis.__divTabContainer = null;\r\n\t\tthis.__divBodyContainer = null;\r\n\t\tthis.__divFooterContainer = null;\r\n\t\tthis.__divFooterLeftContainer = null;\r\n\t\tthis.__divFooterRightContainer = null;\r\n\t\tthis.__divLineNumberContainer = null;\r\n\t\tthis.__divTextAreaContainer = null;\r\n\t\tthis.__compTextArea = null;\r\n\t\tthis.__divLineNumberWrapper = null;\r\n\t\tthis.__frameContentWindow = null;\r\n\t\tthis.__frameContentDoc = null;\r\n\t\tthis.__frameBody = null;\r\n\t\tthis.__txtSourceCode = null;\r\n\t\tthis.__iframePrint = null;\r\n\t\t\r\n\t\tthis.__textAreaScrollRef = null;\r\n\t\tthis.__textAreaResizeRef = null;\r\n\t\tthis.__textAreaKeyUpRef = null;\r\n\t\tthis.__textAreaKeyDownRef = null;\r\n\t\t\r\n\t\tthis.__textAreaObserver = null; \r\n\t\tthis.__orignalTextAreaObserver = null; \r\n\t\tthis.__timeOutInterval = null;\r\n\t\tthis.__lastTextAreaHeight = 0; \r\n\t\tthis.__lastTextAreaWidth = 0;\r\n\t\tthis.__paddingHorizontal = 0;\r\n\t\tthis.__browserDetail = null;\r\n\t\tthis.__dom = null;\r\n\t\tthis.__accessibleKeys = null;\r\n\t\tthis.__toolBarButton = null;\r\n\t\tthis.__objShortKey = {};\r\n\t\tthis.__isDisabled = false;\r\n\t\tthis.__isFrameDesignModeEnabled = false;\r\n\t\tthis.__isSourceMode = false;\r\n\t\tthis.__isInternalHTMLChange = false;\r\n\t\tthis.__hasRendered = false;\r\n\t\tthis.__renderedInterval = null;\r\n\t\tthis.__resizeInterval = null;\r\n\t\t//this.__defaultContent = \"<p class='nsEditorLineElement'><br></p>\";\r\n\t\tthis.__defaultContent = null;\r\n\t\t //queue up the functions not called as Creation Complete called later\r\n\t\tthis.__queueFunc = [];\r\n\t\t\r\n\t\tthis.__pluginsInstances = {};\r\n\t\tthis.__utilInstance = {};\r\n\t\t\r\n\t\tthis.__init();\r\n\t\t\r\n\t\tthis.base.__setBaseComponent.call(this,this.__divOuterContainer);\r\n\t};\r\n\tnsExtendPrototype(NSContainerBase,NSEditor);\r\n\tNSEditor.prototype.constructor = NSEditor;\r\n\t\r\n\tNSEditor.prototype.initializeComponent = function() \r\n\t{\r\n\t\tthis.base.initializeComponent.call(this);\r\n\t\tthis.__browserDetail = this.util.getBrowser();\r\n\t\tthis.__dom = this.util.getDomVariables();\r\n\t\tthis.__accessibleKeys = {ctrl:{str:\"ctrl\",isPressed:function(event,keyCode){\r\n\t\t\treturn (event.ctrlKey || event.metaKey || keyCode === 91 || keyCode === 92 || keyCode === 224);\r\n\t\t}},\r\n\t\tshift:{str:\"shift\",isPressed:function(event,keyCode){\r\n\t\t\treturn event.shiftKey;\r\n\t\t}},\r\n\t\talt:{str:\"alt\",isPressed:function(event,keyCode){\r\n\t\t\treturn event.altKey;\r\n\t\t}},\r\n\t\t}\r\n\t\t\r\n\t\tthis.__toolBarButton = {\"bold\":{html:\"<i class='ns-icon ns-editor-bold' aria-hidden='true'></i>\",tooltip:\"Bold\",tags: [\"b\", \"strong\"],css: {fontWeight: \"bold\"},shortKey:[\"ctrl+b\"],command:\"bold\",showAsMenu: true},\r\n\t\t\t\t \"italic\":{html:\"<i class='ns-icon ns-editor-italics' aria-hidden='true'></i>\",tooltip:\"Italic\",tags: [\"i\", \"em\"],css: {fontStyle: \"italic\"},shortKey: [\"ctrl+i\"],command:\"italic\",showAsMenu: true},\r\n\t\t\t\t \"underline\":{html:\"<i class='ns-icon ns-editor-underline' aria-hidden='true'></i>\",tooltip:\"Underline\",tags: [\"u\"],css: {textDecoration: \"underline\"},shortKey: [\"ctrl+u\"],command:\"underline\",showAsMenu: true},\r\n\t\t\t\t \"strikeThrough\":{html:\"<i class='ns-icon ns-editor-strikethrough' aria-hidden='true'></i>\",tooltip:\"Strikethrough\",tags: [\"s\", \"strike\"],css: {textDecoration: \"line-through\"},shortKey: [\"ctrl+shift+s\"],command:\"strikeThrough\",showAsMenu: true},\r\n\t\t\t\t \"justifyCenter\":{html:\"<i class='ns-icon ns-editor-align-center' aria-hidden='true'></i>\",tooltip:\"Justify Center\",css: {textAlign: \"center\"},command:\"justifyCenter\"},\r\n\t\t\t\t \"justifyLeft\":{html:\"<i class='ns-icon ns-editor-align-left' aria-hidden='true'></i>\",tooltip:\"Justify Left\",css: {textAlign: \"left\"},command:\"justifyLeft\"},\r\n\t\t\t\t \"justifyRight\":{html:\"<i class='ns-icon ns-editor-align-right' aria-hidden='true'></i>\",tooltip:\"Justify Right\",css: {textAlign: \"right\"},command:\"justifyRight\"},\r\n\t\t\t\t \"justifyFull\":{html:\"<i class='ns-icon ns-editor-align-justify' aria-hidden='true'></i>\",tooltip:\"Justify Full\",tags: [\"s\", \"strike\"],css: {textAlign: \"justify\"},command:\"justifyFull\"},\r\n\t\t\t\t \"subscript\":{html:\"<i class='ns-icon ns-editor-subscript' aria-hidden='true'></i>\",tooltip:\"Subscript\",tags: [\"sub\"],command:\"subscript\",showAsMenu: true},\r\n\t\t\t\t \"superscript\":{html:\"<i class='ns-icon ns-editor-superscript' aria-hidden='true'></i>\",tooltip:\"Superscript\",tags: [\"sup\"],command:\"superscript\",showAsMenu: true},\r\n\t\t\t\t \r\n\t\t\t\t \"paragraph\":{html:\"<p>Normal</p>\",tooltip:\"Paragraph\",command: \"FormatBlock\",\r\n\t\t\t\t\t\t \t\t \"arguments\": (this.__browserDetail.isMSIE || this.__browserDetail.isSafari) ? \"<p>\" : \"p\",tags:[\"p\"]},\r\n\t\t\t\t \"header1\":{html:\"<h1>Heading 1</h1>\",tooltip:\"Header 1\",\r\n\t\t\t\t\t \t\t\t\t command: \"FormatBlock\",\r\n\t\t\t\t\t\t\t \t\t \"arguments\": \"<h1>\",tags: [\"h1\"]},\r\n\t\t\t \t \"header2\":{html:\"<h2>Heading 2</h2>\",tooltip:\"Header 2\",\r\n\t\t\t \t\t \t\t command: \"FormatBlock\",\r\n\t\t \t\t\t\t \t \"arguments\": \"<h2>\",tags: [\"h2\"]},\r\n\t\t\t\t \"header3\":{html:\"<h3>Heading 3</h3>\",tooltip:\"Header 3\",\r\n\t\t\t\t\t \t\t command: \"FormatBlock\",\r\n\t\t\t\t\t\t\t \"arguments\": \"<h3>\",tags: [\"h3\"]},\r\n\t\t\t\t \"header4\":{html:\"<h4>Heading 4</h4>\",tooltip:\"Header 4\",\r\n\t\t\t\t\t \t\t command: \"FormatBlock\",\r\n\t\t\t \t\t \t\t \"arguments\": \"<h4>\",tags: [\"h4\"]},\r\n\t\t\t\t \"orderedList\":{html:\"<i class='ns-icon ns-editor-ordered-list' aria-hidden='true'></i>\",tooltip:\"Ordered List\",command:\"insertorderedlist\",afterCommand:this.__orderedListHandler.bind(this),showAsMenu: true},\r\n\t\t\t\t \"unorderedList\":{html:\"<i class='ns-icon ns-editor-unordered-list' aria-hidden='true'></i>\",tooltip:\"Unordered List\",command:\"insertunorderedlist\",afterCommand:this.__orderedListHandler.bind(this),showAsMenu: true},\r\n\t\t\t\t \"undo\":{html:\"<i class='ns-icon ns-editor-undo' aria-hidden='true'></i>\",tooltip:\"Undo\",shortKey:[\"ctrl+z\"],command:\"undo\",showAsMenu: true},\r\n\t\t\t\t \"redo\":{html:\"<i class='ns-icon ns-editor-redo' aria-hidden='true'></i>\",tooltip:\"Redo\",shortKey:[\"ctrl+y\"],command:\"redo\",showAsMenu: true},\r\n\t\t\t\t \"outdent\":{html:\"<i class='ns-icon ns-editor-decrease-indent' aria-hidden='true'></i>\",tooltip:\"Decrease Indent\",command:\"outdent\",showAsMenu: true},\r\n\t\t\t\t \"indent\":{html:\"<i class='ns-icon ns-editor-increase-indent' aria-hidden='true'></i>\",tooltip:\"Increase Indent\",command:\"indent\",showAsMenu: true},\r\n\t\t\t\t \"viewSourceCode\":{html:\"<i class='ns-icon ns-editor-source' aria-hidden='true'></i>\",tooltip:\"View Source Code\",click: this.__viewSourceCodeHandler.bind(this),showAsMenu: true},\r\n\t\t\t\t \"clear\":{html:\"<i class='ns-icon ns-editor-new-doc' aria-hidden='true'></i>\",tooltip:\"Empty Document\",click: this.__emptyDocHandler.bind(this),showAsMenu: true},\r\n\t\t\t\t \"print\":{html:\"<i class='ns-icon ns-editor-print' aria-hidden='true'></i>\",tooltip:\"Print\",click: this.__printHandler.bind(this),showAsMenu: true},\r\n\t\t\t\t \"preview\":{html:\"<i class='ns-icon ns-editor-preview' aria-hidden='true'></i>\",tooltip:\"Preview\",click: this.__previewHandler.bind(this),showAsMenu: true},\r\n\t\t\t\t \"pageBreakForPrinting\":{html:\"<i class='ns-icon ns-editor-bookmark' aria-hidden='true'></i>\",tooltip:\"Insert Page Break for Printing\",click: this.__pageBreakForPrintingHandler.bind(this),showAsMenu: true},\r\n\t\t\t\t \"horizontalRule\":{html:\"<i class='ns-icon ns-editor-minus' aria-hidden='true'></i>\",tooltip:\"Insert Horizontal Line\",command:\"insertHorizontalRule\",tags:[\"hr\"],showAsMenu: true},\r\n\t\t\t\t \"fontFamily\":{html:\"<i class='ns-icon ns-editor-font' aria-hidden='true'></i>\",tooltip:\"Font Family\",showAsMenu: true,\r\n\t\t\t \t\t\tisDropdown:true,\r\n\t\t\t \t\t\tdataSource:[{value:\"Arial\",html:\"<span style=\\\"font-family: Arial\\\">Arial</span>\",tooltip:\"Arial\",command:\"fontName\",\"arguments\":\"Arial\"},\r\n\t\t\t \t\t\t {value:\"Arial Black\",html:\"<span style=\\\"font-family: Arial Black\\\">Arial Black</span>\",tooltip:\"Arial Black\",command:\"fontName\",\"arguments\":\"Arial Black\"},\r\n\t\t\t \t\t\t {value:\"Courier\",html:\"<span style=\\\"font-family: Courier\\\">Courier</span>\",tooltip:\"Courier\",command:\"fontName\",\"arguments\":\"Courier\"},\r\n\t\t\t \t\t\t {value:\"Courier New\",html:\"<span style=\\\"font-family: Courier New\\\">Courier New</span>\",tooltip:\"Courier New\",command:\"fontName\",\"arguments\":\"Courier New\"},\r\n\t\t\t \t\t\t {value:\"Comic Sans MS\",html:\"<span style=\\\"font-family: Comic Sans MS\\\">Comic Sans MS</span>\",tooltip:\"Comic Sans MS\",command:\"fontName\",\"arguments\":\"Comic Sans MS\"},\r\n\t\t\t \t\t\t {value:\"Courier\",html:\"<span style=\\\"font-family: Courier\\\">Courier</span>\",tooltip:\"Courier\",command:\"fontName\",\"arguments\":\"Courier\"},\r\n\t\t\t \t\t\t {value:\"Georgia\",html:\"<span style=\\\"font-family: Georgia\\\">Georgia</span>\",tooltip:\"Georgia\",command:\"fontName\",\"arguments\":\"Georgia\"},\r\n\t\t\t \t\t\t {value:\"Impact\",html:\"<span style=\\\"font-family: Impact\\\">Impact</span>\",tooltip:\"Impact\",command:\"fontName\",\"arguments\":\"Impact\"},\r\n\t\t\t \t\t\t {value:\"Lucida Grande\",html:\"<span style=\\\"font-family: Lucida Grande\\\">Lucida Grande</span>\",tooltip:\"Lucida Grande\",command:\"fontName\",\"arguments\":\"Lucida Grande\"},\r\n\t\t\t \t\t\t {value:\"Lucida Sans\",html:\"<span style=\\\"font-family: Lucida Sans\\\">Lucida Sans</span>\",tooltip:\"Lucida Sans\",command:\"fontName\",\"arguments\":\"Lucida Sans\"},\r\n\t\t\t \t\t\t {value:\"Serif\",html:\"<span style=\\\"font-family: Serif\\\">Serif</span>\",tooltip:\"Serif\",command:\"fontName\",\"arguments\":\"Serif\"},\r\n\t\t\t \t\t\t {value:\"Sans\",html:\"<span style=\\\"font-family: Sans\\\">Sans</span>\",tooltip:\"Sans\",command:\"fontName\",\"arguments\":\"Sans\"},\r\n\t\t\t \t\t\t {value:\"Tahoma\",html:\"<span style=\\\"font-family: Tahoma\\\">Tahoma</span>\",tooltip:\"Tahoma\",command:\"fontName\",\"arguments\":\"Tahoma\"},\r\n\t\t\t \t\t\t {value:\"Times\",html:\"<span style=\\\"font-family: Times\\\">Times</span>\",tooltip:\"Times\",command:\"fontName\",\"arguments\":\"Times\"},\r\n\t\t\t \t\t\t {value:\"Times New Roman\",html:\"<span style=\\\"font-family: Times New Roman\\\">Times New Roman</span>\",tooltip:\"Times New Roman\",command:\"fontName\",\"arguments\":\"Times New Roman\"},\r\n\t\t\t \t\t\t {value:\"Verdana\",html:\"<span style=\\\"font-family: Verdana\\\">Verdana</span>\",tooltip:\"Verdana\",command:\"fontName\",\"arguments\":\"Verdana\"}]},\r\n\t\t\t\t \"fontSize\":{html:\"<i class='ns-icon ns-editor-font-size' aria-hidden='true'></i>\",tooltip:\"Font Size\",showAsMenu: true,\r\n\t\t\t\t\t \t\t isDropdown:true,dataSource:[]},\r\n\t\t\t\t \"paragraphFormat\":{html:\"<i class='ns-icon ns-editor-paragraph' aria-hidden='true'></i>\",tooltip:\"Paragraph Format\",showAsMenu: true,\r\n\t\t\t\t\t \t\t\tisDropdown:true,\r\n\t\t\t\t\t \t\t\tdataSource:[{value:\"paragraph\",htmlKey:\"paragraph\"},\r\n\t\t\t\t\t \t\t\t {value:\"header1\",htmlKey:\"header1\"},\r\n\t\t\t\t\t \t\t\t {value:\"header2\",htmlKey:\"header2\"},\r\n\t\t\t\t\t \t\t\t {value:\"header3\",htmlKey:\"header3\"},\r\n\t\t\t\t\t \t\t\t {value:\"header4\",htmlKey:\"header4\"}]},\r\n \t\t\t \"align\":{html:\"<i class='ns-icon ns-editor-align-left' aria-hidden='true'></i>\",tooltip:\"Align\",showAsMenu: true,\r\n\t \t\t\t \t \t\tisDropdown:true,\r\n\t \t\t\t \t \t\tdataSource:[{value:\"justifyCenter\",htmlKey:\"justifyCenter\"},\r\n\t \t\t\t \t \t\t {value:\"justifyLeft\",htmlKey:\"justifyLeft\"},\r\n\t \t\t\t \t \t\t {value:\"justifyRight\",htmlKey:\"justifyRight\"},\r\n\t \t\t\t \t \t\t {value:\"justifyFull\",htmlKey:\"justifyFull\"}]},\r\n\t \t\t \"color\":{html:\"<i class='ns-icon ns-editor-font-color' aria-hidden='true'></i>\",tooltip:\"Font Color\",showAsMenu: true,\r\n\t \t\t\t\t\t\t isDropdown:true,dataSource:[]},\r\n\t \t\t\t \"backgroundColor\":{html:\"<i class='ns-icon ns-editor-background-color' aria-hidden='true'></i>\",tooltip:\"Background Color\",showAsMenu: true,\r\n\t\t \t\t\t\t\t isDropdown:true,dataSource:[]},\r\n\t\t\t\t };\r\n\t\t//the browser doesnot allow font size > 7\r\n\t\tvar arrFontSize = [{label:\"xx-large\",style:\"xx-large\",value:7},\r\n\t\t {label:\"x-large\",style:\"x-large\",value:6},\r\n\t\t {label:\"large\",style:\"large\",value:5},\r\n\t\t {label:\"medium\",style:\"medium\",value:4},\r\n\t\t {label:\"small\",style:\"small\",value:3},\r\n\t\t {label:\"x-small\",style:\"x-small\",value:2},\r\n\t\t {label:\"xx-small\",style:\"xx-small\",value:1}];\r\n\t\tvar fontDataSource = [];\r\n\t\tfor(var count = 0;count < arrFontSize.length;count++)\r\n\t\t{\r\n\t\t\tvar item = arrFontSize[count];\r\n\t\t\tfontDataSource.push({value:item.label,html:\"<span style=\\\"font-size: \" + item.style + \"\\\">\" + item.label + \"</span>\",command:\"fontsize\",\"arguments\":item.value});\r\n\t\t}\r\n\t\tthis.__toolBarButton[\"fontSize\"].dataSource = fontDataSource;\r\n\t\tvar arrForeColor = [{label:\"#000000\",style:\"#000000\",value:\"#000000\"},\r\n\t\t {label:\"#0000FF\",style:\"#0000FF\",value:\"#0000FF\"},\r\n\t\t\t\t\t\t\t{label:\"#30AD23\",style:\"#30AD23\",value:\"#30AD23\"},\r\n\t\t\t\t\t\t\t{label:\"#FF7F00\",style:\"#FF7F00\",value:\"#FF7F00\"},\r\n\t\t\t\t\t\t\t{label:\"#FF0000\",style:\"#FF0000\",value:\"#FF0000\"},\r\n\t\t\t\t\t\t\t{label:\"#FFFF00\",style:\"#FFFF00\",value:\"#FFFF00\"},\r\n\t\t\t\t\t\t\t{label:\"#FFFFFF\",style:\"#FFFFFF\",value:\"#FFFFFF\"}];\r\n\t\tvar foreColorDataSource = [];\r\n\t\tfor(var count = 0;count < arrForeColor.length;count++)\r\n\t\t{\r\n\t\t\tvar item = arrForeColor[count];\r\n\t\t\tforeColorDataSource.push({value:item.label,html:\"<span style=\\\"color: \" + item.style + \"\\\">\" + item.label + \"</span>\",command:\"forecolor\",\"arguments\":item.value});\r\n\t\t}\r\n\t\tthis.__toolBarButton[\"color\"].dataSource = foreColorDataSource;\r\n\t\tvar arrBackColor = [{label:\"#000000\",style:\"#000000\",value:\"#000000\"},\r\n\t\t {label:\"#0000FF\",style:\"#0000FF\",value:\"#0000FF\"},\r\n\t\t\t\t\t\t\t{label:\"#30AD23\",style:\"#30AD23\",value:\"#30AD23\"},\r\n\t\t\t\t\t\t\t{label:\"#FF7F00\",style:\"#FF7F00\",value:\"#FF7F00\"},\r\n\t\t\t\t\t\t\t{label:\"#FF0000\",style:\"#FF0000\",value:\"#FF0000\"},\r\n\t\t\t\t\t\t\t{label:\"#FFFF00\",style:\"#FFFF00\",value:\"#FFFF00\"},\r\n\t\t\t\t\t\t\t{label:\"#FFFFFF\",style:\"#FFFFFF\",value:\"#FFFFFF\"}];\r\n\t\tvar backColorDataSource = [];\r\n\t\tfor(var count = 0;count < arrBackColor.length;count++)\r\n\t\t{\r\n\t\t\tvar item = arrBackColor[count];\r\n\t\t\tbackColorDataSource.push({value:item.label,html:\"<span style=\\\"color: \" + item.style + \"\\\">\" + item.label + \"</span>\",command:\"backcolor\",\"arguments\":item.value});\r\n\t\t}\r\n\t\tthis.__toolBarButton[\"backgroundColor\"].dataSource = backColorDataSource;\r\n\t\tthis.__initializeModules();\r\n\t\tthis.__initializePlugins();\r\n\t\tthis.__setSetting();\r\n\t\tthis.__initDefault();\r\n\t\tthis.__initializeTools();\r\n\t\tthis.__callInitializeInPluggin();\r\n\t\tthis.__createComponent();\r\n\t\tthis.attachResizeListener();\r\n\t};\r\n\t\r\n\tNSEditor.prototype.setComponentProperties = function() \r\n\t{\r\n\t\tthis.base.setComponentProperties.call(this);\r\n\t};\r\n\t\r\n\tNSEditor.prototype.propertyChange = function(attrName, oldVal, newVal, setProperty)\r\n\t{\r\n\t\tvar attributeName = attrName.toLowerCase();\r\n\t\tthis.base.propertyChange.call(this,attrName, oldVal, newVal, setProperty);\r\n\t};\r\n\t\r\n\tNSEditor.prototype.removeComponent = function() \r\n\t{\r\n\t\tthis.base.removeComponent.call(this);\r\n\t\tthis.util.removeStyleClass(this.__dom.doc.body,\"nsEditorPresent\");\r\n\t\tthis.__callDestroyInPluggin();\r\n\t\tclearTimeout(this.__resizeInterval);\r\n\t\tvar listenerComponent = this.__getListenerComponent();\r\n\t\tif(this.__textAreaScrollRef)\r\n\t\t{\r\n\t\t\tvar element = this.__getScrollableComponent();\r\n\t\t\tthis.util.removeEvent(element,\"scroll\",this.__textAreaScrollRef);\r\n\t\t\tthis.__textAreaScrollRef = null;\r\n\t\t}\r\n\t\tif(this.__textAreaResizeRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(listenerComponent,\"resize\",this.__textAreaResizeRef);\r\n\t\t\tthis.__textAreaResizeRef = null;\r\n\t\t}\r\n\t\tif(this.__textAreaKeyUpRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(listenerComponent,\"keyup\",this.__textAreaKeyUpRef);\r\n\t\t\tthis.__textAreaKeyUpRef = null;\r\n\t\t}\r\n\t\tif(this.__textAreaKeyDownRef)\r\n\t\t{\r\n\t\t\tthis.util.removeEvent(listenerComponent,\"keydown\",this.__textAreaKeyDownRef);\r\n\t\t\tthis.__textAreaKeyDownRef = null;\r\n\t\t}\r\n\t\tthis.__toolBar.destroy();\r\n\t\tif(this.__orignalTextAreaObserver)\r\n\t\t{\r\n\t\t\tthis.__orignalTextAreaObserver.disconnect();\r\n\t\t\tthis.__orignalTextAreaObserver = null;\r\n\t\t}\r\n\t\tif(this.__textAreaObserver)\r\n\t\t{\r\n\t\t\tthis.__textAreaObserver.disconnect();\r\n\t\t\tthis.__textAreaObserver = null;\r\n\t\t}\r\n\t\tif(this.__divOuterContainer)\r\n\t\t{\r\n\t\t\tif(this.__divOuterContainer.parentNode)\r\n\t\t\t{\r\n\t\t\t\tthis.__divOuterContainer.parentNode.removeChild(this.__divOuterContainer);\r\n\t\t\t}\r\n\t\t\tthis.__divOuterContainer = null;\r\n\t\t}\r\n\t\tif(this.__orignalTextArea)\r\n\t\t{\r\n\t\t\tthis.util.removeStyleClass(this.__orignalTextArea,\"nsEditorTextAreaHidden\");\r\n\t\t}\r\n\t\tif(this.__iframePrint)\r\n\t\t{\r\n\t\t\tif(this.__iframePrint.parentNode)\r\n\t\t\t{\r\n\t\t\t\tthis.__iframePrint.parentNode.removeChild(this.__iframePrint);\r\n\t\t\t}\r\n\t\t\tthis.__iframePrint = null;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSEditor.prototype.componentResized = function(event) \r\n\t{\r\n\t\tvar baseMeasurement = this.__baseComponent.getBoundingClientRect();\r\n\t\tif(!this.__lastBaseMeasurement || this.__lastBaseMeasurement.height !== baseMeasurement.height || this.__lastBaseMeasurement.width !== baseMeasurement.width)\r\n\t\t{\r\n\t\t\tevent = this.util.getEvent(event);\r\n\t\t\tclearTimeout(this.__resizeInterval);\r\n\t\t\tvar self = this;\r\n\t\t\tthis.__resizeInterval = setTimeout(function(){\r\n\t\t\t\tself.__dispatchInternalEvent(\"resize\",{orignalEvent:event},{orignalEvent:event});\r\n\t\t\t\tself.__callResizedInPluggin([event]);\r\n\t\t\t\tself.base.componentResized.call(self,event);\r\n\t\t\t}, 250);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSEditor.prototype.registerPlugin = function(name,pluggin) \r\n\t{\r\n\t\tif(name && pluggin)\r\n\t\t{\r\n\t\t\tif(!NSEditor.__plugins)\r\n\t\t\t{\r\n\t\t\t\tNSEditor.__plugins = {};\r\n\t\t\t}\r\n\t\t\tif(!NSEditor.__plugins[name])\r\n\t\t\t{\r\n\t\t\t\tNSEditor.__plugins[name] = pluggin;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSEditor.prototype.registerUtil = function(name,util) \r\n\t{\r\n\t\tif(name && util)\r\n\t\t{\r\n\t\t\tif(!NSEditor.__util)\r\n\t\t\t{\r\n\t\t\t\tNSEditor.__util = {};\r\n\t\t\t}\r\n\t\t\tif(!NSEditor.__util[name])\r\n\t\t\t{\r\n\t\t\t\tNSEditor.__util[name] = util;\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\t//if setting[\"enableLineNumber\"] is true then the components for line Number is created and then \r\n\t// with toggleLineNumber function the Line Number visibility can be toggled\r\n\tNSEditor.prototype.toggleLineNumber = function() \r\n\t{\r\n\t\tthis.__config[\"enableLineNumber\"] = !this.__config[\"enableLineNumber\"];\r\n\t\tthis.__setLineNumberVisibility(this.__config[\"enableLineNumber\"]);\r\n\t};\r\n\t\r\n\tNSEditor.prototype.setDisabled = function(isDisabled) \r\n\t{\r\n\t\tthis.__isDisabled = isDisabled;\r\n\t};\r\n\t\r\n\tNSEditor.prototype.getDisabled = function() \r\n\t{\r\n\t\treturn this.__isDisabled;\r\n\t};\r\n\t\r\n\tNSEditor.prototype.getText = function() \r\n\t{\r\n\t\tvar text = this.__getTextFromTextArea();\r\n\t\treturn (text ? text.replace(/(\\r\\n|\\n|\\r)/gm, \"\") : \"\");\r\n\t};\r\n\t\r\n\tNSEditor.prototype.setText = function(text) \r\n\t{\r\n\t\tthis.__setTextIntoTextArea(text);\r\n\t};\r\n\t\r\n\tNSEditor.prototype.getHtml = function() \r\n\t{\r\n\t\treturn this.__getHtmlFromTextArea();\r\n\t};\r\n\t\r\n\tNSEditor.prototype.setHtml = function(html) \r\n\t{\r\n\t\tthis.__setHtmlIntoTextArea(html);\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__initDefault = function()\r\n\t{\r\n\t\t//item in autoSuggestTriggers will be {keyCode: 32, ctrlKey: true,shiftKey: false, preventDefault: true}\r\n\t\tif(!this.__config[\"autoSuggestTriggers\"])\r\n\t\t{\r\n\t\t\tthis.__config[\"autoSuggestTriggers\"] = [];\r\n\t\t}\r\n\t\tif(!this.__config[\"mode\"])\r\n\t\t{\r\n\t\t\tthis.__config[\"mode\"] = NSEditor.MODE_TEXTAREA;\r\n\t\t}\r\n\t\tthis.__setDefaultContent();\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__setDefaultContent = function()\r\n\t{\r\n\t\tthis.__defaultContent = this.__getDefaultContent();\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__getDefaultContent = function(asHtml)\r\n\t{\r\n\t\tasHtml = this.util.isUndefinedOrNull(asHtml) ? true : Boolean.parse(asHtml);\r\n\t\tvar defaultElement = this.util.createElement(this.__config[\"enterElement\"],null,\"nsEditorLineElement\");\r\n\t\tif(defaultElement)\r\n\t\t{\r\n\t\t\tdefaultElement.innerHTML = \"<br>\"; \r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t\t\tthis.util.throwNSError(\"NSEditor\",\"Enter a valid enterElement property\");\r\n\t\t}\r\n\t\treturn asHtml ? (defaultElement ? defaultElement.outerHTML : null) : defaultElement;\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__setSetting = function()\r\n\t{\r\n\t\tif(!this.__setting)\r\n\t\t{\r\n\t\t\tthis.__setting = {};\r\n\t\t}\r\n\t\tif(!this.__config)\r\n\t\t{\r\n\t\t\tthis.__config = {};\r\n\t\t}\r\n\t\tvar setting = this.__setting;\r\n\t\tif(setting)\r\n\t\t{\r\n\t\t\tif(setting.hasOwnProperty(\"context\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__context = setting[\"context\"];\r\n\t\t\t}\r\n\t\t\tthis.__config = {\r\n\t\t\t\t\tenableToolBar: this.util.isUndefinedOrNull(this.__setting[\"enableToolBar\"]) ? true : Boolean.parse(this.__setting[\"enableToolBar\"]),\r\n\t\t\t\t\ttoolBarButton: this.__setting[\"toolBarButton\"],\r\n\t\t\t\t\tenableReadOnly: Boolean.parse(this.__setting[\"enableReadOnly\"]),\r\n\t\t\t\t\twidth: this.__setting[\"width\"] || \"auto\",\r\n\t\t\t\t height: this.__setting[\"height\"] || \"auto\",\r\n\t\t\t\t minWidth: this.__setting[\"minWidth\"] || 200,\r\n\t\t\t\t\tminHeight: this.__setting[\"minHeight\"] || 200,\r\n\t\t\t\t\tmaxWidth: this.__setting[\"maxWidth\"] || \"100%\",\r\n\t\t\t\t\tmaxHeight: this.__setting[\"maxHeight\"] || \"100%\",\r\n\t\t\t\t theme: this.__setting[\"theme\"] || \"White\",\r\n\t\t\t\t //if this property is true then if bold is selected then in dom we use <b> or <strong> tag etc\r\n\t\t\t\t //else we use style to do the same\r\n\t\t\t\t enableTagsForProps: Boolean.parse(this.__setting[\"enableTagsForProps\"]),\r\n\t\t\t\t\tenableSpellCheck: this.util.isUndefinedOrNull(this.__setting[\"enableSpellCheck\"]) ? true : Boolean.parse(this.__setting[\"enableSpellCheck\"]),\r\n\t\t\t\t\tenableTabBar: Boolean.parse(this.__setting[\"enableTabBar\"]),\r\n\t\t\t\t\tenableLineNumber: Boolean.parse(this.__setting[\"enableLineNumber\"]),\r\n\t\t\t\t\tenableToolBarActive: Boolean.parse(this.__setting[\"enableToolBarActive\"]),\r\n\t\t\t\t\tenableAutoSuggest: Boolean.parse(this.__setting[\"enableAutoSuggest\"]),\r\n\t\t\t\t\tautoSuggestTriggers: this.__setting[\"autoSuggestTriggers\"],\r\n\t\t\t\t\tmode: this.__setting[\"mode\"],\r\n\t\t\t\t\tplaceholder: this.__setting[\"placeholder\"],\r\n\t\t\t\t\tenterElement: this.__setting[\"enterElement\"] || \"p\",// should ideally be <p> or <div> as others can create problems\r\n\t\t\t\t\tmaxCharCount: this.util.isUndefinedOrNull(this.__setting[\"maxCharCount\"]) ? null : parseInt(this.__setting[\"maxCharCount\"]),\r\n\t\t\t\t\tcharCounterType: this.__setting[\"charCounterType\"] || \"char\", //char, byte, byte-html\r\n\t\t\t\t\tenableStickyToolbar: this.util.isUndefinedOrNull(this.__setting[\"enableStickyToolbar\"]) ? true : Boolean.parse(this.__setting[\"enableStickyToolbar\"]),\r\n\t\t\t\t\tenableStickyToolbarForMobile: this.util.isUndefinedOrNull(this.__setting[\"enableStickyToolbarForMobile\"]) ? true : Boolean.parse(this.__setting[\"enableStickyToolbarForMobile\"]),\r\n\t\t\t\t\tpromptBoxCallback: this.__setting[\"promptBoxCallback\"] ? this.util.getFunction(this.__setting[\"promptBoxCallback\"]) : null,\r\n\t\t\t};\r\n\t\t}\r\n\t\tthis.__callSetSettingsInPluggin();\r\n\t\tif(this.__config.enableToolBar && (!this.__config.toolBarButton || this.__config.toolBarButton.length == 0))\r\n\t\t{\r\n\t\t\tthis.__config.toolBarButton = [];\r\n\t\t\tfor(var key in this.__toolBarButton)\r\n\t\t\t{\r\n\t\t\t\tif(this.__toolBarButton[key].showAsMenu)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.__config.toolBarButton.push(key);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__init = function()\r\n\t{\r\n\t\tthis.__divOuterContainer = document.createElement(\"div\");\r\n\t\tthis.__divOuterContainer.setAttribute(\"class\",\"nsEditor nsEditorOuterContainer\");\r\n\t\tif(this.__orignalTextArea && this.__orignalTextArea.parentNode)\r\n\t\t{\r\n\t\t\tif(this.__orignalTextArea.nextSibling)\r\n\t\t\t{\r\n\t\t\t\tthis.__orignalTextArea.parentNode.insertBefore(this.__divOuterContainer, this.__orignalTextArea.nextSibling);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.__orignalTextArea.parentNode.appendChild(this.__divOuterContainer);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tdocument.body.appendChild(this.__divOuterContainer);\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__initializeTools = function()\r\n\t{\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__createComponent = function()\r\n\t{\r\n\t\tthis.util.addStyleClass(this.__dom.doc.body,\"nsEditorPresent\");\r\n\t\tthis.__createFixedComp();\r\n\t\tthis.__toolBar.createToolBar();\r\n\t\tthis.__createTabBar();\r\n\t\tthis.__createBody();\r\n\t\tthis.__createFooter();\r\n\t\tthis.__createPlaceHolder();\r\n\t\tif(this.__isModeTextArea())\r\n\t\t{\r\n\t\t\tthis.__initTextArea();\r\n\t\t}\r\n\t\t/*if(this.__isModeTextArea())\r\n\t\t{\r\n\t\t\tthis.__callTextAreaFunc();\r\n\t\t}*/\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__renderComplete = function()\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar callback = function()\r\n\t\t{\r\n\t\t\tif(self.__hasRendered)\r\n\t\t\t{\r\n\t\t\t\tif(self.__renderedInterval)\r\n\t\t\t\t{\r\n\t\t\t\t\tclearInterval(self.__renderedInterval);\r\n\t\t\t\t\tself.__renderedInterval = null;\r\n\t\t\t\t}\r\n\t\t\t\tif(self.__queueFunc && self.__queueFunc.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tfor(var count = self.__queueFunc.length - 1;count > -1;count--)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tself.__queueFunc[count]();\r\n\t\t\t\t\t\tself.__queueFunc.splice(count, 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t\tthis.__renderedInterval = setInterval(callback, 300);\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__callTextAreaFunc = function()\r\n\t{\r\n\t\tthis.__callComponentsInitializedInPluggin();\r\n\t\tthis.__setStyles();\r\n\t\tthis.__renderComplete();\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__resizeCallback = function(forciblyCalc,delayPeriod)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar callback = function()\r\n\t\t{\r\n\t\t\tself.__setBodyStyle(forciblyCalc);\r\n\t\t\tself.__resizeIframe();\r\n\t\t\tself.__drawLineNumbers(1);\r\n\t\t};\r\n\t\tif(!delayPeriod)\r\n\t\t{\r\n\t\t\tdelayPeriod = 0;\r\n\t\t}\r\n\t\tsetTimeout(callback,delayPeriod);\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__setStyles = function(delayPeriod)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar callback = function()\r\n\t\t{\r\n\t\t\tvar css = {};\r\n\t\t\tcss.minWidth = self.__config.minWidth;\r\n\t\t\tcss.minHeight = self.__config.minHeight;\r\n\t\t\tvar maxWidth = self.__config.maxWidth;\r\n\t\t\tcss.maxWidth = maxWidth;\r\n\t\t\tself.util.css(self.__divOuterContainer,css);\r\n\t\t\tself.__width(self.__config.width);\r\n\t\t\tself.__height(self.__config.height);\r\n\t\t\t\r\n\t\t\t//delay while rendering as the toolBox is taking time to get its height\r\n\t\t\tself.__setBodyStyle(false,false);\r\n\t\t};\r\n\t\tif(!delayPeriod)\r\n\t\t{\r\n\t\t\tdelayPeriod = 0;\r\n\t\t}\r\n\t\tsetTimeout(callback,delayPeriod);\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__setBodyStyle = function(forciblyCalc,isDelay)\r\n\t{\r\n\t\tvar self = this;\r\n\t\tvar callback = function()\r\n\t\t{\r\n\t\t\tvar setHeight = function(value)\r\n\t\t\t{\r\n\t\t\t\tvar arrCon = [self.__divLineNumberContainer,self.__divTextAreaContainer,self.__compTextArea];//self.__getIFrameBody()\r\n\t\t\t\tfor(var count = 0;count < arrCon.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar con = arrCon[count];\r\n\t\t\t\t\tif(con)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tself.util.css(con,\"height\",value);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\tforciblyCalc = Boolean.parse(forciblyCalc);\r\n\t\t\tvar height = \"auto\";\r\n\t\t\tif(self.__config.height == \"auto\" && !forciblyCalc)\r\n\t\t\t{\r\n\t\t\t\tsetHeight(\"auto\");\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tvar totalHeight = self.__divOuterContainer.offsetHeight;\r\n\t\t\t\tvar nonEditorHeight = self.__getNonEditorHeight();\r\n\t\t\t\theight = totalHeight - nonEditorHeight;\r\n\t\t\t\tif(forciblyCalc)\r\n\t\t\t\t{\r\n\t\t\t\t\tsetHeight(\"\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tself.__heightBody(height);\r\n\t\t\tself.__setBodyMinHeight();\r\n\t\t};\r\n\t\tif(isDelay)\r\n\t\t{\r\n\t\t\tsetTimeout(callback,100);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tcallback();\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__setBodyMinHeight = function()\r\n\t{\r\n\t\tvar nonEditorHeight = this.__getNonEditorHeight();\r\n\t\tvar minHeight = this.__config.minHeight - nonEditorHeight;\r\n\t\tthis.util.css(this.__divBodyContainer,\"minHeight\",minHeight);\r\n\t\tvar arrCon = [this.__divLineNumberContainer,this.__divTextAreaContainer,this.__compTextArea,this.__getIFrameBody()];//\r\n\t\tfor(var count = 0;count < arrCon.length;count++)\r\n\t\t{\r\n\t\t\tvar con = arrCon[count];\r\n\t\t\tif(con)\r\n\t\t\t{\r\n\t\t\t\tthis.util.css(con,\"minHeight\",minHeight - 2);\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.__hasRendered = true;\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__getNonEditorHeight = function()\r\n\t{\r\n\t\tvar totalHeight = 0;\r\n\t\tif(this.__toolBar.__divToolBarContainer)\r\n\t\t{\r\n\t\t\ttotalHeight += this.__toolBar.__divToolBarContainer.offsetHeight;\r\n\t\t}\r\n\t\tif(this.__divTabContainer)\r\n\t\t{\r\n\t\t\ttotalHeight += this.__divTabContainer.offsetHeight;\r\n\t\t}\r\n\t\tif(this.__divFooterContainer)\r\n\t\t{\r\n\t\t\ttotalHeight += this.__divFooterContainer.offsetHeight;\r\n\t\t}\r\n\t\treturn totalHeight;\r\n\t};\r\n\t\r\n\t\r\n\t\r\n\tNSEditor.prototype.__createTabBar = function()\r\n\t{\r\n\t\tthis.__divTabContainer = this.util.createDiv(this.getID() + \"tabcontainer\",\"nsEditorTabContainer\");\r\n\t\tthis.__divOuterContainer.appendChild(this.__divTabContainer);\r\n\t\tif(this.__config[\"enableTabBar\"])\r\n\t\t{\r\n\t\t\t//this.__createToolBarComponents();\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.__handleVisibilityOfComponent(this.__divTabContainer,\"enableTabBar\");\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__createBody = function()\r\n\t{\r\n\t\tthis.__divBodyContainer = this.util.createDiv(this.getID() + \"bodycontainer\",\"nsEditorBodyContainer\");\r\n\t\tthis.__divLineNumberContainer = this.util.createDiv(this.getID() + \"linenumbercontainer\",\"nsEditorLineNumberContainer\");\r\n\t\tthis.__divTextAreaContainer = this.util.createDiv(this.getID() + \"textareacontainer\",\"nsEditorTextAreaContainer\");\r\n\t\tthis.__divBodyContainer.appendChild(this.__divLineNumberContainer);\r\n\t\tthis.__divBodyContainer.appendChild(this.__divTextAreaContainer);\r\n\t\tthis.__divOuterContainer.appendChild(this.__divBodyContainer);\r\n\t\tthis.__compTextArea = this.__createTextArea();\r\n\t\tthis.__divTextAreaContainer.appendChild(this.__compTextArea);\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__createTextArea = function()\r\n\t{\r\n\t\tvar divTextArea = null;\r\n\t\tvar content = \"\";\r\n\t\tif(this.__isModeTextArea())\r\n\t\t{\r\n\t\t\t//do not add class here as it will get overriden from if orignalTextArea has class\r\n\t\t\tdivTextArea = this.util.createDiv(this.getID() + \"textArea\",null);\r\n\t\t\tif(!this.__config.enableReadOnly)\r\n\t\t\t{\r\n\t\t\t\tdivTextArea.setAttribute(\"contenteditable\",true);\r\n\t\t\t\tdivTextArea.setAttribute(\"spellcheck\",this.__config.enableSpellCheck);\r\n\t\t\t}\r\n\t\t\tif(this.__orignalTextArea)\r\n\t\t\t{\r\n\t\t\t\tif(this.__orignalTextArea.value.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tcontent = this.__orignalTextArea.value;\r\n\t\t\t\t}\r\n\t\t\t\tvar arrAttributes = [\"tabIndex\"];\r\n\t\t\t\tvar arrNewAttributes = [\"tabIndex\"];\r\n\t\t\t\tfor(var count = 0;count < arrAttributes.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.__orignalTextArea.getAttribute(arrAttributes[count]))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdivTextArea.setAttribute(arrNewAttributes[count],this.__orignalTextArea.getAttribute(arrAttributes[count]));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse if(this.__config.defaultValue && this.__config.defaultValue.length > 0)\r\n\t\t\t{\r\n\t\t\t\tdivTextArea.appendChild(this.__dom.doc.createTextNode(this.__config.defaultValue));\r\n\t\t\t}\r\n\t\t\tthis.util.addStyleClass(divTextArea,\"nsEditorTextArea\");\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tdivTextArea = this.util.createElement(\"iframe\",this.getID() + \"textArea\",\"nsEditorTextAreaIFrame\");\r\n\t\t\tif(this.__context.location.protocol === \"https:\")\r\n\t\t\t{\r\n\t\t\t\tdivTextArea.setAttribute(\"src\",\"about:blank\");\r\n\t\t\t}\r\n\t\t\tdivTextArea.setAttribute(\"frameborder\",\"0\");\r\n\t\t\tdivTextArea.setAttribute(\"allowtransparency\",\"true\");\r\n\t\t\tdivTextArea.setAttribute(\"tabindex\",\"-1\");\r\n\t\t\tif(this.__orignalTextArea)\r\n\t\t\t{\r\n\t\t\t\t/*if(this.__orignalTextArea.getAttribute(\"tabindex\"))\r\n\t\t\t\t{\r\n\t\t\t\t\tdivTextArea.setAttribute(\"tabindex\",this.__orignalTextArea.getAttribute(\"tabindex\"));\r\n\t\t\t\t}*/\r\n\t\t\t\tif(this.__orignalTextArea.value.length > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tcontent = this.__orignalTextArea.value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar styleHtml = \"html\\r\\n\" + \r\n\t\t\t\t\t\"\t\t{\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tmargin:0px;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\theight:auto;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t}\\r\\n\" + \r\n\t\t\t\t\t\"\t\t.nsEditorBody\\r\\n\" + \r\n\t\t\t\t\t\"\t\t{\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\theight:auto;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tbackground:transparent;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tcolor:#000000;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tposition:relative;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tz-index: 2;\\r\\n\" +\r\n\t\t\t\t\t\"\t\t\t-webkit-user-select:auto;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tmargin:0px;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tmin-height:50px;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tpadding: 5px;\\r\\n\" +\r\n\t\t\t\t\t\"\t\t\toverflow: auto;\\r\\n\" +\r\n\t\t\t\t\t\"\t\t}\\r\\n\" + \r\n\t\t\t\t\t\"\t\t.nsEditorBody:after\\r\\n\" + \r\n\t\t\t\t\t\"\t\t{\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tcontent:\\'\\';\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tdisplay:block;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tclear:both;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t}\\r\\n\" + \r\n\t\t\t\t\t\"\t\t.nsEditorBody::-moz-selection\\r\\n\" + \r\n\t\t\t\t\t\"\t\t{\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tbackground:#b5d6fd;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tcolor:#000;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t}\\r\\n\" + \r\n\t\t\t\t\t\"\t\t.nsEditorBody::selection\\r\\n\" + \r\n\t\t\t\t\t\"\t\t{\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tbackground:#b5d6fd;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tcolor:#000;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t}\\r\\n\" + \r\n\t\t\t\t\t\"\t\t.nsEditorBody.nsEditorBodyWithLineNumber\\r\\n\" + \r\n\t\t\t\t\t\"\t\t{\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tpadding: 0px;\\r\\n\" +\r\n\t\t\t\t\t\"\t\t\tpadding-top: 5px;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tpadding-right: 5px;\\r\\n\" + \t\t\t\r\n\t\t\t\t\t\"\t\t}\\r\\n\" + \r\n\t\t\t\t\t\"\t\t.nsEditorBody.nsEditorBodyWithLineNumber .nsEditorLineElement\\r\\n\" + \r\n\t\t\t\t\t\"\t\t{\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tmargin:0;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tfont-size: 12px;\\r\\n\" +\r\n\t\t\t\t\t\"\t\t\tline-height: 15px !important;\\r\\n\" +\r\n\t\t\t\t\t\"\t\t}\\r\\n\" + \r\n\t\t\t\t\t\"\t\t.nsEditorPageBreak\\r\\n\" + \r\n\t\t\t\t\t\"\t\t{\\r\\n\" + \r\n\t\t\t\t\t\"\t\t\tclear: both !important;\\r\\n\" + \r\n\t\t\t\t\t\" \t\twidth: 100% !important;\\r\\n\" + \r\n\t\t\t\t\t\" \t\tborder-top: #999 1px dotted !important;\\r\\n\" + \r\n\t\t\t\t\t\" \t\tborder-bottom: #999 1px dotted !important;\\r\\n\" + \r\n\t\t\t\t\t\" \t\tpadding: 0 !important;\\r\\n\" + \r\n\t\t\t\t\t\" \t\theight: 7px !important;\\r\\n\" + \r\n\t\t\t\t\t\" \t\tcursor: default !important;\\r\\n\" + \r\n\t\t\t\t\t\"\t\t}\";\r\n\t\t\tvar arrStyle = this.__callAddStyleIFrameInPluggin(style);\r\n\t\t\tif(arrStyle && arrStyle.length > 0)\r\n\t\t\t{\r\n\t\t\t\tfor(var count = 0;count < arrStyle.length;count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tstyleHtml += arrStyle[count].value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar arrStyle = this.__dom.doc.querySelectorAll(\"style\");\r\n\t\t\tif(arrStyle && arrStyle.length > 0)\r\n\t\t\t{\r\n\t\t\t\tfor(var count= 0;count < arrStyle.length; count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar style = arrStyle[count].cloneNode(true);\r\n\t\t\t\t\tstyleHtml += \"\\n\" + style.outerHTML;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar arrLink = this.__dom.doc.querySelectorAll(\"link\");\r\n\t\t\tif(arrLink && arrLink.length > 0)\r\n\t\t\t{\r\n\t\t\t\tfor(var count= 0;count < arrLink.length; count++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar link = this.__dom.doc.createElement(\"link\");\r\n\t\t\t\t\tlink.rel = arrLink[count].rel;\r\n\t\t\t\t\tlink.href = arrLink[count].href;\r\n\t\t\t\t\tlink.type = \"text/css\";\r\n\t\t\t\t\tlink.media = \"all\";\r\n\t\t\t\t\tstyleHtml += \"\\n\" + link.outerHTML;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar html = \"<html><head><style>\" + styleHtml + \"</style></head><body class=\\\"nsEditorBody\" + (this.__config[\"enableLineNumber\"] ? \" nsEditorBodyWithLineNumber\" : \"\") + \"\\\" contenteditable=\\\" \" + !this.__config.enableReadOnly + \"\\\" aria-disabled=\\\"false\\\" spellcheck=\\\"\" + this.__config.enableSpellCheck +\"\\\" dir=\\\"auto\\\">\" + content + \"</body></html>\";\r\n\t\t\tthis.__enableIFrameDesignMode(divTextArea,html);\r\n\t\t}\r\n\t\tif(!content && this.__config.defaultValue && this.__config.defaultValue.length > 0)\r\n\t\t{\r\n\t\t\tcontent = this.__config.defaultValue;\r\n\t\t}\r\n\t\t//for Mozilla showing cursor\r\n\t\tif(content)\r\n\t\t{\r\n\t\t\tcontent = this.__getWrappedContent(content);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tcontent = this.__defaultContent;\r\n\t\t}\r\n\t\tthis.__config.defaultValue = content;\r\n\t\tif(this.__orignalTextArea)\r\n\t\t{\r\n\t\t\tthis.util.addStyleClass(this.__orignalTextArea,\"nsEditorTextAreaHidden\");\r\n\t\t\tif(!this.__config[\"placeholder\"] && this.__orignalTextArea.getAttribute(\"placeholder\"))\r\n\t\t\t{\r\n\t\t\t\tthis.__config[\"placeholder\"] = this.__orignalTextArea.getAttribute(\"placeholder\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.util.addStyleClass(divTextArea,\"nsEditorTextAreaGeneric\");\r\n\t\t\r\n\t\treturn divTextArea;\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__initTextArea = function()\r\n\t{\r\n\t\tvar listenerComponent = this.__getListenerComponent();\r\n\t\tvar clickListener = this.__isModeTextArea() ? this.__compTextArea : this.__frameContentDoc;\r\n\t\tvar body = this.__isModeTextArea() ? this.__compTextArea : this.__getIFrameBody();\r\n\t\tvar self = this;\r\n\t\t\r\n\t\tvar genericListerener = function(event)\r\n\t\t{\r\n\t\t\tevent = self.util.getEvent(event);\r\n\t\t\tif(event.type == \"blur\")\r\n\t\t\t{\r\n\t\t\t\tif(!self.getDisabled())\r\n\t\t\t\t{\r\n\t\t\t\t\tself.__selection.saveSelection();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar element = event.target;\r\n\t\t\tvar parentElement = element.parentNode;\r\n\t\t\tvar item = {orignalEvent:event,element: element,parentElement: parentElement};\r\n\t\t\tself.__dispatchInternalEvent(event.type,item,item);\r\n\t\t};\r\n\t\t\r\n\t\tvar eventListener = function(event){\r\n\t\t\tevent = self.util.getEvent(event);\r\n\t\t\t//var target = self.util.getTarget(event);\r\n\t\t\tself.__selection.saveSelection();\r\n\t\t\t//self.__updateToolbar(target);\r\n\t\t};\r\n\t\tvar pasteListener = function(event)\r\n\t\t{\r\n\t\t\tevent = self.util.getEvent(event);\r\n\t\t\tswitch(event.type)\r\n\t\t\t{\r\n\t\t\t\tcase \"beforepaste\":\r\n\t\t\t\t\tself.__dispatchInternalEvent(\"beforepaste\",{orignalEvent:event},{orignalEvent:event});\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase \"paste\":\r\n\t\t\t\t\tvar content = self.__getPastedHTML(event);\r\n\t\t\t\t\tif(!content)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcontent = {};\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcontent.orignalEvent = event;\r\n\t\t\t\t\tself.__dispatchInternalEvent(\"paste\",content,content);\r\n\t\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t};\r\n\t\t\r\n\t\tif(this.__config.defaultValue)\r\n\t\t{\r\n\t\t\tbody.innerHTML = this.__config.defaultValue;\r\n\t\t}\r\n\t\tvar nonClickEvents = \"keydown keyup keypress mousedown mouseup mousemove copy cut dragstart drop dragover touchstart touchend touchmove focus blur\";\r\n\t\tvar clickEvents = \"selectionchange selectionstart dblclick click paste\";\r\n\t\tthis.util.addEvent(listenerComponent,nonClickEvents,genericListerener);\r\n\t\tthis.util.addEvent(clickListener,clickEvents,genericListerener);\r\n\t\t//this.util.addEvent(listenerComponent,\"keydown\",this.__textAreaKeyDownHandler.bind(this));\r\n\t\t//this.util.addEvent(listenerComponent,\"keyup mouseup mouseout focusout\",eventListener);\r\n\t\tthis.util.addEvent(clickListener,\"beforepaste paste\",pasteListener);\r\n\t\tthis.util.addEvent(clickListener,\"click\",this.__textAreaClickHandler.bind(this));\r\n\t\t/*if(!this.__isModeTextArea())\r\n\t\t{\r\n\t\t\tthis.__callTextAreaFunc();\r\n\t\t}*/\r\n\t\tthis.__createLineNumberComponents();\r\n\t\tthis.__callTextAreaFunc();\r\n\t\tthis.__dispatchInternalEvent(\"textAreaInitialized\");\r\n\t\tthis.__textAreaObserver = new MutationObserver(this.__textAreaChangeHandler.bind(this));\r\n\t\tvar observerConfig = {attributes:false,childList:true,characterData:true,subtree:true};\r\n\t\tthis.__textAreaObserver.observe(body, observerConfig);\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__enableIFrameDesignMode = function(iframe,html)\r\n\t{\r\n\t\tif(iframe && !this.__isFrameDesignModeEnabled)\r\n\t\t{\r\n\t\t\tthis.__frameContentWindow = this.__getIFrameContentWindow(iframe);\r\n\t\t\ttry \r\n\t\t\t{\r\n\t\t\t\tthis.__frameContentDoc = this.__frameContentWindow.document;\r\n\t\t\t\tthis.__frameContentDoc.open();\r\n\t\t\t\tthis.__frameContentDoc.write(html);\r\n\t\t\t\tthis.__frameContentDoc.close();\r\n } \r\n\t\t\tcatch (error) \r\n\t\t\t{\r\n //console.debug(error);\r\n }\r\n if (this.__dom.doc.contentEditable) \r\n\t\t\t{\r\n \tthis.__frameContentDoc.designMode = \"On\";\r\n \tthis.__isFrameDesignModeEnabled = true;\r\n } \r\n\t\t\telse if (this.__dom.doc.designMode !== null) \r\n\t\t\t{\r\n try \r\n\t\t\t\t{\r\n \tthis.__frameContentDoc.designMode = \"on\";\r\n \tthis.__isFrameDesignModeEnabled = true;\r\n } \r\n\t\t\t\tcatch (error) \r\n\t\t\t\t{\r\n //console.debug(error);\r\n }\r\n }\r\n if(this.__isFrameDesignModeEnabled)\r\n {\r\n \tthis.__setIframeStyle();\r\n \tthis.__initTextArea();\r\n \tthis.__dispatchInternalEvent(\"iframeInitialized\");\r\n }\r\n var self = this;\r\n this.__timeOutInterval = setTimeout(function () \r\n\t\t {\r\n \tself.__timeOutInterval = null;\r\n \tself.__enableIFrameDesignMode.call(self,iframe,html);\r\n\t\t }, 500);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tclearTimeout(this.__timeOutInterval);\r\n\t\t\tthis.__timeOutInterval = null;\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__setIframeStyle = function()\r\n\t{\r\n\t\tif(this.__config.height == \"auto\")\r\n\t\t{\r\n\t\t\tvar doc = this.__getDocument();\r\n\t\t\tif(doc.documentElement)\r\n\t\t\t{\r\n\t\t\t\tdoc.documentElement.style.overflowY = \"hidden\";\r\n\t\t\t}\r\n\t\t\t//this.util.addEvent(doc,\"readystatechange DOMContentLoaded\",this.__resizeIframe.bind(this));\r\n\t\t\tthis.__listenInternalEvent(\"change\", this.__resizeIframe.bind(this));\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__resizeIframe = function()\r\n\t{\r\n\t\tif(!this.__isModeTextArea() && this.__config.height == \"auto\")\r\n\t\t{\r\n\t\t\tvar iframe = this.__compTextArea;\r\n\t\t\tvar body = this.__getIFrameBody();\r\n\t\t\tif(iframe && body)\r\n\t\t\t{\r\n\t\t\t\tthis.util.css(iframe,\"height\",body.offsetHeight);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\t\r\n\tNSEditor.prototype.__createLineNumberComponents = function()\r\n\t{\r\n\t\tvar listenerComponent = this.__getListenerComponent();\r\n\t\tif(this.__config[\"enableLineNumber\"])\r\n\t\t{\r\n\t\t\tthis.util.addStyleClass(this.__divOuterContainer,\"nsEditorWithLineNumber\");\r\n\t\t\t//var textWidth = this.__width();\r\n\t\t\t//var baseMeasurement = this.__compTextArea.getBoundingClientRect();\r\n\t\t\tthis.__divLineNumberWrapper = this.util.createDiv(this.getID() + \"linenumberwrapper\",\"nsEditorLineNumberWrapper\");\r\n\t\t\tthis.__divLineNumberContainer.appendChild(this.__divLineNumberWrapper);\r\n\t\t\tthis.__queueFunc.splice(0, 0, this.__drawLineNumbers.bind(this,1));\r\n\t\t\tthis.__paddingHorizontal = parseInt(this.util.getStyleValue(this.__divOuterContainer,\"border-left-width\",false)) +\r\n\t\t\t\t\t\t\t\t\tparseInt(this.util.getStyleValue(this.__divOuterContainer,\"border-right-width\",false)) + \r\n\t\t\t\t\t\t\t\t\tparseInt(this.util.getStyleValue(this.__divOuterContainer,\"padding-left\",false)) + \r\n\t\t\t\t\t\t\t\t\tparseInt(this.util.getStyleValue(this.__divOuterContainer,\"padding-right\",false));\r\n\t\t\t//this.__setWidth(textWidth - this.__paddingHorizontal);\r\n\t\t\t//this.__lastTextAreaHeight = this.__compTextArea.offsetHeight; \r\n\t\t\t//this.__lastTextAreaWidth = this.__compTextArea.offsetWidth;\r\n\t\t\tif(!this.__textAreaScrollRef)\r\n\t\t\t{\r\n\t\t\t\tthis.__textAreaScrollRef = this.__textAreaScrollHandler.bind(this);\r\n\t\t\t\tvar element = this.__getScrollableComponent();\r\n\t\t\t\tthis.util.addEvent(element,\"scroll\",this.__textAreaScrollRef);\r\n\t\t\t}\r\n\t\t\tif(!this.__textAreaResizeRef)\r\n\t\t\t{\r\n\t\t\t\tthis.__textAreaResizeRef = this.__textAreaResizeHandler.bind(this);\r\n\t\t\t\tthis.util.addEvent(listenerComponent,\"resize\",this.__textAreaResizeRef);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(this.__divLineNumberContainer && this.__divLineNumberContainer.parentElement)\r\n\t\t\t{\r\n\t\t\t\tthis.__divLineNumberContainer.parentElement.removeChild(this.__divLineNumberContainer);\r\n\t\t\t\tthis.__divLineNumberContainer = null;\r\n\t\t\t}\r\n\t\t\tthis.util.removeStyleClass(this.__divOuterContainer,\"nsEditorWithLineNumber\");\r\n\t\t}\r\n\t\tif(this.__config[\"enableAutoSuggest\"])\r\n\t\t{\r\n\t\t\tif(!this.__textAreaKeyUpRef)\r\n\t\t\t{\r\n\t\t\t\tthis.__textAreaKeyUpRef = this.__textAreaKeyUpHandler.bind(this);\r\n\t\t\t\tthis.util.addEvent(listenerComponent,\"keyup\",this.__textAreaKeyUpRef);\r\n\t\t\t}\r\n\t\t\tif(!this.__textAreaK