Hi all,
as you may know we are using EditArea
(http://www.cdolivet.com/index.php?page=editArea)
as the syntax highlighting editor for sld and demo requests.

Unfortunately EditArea has a number of shortcomings:
- does not work properly in Chrome
- does not work properly in Safari (or so I've been told)
- even in Firefox locating the caret is damn hard (at least for me)
and becomes basically
  impossible once you are playing with a selection

CodeMirror (http://codemirror.net/) is an alternate component that
provides similar functionality
that is better supported and seems to be working as expected in a
number of browsers.
One downside of CodeMirror is that it does not come with some of the
functions that EditArea
has in the toolbar.

I've cooked a patch that integrates code mirror in GeoServer and adds
on top of it a (poorly)
hacked toolbar providing some of the EditArea functions.
You can see the result in the attachment.
The buttons, from left to right, are:
- go to fullscreen
- undo and redo
- go to line
- reformat (either full contents, or just selection)
- a dropdown to change the font size

The patch is big because it contains binary files and the full
codemirror sources, but if you
want to have a look and you have git, try "git apply" against the
patch I've attached
to http://jira.codehaus.org/browse/GEOS-4060

Now, there are thing that are still not working or plain missing and
I'm looking for some help to
fix/complete:
- the "go to fullscreen" button makes the thing go full screen and
back (hurray!), but the editor
  gets empty and completely not functional past that (boo!!).
  I've followed the suggestions at
http://thereisamoduleforthat.com/content/making-div-fullscreen-and-restoring-it-its-original-position
  for that, but I guess CodeMirror needs to relayout and that is not happening.
- a search/replace dialog is missing
- the buttons in the toolbar do not behave like buttons at all (in
fact they are static images)
- the vertical scrollbar position is simply wrong if you make the
browser window fullscreen

For the latter two I was thinking we could use jquery-ui
(http://jqueryui.com/): it would not
be such a stretch since we're already using jquery in the main
GeoServer template.
Eventually, for the former as well: if we don't manage to make the
full screen thing working,
we could have the external diff implement the jquery-ui "resizeable" effect...

Anyways, given my limited knowledge of javascript the above is getting
a bit over my head.
If you feel like giving it a spin, the patch is here:
http://jira.codehaus.org/browse/GEOS-4060

Cheers
Andrea

-----------------------------------------------------
Ing. Andrea Aime
Senior Software Engineer

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584962313
fax:     +39 0584962313

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-----------------------------------------------------

<<attachment: codemirror-preview-nq8.png>>

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to