请帮我解决我的问题。我的网站http://bonus.lg.ua上有 Sobi2 。一切正常,但我将浏览器从 Firefox 更改为 Chrome,并且 Sobis 的条目 Edit Html Source 按钮出现问题。当我在 Chrome 中按下 Entry 按钮“Edit Html Source”时,会打开带有复选框和文本“{$lang_theme_code_wordwrap}”的空弹出窗口,仅此而已。使用开发人员工具,我得到下一个错误:
未捕获的类型错误:无法读取未定义 source_editor.js:18 的属性“htmlSource”
这里sourse_editor.js,函数“function onLoadInit()”中的错误:
function saveContent() {
tinyMCE.setContent(document.getElementById('htmlSource').value);
tinyMCE.closeWindow(window);
}
// Fixes some charcode issues
function fixContent(html) {
/* html = html.replace(new RegExp('<(p|hr|table|tr|td|ol|ul|object|embed|li|blockquote)', 'gi'),'\n<$1');
html = html.replace(new RegExp('<\/(p|ol|ul|li|table|tr|td|blockquote|object)>', 'gi'),'</$1>\n');
html = tinyMCE.regexpReplace(html, '<br />','<br />\n','gi');
html = tinyMCE.regexpReplace(html, '\n\n','\n','gi');*/
return html;
}
function onLoadInit() {
tinyMCEPopup.resizeToInnerSize();
document.forms[0].htmlSource.value = fixContent(tinyMCE.getContent(tinyMCE.getWindowArg('editor_id')));
resizeInputs();
}
function setWrap(val) {
var s = document.forms[0].htmlSource;
s.wrap = val;
if (tinyMCE.isGecko) {
var v = s.value;
var n = s.cloneNode(false);
n.setAttribute("wrap", val);
s.parentNode.replaceChild(n, s);
n.value = v;
}
}
function toggleWordWrap(elm) {
if (elm.checked)
setWrap('soft');
else
setWrap('off');
}
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
function resizeInputs() {
if (!tinyMCE.isMSIE) {
wHeight = self.innerHeight-80;
wWidth = self.innerWidth-16;
} else {
wHeight = document.body.clientHeight - 80;
wWidth = document.body.clientWidth - 16;
}
document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
}
function renderWordWrap() {
if (tinyMCE.isMSIE || tinyMCE.isGecko)
document.write('<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{$lang_theme_code_wordwrap}</label>');
}
这是“source_editor.htm”:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{$lang_theme_code_title}</title>
<script language="javascript" type="text/javascript"
src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript"
src="jscripts/source_editor.js"></script>
<base target="_self" />
</head>
<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');"
onresize="resizeInputs();" style="display: none">
<form name="source" onsubmit="saveContent();" action="#">
<div style="float: left" class="title">{$lang_theme_code_title}</div>
<div style="float: right"><script language="javascript"
type="text/javascript">renderWordWrap();</script></div>
<textarea name="htmlSource" id="htmlSource" rows="15" cols="100"
style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px"
dir="ltr" wrap="off"></textarea>
<div class="mceActionPanel">
<div style="float: left"><input type="button" name="insert"
value="{$lang_update}" onclick="saveContent();" id="insert" /></div>
<div style="float: right"><input type="button" name="cancel"
value="{$lang_cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
</div>
</div>
</form>
</body>
</html>