1

Topic: Ace syntax highlighter plugin

Ace syntax highlighter plugin

Because Codemirror doesn't work well for me in Chrome wink

Code editor and syntax highlighter based on Ajax.org Cloud9 Editor. See the homepage of this powerful editor here http://ace.ajax.org

Ace 0.0.4

Tested with Wolf 0.7.5, 0.7.6 - mySQL
should work with SQLite and PG

================

New features in 0.1.0

  • Wolf 0.7.6 support

New features in 0.1.0

  • default settings stored in database (instead of file)

  • major javascript refactoring - big thanks to @dedlfix

  • shortcuts for bold and italic markup (HTML, textile and markdown modes)

  • quick access to text-wrap options  (temporary)

  • quick access to font size (temporary)

  • 3 text wrapping modes: wrap to editor, wrap to margin, no wrapping

  • MultiEdit plugin integration

  • updated Ace to current build

  • German translation - by @dedlfix

New features in 0.0.7

  • updated Ace to current build

  • live PHP syntax checking

  • some more bugfixes

New features in 0.0.6

  • per-page cursor position storage and autofocusing

  • option to toggle active line highlighting

  • Dutch translation by NicNLD

New features in 0.0.4

  • fixed issues with multiple page parts editing

  • per-page syntax highlighting mode storage

  • per-page scroll position storage

  • added icon to jump to global editor settings

  • added notification in case of wrong settings file permissions

  • fixed settings icon (thx David)

New features in 0.0.2:

  • Plenty of themes (30+)

  • css, html, javascript, json, markdown, php, text, textile and xml modes

  • custom font size, line wrapping length, editor window height

  • integrates with page part, snippet and (optionally) layout editing windows

================

Download version 0.1.1

Remeber to put the plugin in /wolf/plugins/ace smile

Wolf CMS repository: http://www.wolfcms.org/repository/133
Git repository: https://github.com/marekmurawski/ace

As usual, your feedback is welcome

Last edited by mm (2013-04-15 08:40)

2

Re: Ace syntax highlighter plugin

You're awesome wink Your works are the most helpful wolf's plugins. Thanks!

"Everyone knows something cannot be done. Then along comes a man who does not know that it cannot be done and does it."
Albert Einstein

3

Re: Ace syntax highlighter plugin

YES!!!!

This is awesome cool

Just the tool I needed for working on layouts etc.

Works great with the snippets for the webshop plugin, too smile

Thanks mm!

Thumbs up

4

Re: Ace syntax highlighter plugin

Yepper, I'm in on this one. Very very nice!

It took me a moment to get the point of the "permissions" fail on the config file, but once I sorted that out, it's solid gold. (Well, actually it's Solarized Dark wink )

I've left an issue on Github, though -- very, very minor, but probably worth a tweak.

Now if it worked with afKeepScroll it would be close to perfection. cool

Using Wolf CMS professionally and for profit? Please consider supporting Wolf financially. Thanks!

5

Re: Ace syntax highlighter plugin

If you don't mind I would like to suggest you change how you currently set the editor's 'mode' (by fetching the user setting).

For example, in layouts you could parse the Content-Type value from the form and set the correct syntax (mode) before initializing the editor and fallback to, probably, 'text/html'.

For page-parts and snippets you would create as many filters as syntax/modes you want to support.

p.d: Although it would be best if I submitted an issue in your repo, you have to change how you trigger the filters to support parts added on a current page.

$('.filter-selector').bind(...)

to

$('.filter-selector').live(...)

Cheers for the plugin.

Thumbs up

6

Re: Ace syntax highlighter plugin

Thank you guys for your input. I'm glad you like it and I hope you'll like it even more with new features in 0.0.4:

  • SCROLL KEEPING as requested by David (integrated, not with afKeepScroll plugin)

  • each editor instance can remember syntax highlighting mode

  • better page part editing as suggested by andrewmman

  • numerous minor bugfixes

andrewmman wrote:

For example, in layouts you could parse the Content-Type value from the form and set the correct syntax (mode) before initializing the editor and fallback to, probably, 'text/html'.

For page-parts and snippets you would create as many filters as syntax/modes you want to support.

I don't think parsing Content-Type would be a good solution. Layout has output of "text/html" however it's source is actually PHP (most probably wink )

I've decided to go the cookie storage approach, and setting defaults in config. This way each and every page-part/snippet/layout can remember it's highlight mode and scroll position for as long as you set in cookie settings.

I would be really grateful if you test how it works for you now.

Download link is in the first post.

While upgrading remember to delete old files before uploading new ones.

Last edited by mm (2012-10-03 12:00)

7

Re: Ace syntax highlighter plugin

OK, I must say I really like this plugin. However, there is one tiny little problem with the Monokai theme, the one I'm using most of the time. I'm not sure if you can fix this though.

The problem is that when I select a piece of text, the whole line is highlighted so I don't have a visual confirmation of what piece I am selecting.

http://www.nth-root.nl/public/images/wolf/monokai.png

(in the above image I only selected the word 'echo')

Is this normal behavior? Can it be fixed? Other than this, Monokai really is my favorite!

Thumbs up

8

Re: Ace syntax highlighter plugin

NicNLD wrote:

Is this normal behavior? Can it be fixed? Other than this, Monokai really is my favorite!

Try this, Nic (it won't break anything!) - open up the file "[plugins]ace/src-min/theme-monokai.js", and find this bit:

.ace_active_line {  background: #49483E;}

change it to:

.ace_active_line {  background: #3B3B32;}

Does that do it for you?

Using Wolf CMS professionally and for profit? Please consider supporting Wolf financially. Thanks!

9

Re: Ace syntax highlighter plugin

I'm glad you're satisfied with this plugin smile

Monokai is also my favorite theme, that's why it's default one big_smile

Of course this issue can be resolved. You need to edit PLUGINS_ROOT/ace/build/src-min/theme-monokai.js file which is an js encapsulation of theme. There you'll find (around line 1, column 712) this:

.ace_selection {  background: #49483E;}

which essentialy defines selection background color. I changed it to background: black but it's a matter of visual taste...

BTW:

Another annoyance I have is that editor looses cursor position (scroll is saved already) after saving and continuing. I'll address this in next release when I find some time.

Edit: Hahaha, post collision @David big_smile YOU WON!

BTW2:

I'll also include option to disable active line highlighting in new version.

Last edited by mm (2012-10-24 00:26)

10

Re: Ace syntax highlighter plugin

Thanks!

I'll also include option to disable active line highlighting in new version.

I don't think that'll be necessary, at least I'm not gonna turn it off. But perhaps you could change the selection color a different color so you can see what you are selecting.

What are the required steps to add a theme? Is it as simple as adding a theme-[name].js file to the src-min folder?

Thumbs up

11

Re: Ace syntax highlighter plugin

Yes, this should be all. The plugin takes care of listing it in select box.

12

Re: Ace syntax highlighter plugin

OK, I added a pull request to add a theme I called 'Sublime Monokai'. It is a slightly altered version of the original Monokai theme, inspired by Sublime Text 2.

It also fixes the problem with the invisible selection.

Last edited by NicNLD (2013-01-22 22:14)

Thumbs up +1

13

Re: Ace syntax highlighter plugin

Just updated to v. 0.0.6

I fixed some bugs concerning the scroll position keeping and added option to toggle active line highlighting.

Additionally, now Ace stores cursor position too in pages/snippets/layouts and focuses the editor automatically, so together with Ctrl+S plugin you get Almost-IDE experience wink

A "sublime-monokai" theme by NicNLD was also added.

14

Re: Ace syntax highlighter plugin

One more update - 0.0.7

  • updated Ace to current build

  • live PHP syntax checking

  • some more bugfixes

15

Re: Ace syntax highlighter plugin

new version - 0.1.0
  • default settings stored in database (instead of file)

  • major javascript refactoring - big thanks to @dedlfix

  • keyboard shortcuts for bold (ctrl+b) and italic (ctrl+i) markup (HTML, textile and markdown modes)

  • quick access to text-wrap options  (temporary)

  • quick access to font size (temporary)

  • 3 text wrapping modes: wrap to editor, wrap to margin, no wrapping

  • MultiEdit plugin integration

  • updated Ace to current build

  • German translation - by @dedlfix

The MultiEdit integration will work with upcoming MultiEdit v0.3.0 which I'll release today hopefully wink

Last edited by mm (2013-03-21 16:25)

16

Re: Ace syntax highlighter plugin

ver 0.1.1

Wolf 0.7.6 support smile

17

Re: Ace syntax highlighter plugin

Please help to integrate this plugin in file manager

Sorry for bad English by Google.
Best regards, crick.