Reputation: 398
Well, it been few days I'm observing that YUI 2.9 rich text editor is grayed out in latest Firefox version 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.
Could anyone please share some experiences with similar sort of things?
Upvotes: 1
Views: 667
Reputation: 3944
I bumped into that too. See this bug report
You can just monkey patch the _setInitialContent
method to remove FF special casing.
The following worked for me (SimpleHTMLEditor
is my subclass of the editor):
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);
}
}
Upvotes: 3