简体   繁体   English

YUI 富文本编辑器在最新的 Firefox 上损坏

[英]YUI rich text editor broken on latest Firefox

Well, it been few days I'm observing that YUI 2.9 rich text editor is grayed out in latest Firefox version 58.好吧,几天前我发现 YUI 2.9 富文本编辑器在最新的 Firefox 版本 58 中显示为灰色。

As per few Stackoverflow links I tried to patched the YUI library javascript files but most of them are for fixing similar IE issues in the past.根据一些 Stackoverflow 链接,我尝试修补 YUI 库 javascript 文件,但其中大部分用于修复过去类似的 IE 问题。

Could anyone please share some experiences with similar sort of things?有人可以分享一些类似事情的经验吗?

I bumped into that too.我也碰到过。 See this bug report看到这个错误报告

You can just monkey patch the _setInitialContent method to remove FF special casing.您可以只修补_setInitialContent方法以删除 FF 特殊大小写。

The following worked for me ( SimpleHTMLEditor is my subclass of the editor):以下对我SimpleHTMLEditorSimpleHTMLEditor是我编辑器的子类):

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);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM