0
ライトwyswig(iframe)に書きます。イベントのキーアップ時にiframe内の長さを数えた関数があり、ボックス内(文字用)のシンボル数が変更されています。しかし、Opera 9.24では、innerHTMLボックスブラウザを変更してhtmlページのトップに落としました。オペラのhtmlタグでinnerHTMLを変更しようとすると、htmlページの先頭にドロップされます
//this.doc - iframe document
$(this.doc).keydown(function(e)
{
if (e.ctrlKey || e.metaKey) isCtrl = true;
if (e.keyCode == 9) { this.execCommand('indent', false); return false; }
if (e.keyCode == 66 && isCtrl) { this.execCommand('bold', 'bold'); return false; }`enter code here`
if (e.keyCode == 73 && isCtrl) { this.execCommand('italic', 'italic'); return false; }
}.bind2(this)).keyup(function(e)
{
isCtrl = false;
if (e.keyCode == 13)
{
return true;
}
if(this.opts.maxlength)
this.checkLength();
if(this.opts.autoSync)
this.syncCode();
}.bind2(this));
checkLength: function() {
var html = this.getHtml();
if (html.length >= this.opts.maxlength) {
html = html.substr(0, this.opts.maxlength);
this.setHtml(html);
alert('Комментарий должен содержать до ' + this.opts.maxlength);
} else {
var number = this.opts.maxlength - html.length;
//li_counter - box for characters left
this.li_counter.html("Осталось символов: " + number);
}
// bind2
Function.prototype.bind2 = function(object)
{
var method = this; var oldArguments = $.makeArray(arguments).slice(1);
return function (argument)
{
if (argument == new Object) { method = null; oldArguments = null; }
else if (method == null) throw "Attempt to invoke destructed method reference.";
else { var newArguments = $.makeArray(arguments); return method.apply(object, oldArguments.concat(newArguments)); }
};
};
},