On a page which uses Alex Gorbatchev's SyntaxHighlighter and has a CKEditor instance with SCAYT enabled, a script error is thrown when pasting into the editor.
In Firefox, the error is similar to: "e is undefined", shCore.js line 17.
In IE, the error is similar to "Unable to get value of the property 'valueOf': object is null or undefined", http://svc.webspellchecker.net/scayt26/_base.xd.js, line 3268.
Cause:
SyntaxHighlighter uses the XRegExp library, which replaces the native String.prototype.replace(search, replacement) function. SCAYT seems to call the replace function without passing the replacement parameter. The new replace function attempts to call valueOf on the replacement parameter, which throws the error.
This appears to be a bug in SCAYT; however, the native replace function will convert an undefined parameter to the string "undefined", which would mask this problem.
Workaround:
Override the new replace function to cope with an undefined replacement parameter:
jQuery(function(){ var oldReplace = String.prototype.replace; String.prototype.replace = function (search, replacement) { if ("undefined" === typeof(replacement)) { replacement = ""; } return oldReplace.call(this, search, replacement); }; });
Re: Workaround: SCAYT + SyntaxHighlighter conflict
This should be:
Re: Workaround: SCAYT + SyntaxHighlighter conflict
Thanks for reporting and troubleshooting this. This issue is now tracked in ticket #8659 and SpellChecker.net will look into this.
Documentation Manager, CKSource
See CKEditor 5 docs, CKEditor 4 docs, CKEditor 3 docs, CKFinder 3 docs, CKFinder 2 docs for help.
Visit the new CKEditor SDK for samples showcasing editor features to try out and download!
Re: Workaround: SCAYT + SyntaxHighlighter conflict
WebSpellChecker.net team