In certain cases you may face an issue when wsc.css styles file of WProofreader is inserted into the source mode of a CKEditor 4 document.
<link href="https://svc.webspellchecker.net/spellcheck31/wscbundle/css/wsc.css" rel="stylesheet" type="text/css" />
If your preference is to remove such insertions, there is a workaround that you can consider implementing:
Define the config script as on the example below:
window.WEBSPELLCHECKER_CONFIG = { ... onLoad: function(instance) { var container = instance.getContainerNode(), // Link to the editable container isCkeditor4 = container.classList.contains('cke_editable'); // Dirty check for CKEditor 4. if (isCkeditor4) { container.savedWscInstance = instance; // Save link on the WebSpellChecker instance to the editable DOM element. } }, ... };
Once config is defined, please do the following:
// Subscribe to the CKEditor 4 'instanceReady' event CKEDITOR.on('instanceReady', function(event) { var editor = event.editor; // Subscribe to the CKEditor 4 'beforeSetMode' event editor.on('beforeSetMode', function(e) { // If user switch CKEditor 4 to the 'sorce' mode if (e.data === 'source') { var container = editor.editable().$, parent = container.parentNode, links = parent.getElementsByTagName('link'), styleName = 'wsc.css', link; if (!container.savedWscInstance) { return; } // Destroy instance and remove link on it container.savedWscInstance.destroy(); container.savedWscInstance = null; // Go through all links and remove link to the WSC CSS file. for (var i = 0; i < links.length; i++) { link = links[i]; if (link.href.indexOf(styleName) !== -1 && link.parentNode) { link.parentNode.removeChild(link); } } } }); });