0

how to intigrate codemirror with zk textbox

asked 2013-02-19 17:42:04 +0800

maradolla gravatar image maradolla
3

can any one please tell me how to intigrate codemirror with zk textbox, i am using codemirror fromTextArea, and passing zk textbox component html textarea, the communication between codemirror and zk textbox is not hapenning. the code i entered in codemirror editor is not passing to zk textbox.

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-03-07 08:37:15 +0800

benbai gravatar image benbai
2228 6
http://www.zkoss.org

The code below works well for me

<?script type="text/javascript" src="resource/codemirror/lib/codemirror.js"?>
<?style href="resource/codemirror/lib/codemirror.css" type="text/css" ?>
<?script type="text/javascript" src="resource/codemirror/mode/javascript/javascript.js"?>
<zk xmlns:w="client">
    <window title="ZK Codemirror Test" border="normal">
        <div width="300px" height="250px" style="overflow: hidden;">
            <textbox id="tbx" rows="10">
                <attribute w:name="bind_"><![CDATA[
                    function (a, b, c) {
                        this.$bind_(a, b, c);
                        var wgt = this;
                        myCodeMirror = CodeMirror.fromTextArea(this.$n());
                        myCodeMirror.on('blur', function () {
                            var val = myCodeMirror.getValue();
                            wgt.$n().value = val;
                            wgt.fire('onChange', {value: val}, {toServer: true});
                        });
                    }
                ]]></attribute>
            </textbox>
        </div>
        <button label="test" onClick="alert(tbx.getValue());" />
    </window>
</zk>

image description

image description

link publish delete flag offensive edit
0

answered 2015-11-14 13:34:50 +0800

nsaazn gravatar image nsaazn
13 2

You can also use zk-codemirror component: github.com/sinnlabs/zk-codemirror

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-02-19 17:42:04 +0800

Seen: 41 times

Last updated: Nov 14 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More