📄 textedit.htc
字号:
eWebEditor.focus();
var sel = eWebEditor.document.selection.createRange();
switch(what){
case "excel": // 插入EXCEL表格
insertHTML("<object classid='clsid:0002E510-0000-0000-C000-000000000046' id='Spreadsheet1' codebase='file:\\Bob\software\office2000\msowc.cab' width='100%' height='250'><param name='HTMLURL' value><param name='HTMLData' value='<html xmlns:x="urn:schemas-microsoft-com:office:excel"xmlns="http://www.w3.org/TR/REC-html40"><head><style type="text/css"><!--tr{mso-height-source:auto;}td{black-space:nowrap;}.wc4590F88{black-space:nowrap;font-family:宋体;mso-number-format:General;font-size:auto;font-weight:auto;font-style:auto;text-decoration:auto;mso-background-source:auto;mso-pattern:auto;mso-color-source:auto;text-align:general;vertical-align:bottom;border-top:none;border-left:none;border-right:none;border-bottom:none;mso-protection:locked;}--></style></head><body><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:OWCVersion>9.0.0.2710</x:OWCVersion><x:Label Style='border-top:solid .5pt silver;border-left:solid .5pt silver;border-right:solid .5pt silver;border-bottom:solid .5pt silver'><x:Caption>Microsoft Office Spreadsheet</x:Caption> </x:Label><x:Name>Sheet1</x:Name><x:WorksheetOptions><x:Selected/><x:Height>7620</x:Height><x:Width>15240</x:Width><x:TopRowVisible>0</x:TopRowVisible><x:LeftColumnVisible>0</x:LeftColumnVisible> <x:ProtectContents>False</x:ProtectContents> <x:DefaultRowHeight>210</x:DefaultRowHeight> <x:StandardWidth>2389</x:StandardWidth> </x:WorksheetOptions> </x:ExcelWorksheet></x:ExcelWorksheets> <x:MaxHeight>80%</x:MaxHeight><x:MaxWidth>80%</x:MaxWidth></x:ExcelWorkbook></xml><![endif]--><table class=wc4590F88 x:str><col width="56"><tr height="14"><td></td></tr></table></body></html>'> <param name='DataType' value='HTMLDATA'> <param name='AutoFit' value='0'><param name='DisplayColHeaders' value='-1'><param name='DisplayGridlines' value='-1'><param name='DisplayHorizontalScrollBar' value='-1'><param name='DisplayRowHeaders' value='-1'><param name='DisplayTitleBar' value='-1'><param name='DisplayToolbar' value='-1'><param name='DisplayVerticalScrollBar' value='-1'> <param name='EnableAutoCalculate' value='-1'> <param name='EnableEvents' value='-1'><param name='MoveAfterReturn' value='-1'><param name='MoveAfterReturnDirection' value='0'><param name='RightToLeft' value='0'><param name='ViewableRange' value='1:65536'></object>");
break;
case "nowdate": // 插入当前系统日期
var d = new Date();
insertHTML(d.toLocaleDateString());
break;
case "nowtime": // 插入当前系统时间
var d = new Date();
insertHTML(d.toLocaleTimeString());
break;
case "br": // 插入换行符
insertHTML("<br>")
break;
case "code": // 代码片段样式
insertHTML('<table width=95% border="0" align="Center" cellpadding="6" cellspacing="0" style="border: 1px Dotted #CCCCCC; TABLE-LAYOUT: fixed"><tr><td bgcolor=#FDFDDF style="WORD-WRAP: break-word"><font style="color: #990000;font-weight:bold">以下是代码片段:</font><br>'+HTMLEncode(sel.text)+'</td></tr></table>');
break;
case "quote": // 引用片段样式
insertHTML('<table width=95% border="0" align="Center" cellpadding="6" cellspacing="0" style="border: 1px Dotted #CCCCCC; TABLE-LAYOUT: fixed"><tr><td bgcolor=#F3F3F3 style="WORD-WRAP: break-word"><font style="color: #990000;font-weight:bold">以下是引用片段:</font><br>'+HTMLEncode(sel.text)+'</td></tr></table>');
break;
case "big": // 字体变大
insertHTML("<big>" + sel.text + "</big>");
break;
case "small": // 字体变小
insertHTML("<small>" + sel.text + "</small>");
break;
default:
alert("错误参数调用!");
break;
}
sel=null;
}
// 显示或隐藏指导方针
var borderShown = "no";
function showBorders() {
if (!validateMode()) return;
var allForms = eWebEditor.document.body.getElementsByTagName("FORM");
var allInputs = eWebEditor.document.body.getElementsByTagName("INPUT");
var allTables = eWebEditor.document.body.getElementsByTagName("TABLE");
var allLinks = eWebEditor.document.body.getElementsByTagName("A");
// 表单
for (a=0; a < allForms.length; a++) {
if (borderShown == "no") {
allForms[a].runtimeStyle.border = "1px dotted #FF0000"
} else {
allForms[a].runtimeStyle.cssText = ""
}
}
// Input Hidden类
for (b=0; b < allInputs.length; b++) {
if (borderShown == "no") {
if (allInputs[b].type.toUpperCase() == "HIDDEN") {
allInputs[b].runtimeStyle.border = "1px dashed #000000"
allInputs[b].runtimeStyle.width = "15px"
allInputs[b].runtimeStyle.height = "15px"
allInputs[b].runtimeStyle.backgroundColor = "#FDADAD"
allInputs[b].runtimeStyle.color = "#FDADAD"
}
} else {
if (allInputs[b].type.toUpperCase() == "HIDDEN")
allInputs[b].runtimeStyle.cssText = ""
}
}
// 表格
for (i=0; i < allTables.length; i++) {
if (borderShown == "no") {
allTables[i].runtimeStyle.border = "1px dotted #BFBFBF"
} else {
allTables[i].runtimeStyle.cssText = ""
}
allRows = allTables[i].rows
for (y=0; y < allRows.length; y++) {
allCellsInRow = allRows[y].cells
for (x=0; x < allCellsInRow.length; x++) {
if (borderShown == "no") {
allCellsInRow[x].runtimeStyle.border = "1px dotted #BFBFBF"
} else {
allCellsInRow[x].runtimeStyle.cssText = ""
}
}
}
}
// 链接 A
for (a=0; a < allLinks.length; a++) {
if (borderShown == "no") {
if (allLinks[a].href.toUpperCase() == "") {
allLinks[a].runtimeStyle.border = "1px dashed #000000"
allLinks[a].runtimeStyle.width = "20px"
allLinks[a].runtimeStyle.height = "16px"
allLinks[a].runtimeStyle.backgroundColor = "#FFFFCC"
allLinks[a].runtimeStyle.color = "#FFFFCC"
}
} else {
allLinks[a].runtimeStyle.cssText = ""
}
}
if (borderShown == "no") {
borderShown = "yes"
} else {
borderShown = "no"
}
scrollUp()
}
// 返回页面最上部
function scrollUp() {
eWebEditor.scrollBy(0,0);
}
// 缩放操作
function doZoom(size) {
eWebEditor.document.body.runtimeStyle.zoom = size + "%";
nCurrZoomSize = size;
}
// 拼写检查
function spellCheck(){
alert("63");
ShowDialog('dialog/spellcheck.htm', 300, 220, true)
}
// 查找替换
function findReplace(){
alert("62");
ShowDialog('dialog/findreplace.htm', 320, 165, true)
}
// 相对(absolute)或绝对位置(static)
function absolutePosition(){
alert("61");
var objReference = null;
var RangeType = eWebEditor.document.selection.type;
if (RangeType != "Control") return;
var selectedRange = eWebEditor.document.selection.createRange();
for (var i=0; i<selectedRange.length; i++){
objReference = selectedRange.item(i);
if (objReference.style.position != 'absolute') {
objReference.style.position='absolute';
}else{
objReference.style.position='static';
}
}
eWebEditor.content = false;
eWebEditor.setActive();
}
// 上移(forward)或下移(backward)一层
function zIndex(action){
alert("71");
var objReference = null;
var RangeType = eWebEditor.document.selection.type;
if (RangeType != "Control") return;
var selectedRange = eWebEditor.document.selection.createRange();
for (var i=0; i<selectedRange.length; i++){
objReference = selectedRange.item(i);
if (action=='forward'){
objReference.style.zIndex +=1;
}else{
objReference.style.zIndex -=1;
}
objReference.style.position='absolute';
}
eWebEditor.content = false;
eWebEditor.setActive();
}
// 是否选中指定类型的控件
function isControlSelected(tag){
alert("51");
if (eWebEditor.document.selection.type == "Control") {
var oControlRange = eWebEditor.document.selection.createRange();
if (oControlRange(0).tagName.toUpperCase() == tag) {
return true;
}
}
return false;
}
// 改变编辑区高度
function sizeChange(size){
alert("75");
for (var i=0; i<parent.frames.length; i++){
if (parent.frames[i].document==self.document){
var obj=parent.frames[i].frameElement;
var height = parseInt(obj.offsetHeight);
if (height+size>=300){
obj.height=height+size;
}
break;
}
}
}
// 大文件内容自动拆分
function splitTextField(objField, html) {
alert("74");
var strFieldName = objField.name;
var objForm = objField.form;
var objDocument = objField.document;
objField.value = html;
//表单限制值设定,限制值是102399,考虑到中文设为一半
var FormLimit = 50000 ;
// 再次处理时,先赋空值
for (var i=1;i<objDocument.getElementsByName(strFieldName).length;i++) {
objDocument.getElementsByName(strFieldName)[i].value = "";
}
//如果表单值超过限制,拆成多个对象
if (html.length > FormLimit) {
objField.value = html.substr(0, FormLimit) ;
html = html.substr(FormLimit) ;
while (html.length > 0) {
var objTEXTAREA = objDocument.createElement("TEXTAREA") ;
objTEXTAREA.name = strFieldName ;
objTEXTAREA.style.display = "none" ;
objTEXTAREA.value = html.substr(0, FormLimit) ;
objForm.appendChild(objTEXTAREA) ;
html = html.substr(FormLimit) ;
}
}
}
// 远程上传
function remoteUpload() {
alert("73");
if (sCurrMode=="TEXT") return;
var objField = document.getElementsByName("eWebEditor_UploadText")[0];
splitTextField(objField, getHTML());
divProcessing.style.top = (document.body.clientHeight-parseFloat(divProcessing.style.height))/2;
divProcessing.style.left = (document.body.clientWidth-parseFloat(divProcessing.style.width))/2;
divProcessing.style.display = "";
eWebEditor_UploadForm.submit();
}
// 远程上传完成
function remoteUploadOK() {
alert("72");
divProcessing.style.display = "none";
if (bDoneAutoRemote){
doSubmit();
}
}
function putLeft(argLeft)
{
vLeft = argLeft;
}
function putTop(argTop)
{
vTop = argTop;
}
function putWidth(argWidth)
{
vWidth = argWidth;
}
function putHeight(argHeight)
{
vHeight = argHeight;
}
</Script>
</public:component>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -