Location: PHPKode > projects > PHPDug > adm/scripts/moz/paste_text.htm
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../style/editor.css" rel="stylesheet" type="text/css">
<script>
	var sLangDir=window.opener.oUtil.langDir;
	document.write("<scr"+"ipt src='../language/"+sLangDir+"/paste_text.js'></scr"+"ipt>");
</script>
<script>writeTitle()</script>
<script>
function doCmd(sCmd,sOption)
    {
    var idSource = document.getElementById("idSource").contentWindow;
    idSource.document.execCommand(sCmd, false, sOption);
    }

function bodyOnLoad()
    {
    var idSource = document.getElementById("idSource").contentWindow;
    var sourceDocBody = idSource.document.body;
    sourceDocBody.innerHTML = "";
    sourceDocBody.style.cssText="overflow-x:scroll;overflow-y:scroll;white-space:nowrap";
    sourceDocBody.clearAttributes;

    idSource.document.designMode="on";
    idSource.focus();
    }
    
function doInsert()
    {
    var idSource = document.getElementById("idSource").contentWindow;
    
    var sHTML = idSource.document.body.innerHTML;
    sHTML = sHTML.replace(/>\s+</gi, "><"); //replace space between tag
    sHTML = sHTML.replace(/\r/gi, ""); //replace space between tag
    sHTML = sHTML.replace(/(<br>)\s+/gi, "$1"); //replace space between BR and text
    
    sHTML = sHTML.replace(/(<br>)/gi, "$1&lt;REPBR&gt;"); //replace space between BR and text
    sHTML = sHTML.replace(/(<\/tr>)/gi, "$1&lt;REPBR&gt;"); //replace space between BR and text
    sHTML = sHTML.replace(/(<\/div>)/gi, "$1&lt;REPBR&gt;"); //replace space between BR and text
    sHTML = sHTML.replace(/(<\/h1>)/gi, "$1&lt;REPBR&gt;"); //replace space between BR and text
    sHTML = sHTML.replace(/(<\/h2>)/gi, "$1&lt;REPBR&gt;"); //replace space between BR and text
    sHTML = sHTML.replace(/(<\/h3>)/gi, "$1&lt;REPBR&gt;"); //replace space between BR and text
    sHTML = sHTML.replace(/(<\/h4>)/gi, "$1&lt;REPBR&gt;"); //replace space between BR and text
    sHTML = sHTML.replace(/(<\/h5>)/gi, "$1&lt;REPBR&gt;"); //replace space between BR and text
    sHTML = sHTML.replace(/(<\/h6>)/gi, "$1&lt;REPBR&gt;"); //replace space between BR and text
    sHTML = sHTML.replace(/(<p>)/gi, "$1&lt;REPBR&gt;"); //replace space between BR and text
    idSource.document.body.innerHTML = sHTML;
    
    var range = idSource.document.body.ownerDocument.createRange();
    range.selectNodeContents(idSource.document.body);
    var sText = range.toString();
    
    sText = sText.replace(/<REPBR>/gi, "<br>")
    
    var obj = window.opener.oUtil.obj;
    obj.insertHTML(sText)
    }

</script>
</head>
<body onload="loadText();bodyOnLoad()" style="overflow:hidden;margin:0;background: #f4f4f4;">

<table width="100%" height="100%" align="center" cellpadding="1" cellspacing="1" ID="Table1">
<tr>
<td nowrap>&nbsp;<span id=txtLang name=txtLang>Paste text content here</span>:
</td>
</tr>
<tr>
<tr>
<td style="height:100%">
    <iframe style="width:100%;height:100%;border:#000000 1px solid" name="idSource" id="idSource"></iframe>     
</td>
</tr>
<tr>
<td class="dialogFooter" style="padding:13;padding-top:7;padding-bottom:7;" align="right">
    <input type="button" name=btnCancel id=btnCancel value="cancel" onclick="self.close()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
    <input type="button" name=btnOk id=btnOk value=" ok " onclick="doInsert();self.close()" class="inpBtn" onmouseover="this.className='inpBtnOver';" onmouseout="this.className='inpBtnOut'">
</td>
</tr>
</table>

</body>
</html>
Return current item: PHPDug