Javascript YUI富文本编辑器在最新Firefox上出现故障

Javascript YUI富文本编辑器在最新Firefox上出现故障,javascript,yui,Javascript,Yui,好吧,几天来我注意到YUI 2.9富文本编辑器在最新的Firefox版本58中变灰了 根据少数Stackoverflow链接,我尝试修补YUI库javascript文件,但大多数都是用于修复过去类似的IE问题 有谁能和我分享一下类似的经历吗?我也碰到过。看 您只需对\u setInitialContent方法进行猴子补丁,即可移除FF特殊外壳 以下内容适用于我(SimpleHTMLEditor是编辑器的子类): SimpleHTMLEditor.prototype.\u setInitialCo

好吧,几天来我注意到YUI 2.9富文本编辑器在最新的Firefox版本58中变灰了

根据少数Stackoverflow链接,我尝试修补YUI库javascript文件,但大多数都是用于修复过去类似的IE问题


有谁能和我分享一下类似的经历吗?

我也碰到过。看

您只需对
\u setInitialContent
方法进行猴子补丁,即可移除FF特殊外壳

以下内容适用于我(
SimpleHTMLEditor
是编辑器的子类):

SimpleHTMLEditor.prototype.\u setInitialContent=函数(原始){
log('用文本区域的内容填充编辑器正文','信息','简单编辑器');
var value=((this._textarea)?this.get('element')。value:this.get('element')。innerHTML),
doc=null;
如果(值==''){
值='
'; } var html=Lang.substitute(this.get('html'){ 标题:this.STR_TITLE, 内容:此._cleanincomingtml(值), CSS:this.get('CSS'), 隐藏的CSS:((this.get('hiddencss'))?this.get('hiddencss'):'/*没有隐藏的CSS*/'), 额外的CSS:((this.get('extracss'))?this.get('extracss'):'/*没有额外的CSS*/')) }), 检查=正确; html=html.replace(/RIGHT_方括号/gi,'{'); html=html.replace(/LEFT_方括号/gi,'}'); if(document.compatMode!=“BackCompat”){ log('将Doctype添加到可编辑区域'、'信息'、'简单编辑器'); html=这个。_docType+“\n”+html; }否则{ log('DocType跳过,因为我们处于BackCompat模式','warn','simpleditor'); } 试一试{ //Adobe AIR代码 if(this.browser.air){ doc=this.\u getDoc().implementation.createHTMLDocument(); var origDoc=this._getDoc(); origDoc.open(); origDoc.close(); doc.open(); doc.write(html); doc.close(); var node=origDoc.importNode(doc.getElementsByTagName(“html”)[0],true); origDoc.replaceChild(节点,origDoc.getElementsByTagName(“html”)[0]); origDoc.body.\u rteload=true; }否则{ doc=这个; doc.open(); doc.write(html); doc.close(); } }捕获(e){ log('Setting doc failed..(\u setInitialContent'),'error','SimpleEditor'); //只有我们藏起来,狩猎才会在这里 检查=错误; } this.get('iframe').setStyle('visibility',''); 如果(检查){ 这是已检查的(原始); } }
Hey非常感谢您指出解决方案。但是你能告诉我里面的变化吗?我已尝试删除或检查
(navigator.userAgent.indexOf('Firefox/1.5')!=-1)
和else语句
this.get('iframe').get('element')。src='数据:text/html;字符集=utf-8,'+encodeURIComponent(html),但没有任何帮助。是的,我正在编辑
yui/editor/editor.js
file.ok。所以您对编辑器类进行了子类化。我正在尝试直接编辑yui/editor/editor.js。我可以看到你没有
if(this.browser.ie | this.browser.webkit | this.browser.opera | | | | this.navigator.userAgent.indexOf('Firefox/1.5')!=-1)){
在try-catch之前。基本上,你省略了将数据附加到iframe中的代码,这是原始代码的情况:
this.get('iframe')。get('element')).src='data:text/html;charset=utf-8',+encodeURIComponent(html)
但不幸的是,同样的方法对我不起作用。有什么线索吗?好的。它起作用了!!在我服务器的yui文件夹中有一些
patch
文件夹。似乎有些开发人员之前已经修补了yui,不再使用原始的yui/editor/editor-min.js文件。有人盲目地否决了这篇文章,然后有人帮助我如果人们不能帮助或不想,为什么他们也不加评论地投票反对呢?
SimpleHTMLEditor.prototype._setInitialContent = function (raw) {
    YAHOO.log('Populating editor body with contents of the text area', 'info', 'SimpleEditor');

    var value = ((this._textarea) ? this.get('element').value : this.get('element').innerHTML),
        doc = null;

    if (value === '') {
        value = '<br>';
    }

    var html = Lang.substitute(this.get('html'), {
        TITLE: this.STR_TITLE,
        CONTENT: this._cleanIncomingHTML(value),
        CSS: this.get('css'),
        HIDDEN_CSS: ((this.get('hiddencss')) ? this.get('hiddencss') : '/* No Hidden CSS */'),
        EXTRA_CSS: ((this.get('extracss')) ? this.get('extracss') : '/* No Extra CSS */')
    }),
        check = true;

    html = html.replace(/RIGHT_BRACKET/gi, '{');
    html = html.replace(/LEFT_BRACKET/gi, '}');

    if (document.compatMode != 'BackCompat') {
        YAHOO.log('Adding Doctype to editable area', 'info', 'SimpleEditor');
        html = this._docType + "\n" + html;
    } else {
        YAHOO.log('DocType skipped because we are in BackCompat Mode.', 'warn', 'SimpleEditor');
    }

    try {
        //Adobe AIR Code
        if (this.browser.air) {
            doc = this._getDoc().implementation.createHTMLDocument();
            var origDoc = this._getDoc();
            origDoc.open();
            origDoc.close();
            doc.open();
            doc.write(html);
            doc.close();
            var node = origDoc.importNode(doc.getElementsByTagName("html")[0], true);
            origDoc.replaceChild(node, origDoc.getElementsByTagName("html")[0]);
            origDoc.body._rteLoaded = true;
        } else {
            doc = this._getDoc();
            doc.open();
            doc.write(html);
            doc.close();
        }
    } catch (e) {
        YAHOO.log('Setting doc failed.. (_setInitialContent)', 'error', 'SimpleEditor');
        //Safari will only be here if we are hidden
        check = false;
    }
    this.get('iframe').setStyle('visibility', '');
    if (check) {
        this._checkLoaded(raw);
    }
}