<%@ Page Language="vb" AutoEventWireup="true" CodeBehind="FrmTextArea.aspx.vb" Inherits="FinIQWebApp.FrmTextArea" MaintainScrollPositionOnPostback="true" ValidateRequest="false"  %>

<!DOCTYPE html>

<html>
<head id="Head1" runat="server" style="width:100%;height:100%">
    <title></title>
    <script src="../FinIQJS/external/jquery/jquery.min.js"></script>
    <script src="../FinIQJS/jquery-ui.min.js"></script>
    
</head>
<body>
    <form id="form1" runat="server" style="width:100%;height:100%">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <div style="width:100%;height:100%">
            <table id="tblTextArea" runat="server" style="width:100%;height:100%;">
                <tr>
                    <td style="padding-bottom: 5px; padding-left: 10px; padding-top: 5px;">
                        <asp:Button CssClass="btn" ID="btnTabApply" runat="server" Text="Apply" Width="80px" />
                    </td>
                </tr>
                <tr>
                    <td>
                      <asp:textBox ID="selectText" TextMode="MultiLine" runat="server" style="width:100%;height:1700px;border: 0px solid !important"/>
                         <div id="divDefaultValue" enableviewstate="true" runat="server" contenteditable="true" style="width:0px;height:0px;text-decoration:none;color:black" placeholder="Enter text here..." ></div>
                    </td>
                </tr>
            </table>
        </div>
    </form>

    <script type="text/javascript">
        $(document).ready(function () {
            $.support.cors = true;
            $("#divDefaultValue").blur(function (e) {
               document.getElementById("selectText").textContent = htmlEscape($(this).text());
                //$("#selectText").val(htmlEscape($(this).text()));
                 e.preventDefault = false;

            });
          
             
            function htmlEscape(str) {
                    return str
                        //.replace(/&/g, '&amp;')
                        //.replace(/"/g, '&quot;')
                        //.replace(/'/g, '&#39;')
                        //.replace(/</g, '&lt;')
                        //.replace(/>/g, '&gt;');
              

                var xml = str;//'<DocumentElement>  <CustomTab1>    <SN1_Custom>IBM.N</SN1_Custom>   <ShareName_Custom>International Business Machines Corp</ShareName_Custom>    <Exchange_custom>NYSE</Exchange_custom>    <StrikeCcy_Custom>USD</StrikeCcy_Custom>    <InitialPrice_Custom>146.2580</InitialPrice_Custom>    <Strike_Custom>138.9451</Strike_Custom>    <Autocall_Custom />  </CustomTab1></DocumentElement>';
                var xmlDoc = new DOMParser().parseFromString(xml, "application/xml");

                document.getElementById("doc").textContent = new XMLSerializer().serializeToString(xmlDoc);
                return new XMLSerializer().serializeToString(xmlDoc.documentElement);

            }
        });





    </script>
</body>
</html>
