encodeScript(context, editor);
}
protected void encodeScript(FacesContext context, Editor editor) throws IOException {
Config config = editor.getConfig();
ResponseWriter responseWriter = context.getResponseWriter();
config = setConfigOptions(editor, config);
responseWriter.startElement("script", editor);
responseWriter.writeAttribute("type", "text/javascript", null);
if(editor.getContentCss() == null)
editor.setContentCss("");
responseWriter.write(" CKEDITOR.on('instanceCreated', function(e) {\n" +
" var ed = e.editor;\n" +
" ed._.styles = [];\n" +
" ed.addCss(\"" + editor.getContentCss() + "\");\n" +
" });\n");
String function = editor.getOnInstanceReady();
if(function != null && !function.isEmpty()) {
function = function.replaceAll("\\(.*", "");
function = function.replaceAll(";.*", "");
responseWriter.write("CKEDITOR.on('instanceReady', ");
responseWriter.write(function);
responseWriter.write(");\n");
}
responseWriter.write("var " + editor.resolveWidgetVar() + " = new CKEditor('" + editor.getClientId() + "'");
if(config != null)
responseWriter.write(", " + config.toJson());
responseWriter.write(");\n");
if(editor.getSaveMethod() != null && editor.isAjax()) {
encodeSaveMethod(responseWriter, editor);
} else if(editor.isAjax()) {