Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-04-26 22:49:25

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

CodeMirror: syntax highlighting for Textpattern (admin theme)

Superseded by plugin version now supporting Zen Coding.

-A syntax highlighting admin theme using CodeMirror

Requires Textpattern 4.4.1

Features

  • ‘Classic’ admin theme plus syntax highlighting for Pages, Forms, Style pages;
  • syntax highlighting for JavaScript (requires spf_js v0.2);
  • syntax highlighting for external files editor (requires spf_ext);
  • choice of CodeMirror themes ;
  • matching brackets highlighter;
  • line numbering;
  • code-specific highlighting.

Instructions

  • Plugin version now available.
  • Download the zipped theme;
  • Unzip and upload the ‘codemirror’ directory inside the zip archive to your textpattern > themes directory;
  • -Enable the admin theme via Admin > Preferences > Advanced > Theme (or via smd_admin_themes
  • Pages, Forms and Styles pages will be syntax highlighted;
  • JavaScript and External Files will be syntax highlighted if spf_js and spf_ext are installed.

Customisation

  • Edit the ‘textarea_xxx.js’ files to change default preferences for each tab;
  • e.g. edit ‘textarea_page.js’ to change preferences for the Page tab highlighting;
  • e.g. change theme: “ambiance” to any other theme.

Note: editing theme files is a doddle with smd_admin_themes.

Possible to-dos

  • Resizable textareas;
  • Textpattern tag mode.

Version history

0.3 – April 2012
  • code optimisation.
0.2 – April 2012
  • fixed footer.
0.1 – April 2012
  • first release.

Last edited by spiffin (2012-05-26 20:09:19)

Offline

#2 2012-04-27 10:48:39

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: CodeMirror: syntax highlighting for Textpattern (admin theme)

Interesting, thank you for sharing

Do you think it’s adaptable to the “write” tab with a full screen option and a syntax syntax highlighting for Textile ?

Offline

#3 2012-04-27 17:25:37

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

Re: CodeMirror: syntax highlighting for Textpattern (admin theme)

sacripant wrote:

Do you think it’s adaptable to the “write” tab with a full screen option and a syntax syntax highlighting for Textile ?

Hmm .. I’d have thought a WYSIWYG editor would be more suited to the Write tab.

Something like Aloha Editor perhaps?

Simon

Offline

#4 2012-05-05 17:59:56

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: CodeMirror: syntax highlighting for Textpattern (admin theme)

Excellent work mrFinch.

It appears that codeMirror, is way better than editarea and in fact the “shiznitz”.

I use a heavily modified (to my own devious wine client ends) admin theme based on Sandspace so switching themes is not really an option. I tinkered with trying to hak hak_editarea to no avail (loaded but took on weird, non functional styling).

Perhaps you could bend you mad skills toward adapting what you learned with the theme, into a standalone plugin for the css form and page areas.

-Dale

Offline

#5 2012-05-05 18:19:05

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: CodeMirror: syntax highlighting for Textpattern (admin theme)

mrdale wrote:

Excellent work mrFinch.

Perhaps you could bend you mad skills toward adapting what you learned with the theme, into a standalone plugin for the css form and page areas.

+1

Offline

#6 2012-05-06 06:01:51

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: CodeMirror: syntax highlighting for Textpattern (admin theme)

OK, joebaich talked me into it… mrd_codeMirror

Offline

#7 2012-05-06 15:20:06

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

Re: CodeMirror: syntax highlighting for Textpattern (admin theme)

mrdale wrote:

Excellent work mrFinch.
Perhaps you could bend you mad skills toward adapting what you learned with the theme, into a standalone plugin for the css form and page areas.

Thanks Dale (and Joe) .. I did have a quick look at plugin possibilities .. but it’s quite fiddly getting to work with other (non-Classic) themes.

Offline

#8 2012-05-06 18:50:20

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: CodeMirror: syntax highlighting for Textpattern (admin theme)

Just an advanced warning – the core themes (Remora and Classic) are undergoing a substantial CSS rewrite for Textpattern 4.5 (it’s coming in a mega-patch to the SVN in a few days time), along with some structural changes to the admin-side.

However, I’ll look into how this syntax highlighting could sit alongside that, in a non-theme specific way.

Offline

Board footer

Powered by FluxBB