var alreadyNaggedAboutRawHtml = false;

function _eCkOnReady(e) {
	var editor = e.editor;
	var writer = editor.dataProcessor.writer;

	writer.selfClosingEnd = '>';

	editor.on('paste', function(e) {
		if( e.data['html'].match(/&lt;.+&gt;/) ) {
			if( !alreadyNaggedAboutRawHtml ) {
				alert("It looks like you're trying to paste raw HTML. This won't work here. Please click the \"Source\" button in the editor to paste raw HTML code.");
				alreadyNaggedAboutRawHtml = true;
			}
		}
	});

	editor.dataProcessor.htmlFilter.onText = function(text) {
		// Remove multiple spaces
		text = text.replace(/(\s*&nbsp;\s*)+/g, '&nbsp;');
		return text;
	};

	// Give me a way to hook in elsewhere
	if(typeof eCkOnReady == 'function') { 
		eCkOnReady(e);
	}
}

