0

Integrating CodeMirror with ZK

asked 2010-04-08 11:07:29 +0800

mpassell gravatar image mpassell
54 3
http://blog.grovehillsoft...

Hi All,

I'm working for a client on a ZK-based app that includes an editor for small Groovy scripts. It currently uses a ZK multiline textbox. It works, but is about as easy to use as coding in Notepad (ack!). When I saw the editor that Guillaume Laforge included in the Groovy Web Console, I was blown away and wanted to add something similar to our app. It turns out that his editor (under the Apache Software License) is based on CodeMirror (under an even more liberal zlib-style license), a JavaScript editor library supporting multiple languages.

I've never created my own ZK component, but I'm guessing that would be the best way to integrate a CodeMirror-based editor with ZK. I'm starting by reading the Component Development Tutorial, but I'm guessing I'll have a lot of questions along the way. The exciting news is that I've received permission from my client to contribute the results back to the community. Would anyone be interested in helping me?

Thanks,
Matt

delete flag offensive retag edit

19 Replies

Sort by ยป oldest newest

answered 2010-04-09 02:06:20 +0800

mjablonski gravatar image mjablonski
1284 3 5
http://www.jease.org/

updated 2010-04-09 02:08:04 +0800

Hi Matt,

I'm interested in CodeMirror as source-editor for my Jease-CMS-Project.

There's a recent checkin in ZKForge, which seems to be a wrapper for EditArea:

http://zkforge.svn.sourceforge.net/viewvc/zkforge/trunk/editarea/

I've never worked with EditArea, but really like CodeMirror, so maybe we can use the existing source of EditArea as "template" which will guide us through the development of a ZK-Component for CodeMirror?

What do you think?

Cheers, Maik

link publish delete flag offensive edit

answered 2010-04-09 03:04:09 +0800

PeterKuo gravatar image PeterKuo
481 2

@mpassell
That tutorial is somewhat out of date.
We are writing tutorial about how to develop zk5 component.
Many related material is in wiki now.
You may contact info at zkoss dot org for more material or training course.

ZK5 components are more well organized.
You can learn from the easy component like label, button.

editarea in ZKForge is under developing, but it does show some fundamental concept.

link publish delete flag offensive edit

answered 2010-04-10 21:57:44 +0800

mpassell gravatar image mpassell
54 3
http://blog.grovehillsoft...

Thanks guys!

@Maik hmm, I didn't know about EditArea. I like the simple look of CodeMirror, but it's good to know about alternatives. As I mention below, I'm stuck with ZK 3.6.x for now. Is the same true for you or have you already made the move to ZK 5? (just want to know if the same component would work for both of us)

@Peter that's good to know. Unfortunately, I'll need to add the editor component before my client's product is ready to upgrade to ZK 5, so I'll have to stick with an approach that will work under ZK 3.6.x. Given that restriction, is that tutorial the right place to start?

Thanks,
Matt

link publish delete flag offensive edit

answered 2010-04-11 02:58:34 +0800

mjablonski gravatar image mjablonski
1284 3 5
http://www.jease.org/

Hi Matt,

I'm already made the move to ZK5 for all my projects, so ZK3 is history for me...:-)

I would suggest that I'm going to provide the CodeMirror-integration for ZK5, while you're doing the same for ZK3. We should agree on (and use) the same API for the server-side component, so you can switch CodeMirror easily after you've migrated to ZK5.

What do you think?

Cheers, Maik

link publish delete flag offensive edit

answered 2010-04-11 19:57:19 +0800

PeterKuo gravatar image PeterKuo
481 2

@mpassell
For develop zk3 component,
http://www.zkoss.org/doc/compdevguide/ is most up to date.

From www.zkoss.org, choose document.
And the component development guide is listed there.

link publish delete flag offensive edit

answered 2010-04-12 09:42:29 +0800

mpassell gravatar image mpassell
54 3
http://blog.grovehillsoft...

updated 2010-04-12 09:43:48 +0800

@Maik ah, lucky you. :) The release I'm working on is already in beta, so the jump from ZK 3.6 to 5 will have to wait. Agreeing on the same API/structure (other than what needs to differ between 3.6 & 5), sounds like a great idea - good for anyone who, like me, is temporarily stuck, but will be moving on in the near future. (By the way, I just saw your email address on the Jease site - I'll send you a note.)

@Peter cool. Thanks for that reference. I'll start reading it right away. If you guys produce something that describes how the process of creating components is different between 3.6 and 5, that would be very helpful for me and Maik.

Thanks,
Matt

link publish delete flag offensive edit

answered 2010-04-12 10:45:10 +0800

mpassell gravatar image mpassell
54 3
http://blog.grovehillsoft...

Peter, should we check our code into the ZK Forge project or figure out our own project hosting (SourceForge, Google Code, etc.)? If we should use the ZK Forge, do we need to be given commit access?

Thanks,
Matt

link publish delete flag offensive edit

answered 2010-04-12 20:18:29 +0800

PeterKuo gravatar image PeterKuo
481 2

@mpassell
Please check in code into zk forge https://sourceforge.net/project/memberlist.php?group_id=156140
You may mail to info at zkoss dot org to ask for commit access.
THanks for your contribution.

link publish delete flag offensive edit

answered 2010-04-13 08:35:53 +0800

mpassell gravatar image mpassell
54 3
http://blog.grovehillsoft...

@Peter
Thanks, I'll go do that. I hope what I put together is worth sharing. ;)

link publish delete flag offensive edit

answered 2010-05-09 20:03:38 +0800

PeterKuo gravatar image PeterKuo
481 2

I'm writing a smalltalk
http://docs.zkoss.org/wiki/Integrating_EditArea

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2010-04-08 11:07:29 +0800

Seen: 1,907 times

Last updated: Sep 03 '12

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