Package com.google.code.ckJsfEditor

Examples of com.google.code.ckJsfEditor.Config


public class EditorTest {
    private Config config;
    private String editorContents;

    public EditorTest() {
        config = new Config().toolbar(Toolbar.TOOLBAR_FULL).customConfig("");
    }
View Full Code Here


        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()) {
View Full Code Here

                "}\n");
    }

    protected Config setConfigOptions(Editor editor, Config config) {
        if(config == null)
            config = new Config();

        if(editor.isReadonly())
            config.readOnly(true);

        if(editor.getHeight() != null && !editor.getHeight().isEmpty())
View Full Code Here

        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");
        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()) {
View Full Code Here

                "}\n");
    }

    protected Config setConfigOptions(Editor editor, Config config) {
        if(config == null)
            config = new Config();

        if(editor.isReadonly())
            config.readOnly(true);

        if(editor.getHeight() != null && !editor.getHeight().isEmpty())
View Full Code Here

TOP

Related Classes of com.google.code.ckJsfEditor.Config

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.