Categories:
Author:
Current version:
0.8
About It:
Get it:
Rate it:
Flag it:
spf_codemirror
A syntax-highlighting plugin for Textpattern admin – now with Zen Coding/Emmet (HTML & CSS).
Preferences can now be set for theme, font-size and full-screen hot-keys.
Background
This was a quick update to Dale Chapman’s mrd_codeMirror which, in turn, was prompted by my CodeMirror admin theme and, of course, Marijn Haverbeke’s CodeMirror. Now with Zen Coding goodness thrown in.
Thanks to Marijn, Sergey and Dale.
Features
- Adds CodeMirror syntax-highlighting to textareas in Textpattern’s Forms, Pages and Style tabs;
- Also to JavaScript tab (spf_js required) and External Files tab (spf_ext required);
- Basic preferences via Admin > Preferences > Advanced;
- HTML/CSS shorthand/code-completion now added to Pages, Forms & CSS courtesy of Zen Coding/Emmet.
Installation
- DOWNLOAD and unzip;
- Upload the containing ‘codemirror’ directory to your web root:
- codemirror
- css.php
- files
- images
- index.php
- rpc
- sites
- textpattern
- Install and activate the plugin (spf_codemirror.txt – inside the unzipped folder).
- NOTE: the folder structure mirrors that of a standard CodeMirror download (just the ‘lib’, ‘mode’ and ‘theme’ directories) with the addition of the minified emmet.min.js file from Emmet-CodeMirror2 – for easy upgrade.
Upgrade to a newer version of CodeMirror
- You can now easily upgrade CodeMirror (2.35 as of Nov 2012).
- Download the latest release.
- Unzip the download and upload the containing ‘lib’, ‘mode’ and ‘theme’ directories to the codemirror directory on your web server.
- To upgrade Emmet (Zen Coding) download ‘Emmet-CodeMirror2’ from here, unzip it and upload the containing ‘emmet.min.js’ file to your codemirror directory.
Minify support
- If you have Minify on your web server in the standard DOCUMENT_ROOT/min location, spf_codemirror will use it to minify css & js – if you don’t, it won’t.
Zen Coding notes:
- Initiate completion by hitting TAB (or Cmd+E).
- Try typing this:
div#page>div.logo+ul#navigation>li*5>aand then TAB. - Works with opening and closing txp tags (try typing
txp:if_sectionand then TAB). - CSS shortcuts work even better with Emmet* – try typing m and then TAB in Styles.
*Emmet is the new name for Zen Coding.
Notes & issues
- Basic preferences (theme, font-size, full-screen hot-keys) are available via Admin > Preferences > Advanced.
- Textarea resizing is disabled (enabling gives erratic results);
- Plugins editor not supported;
- Code-folding requires input to the Javascript (which lines to fold) and is therefore disabled.
Version history
0.8 – January 2013
- Changes for CodeMirror 3.01 & Emmet 1.3.3
- Added match-highlighter feature for Pages, Forms & Javascript.
- Fixed search in full-screen mode.
0.61 – November 2012
- Fixed Minify issue with ‘public’ and ‘private’ URLs (‘ihu’ v ‘hu’).
0.6 – November 2012
- Re-written for Textpattern 4.5.1.
- Upgraded to CodeMirror 2.35 and Emmet.
- Full-screen support – hit F5 (and Esc to exit).
- Basic preferences via Admin > Preferences > Advanced.
- CodeMirror folder structure now mirrors standard CodeMirror for easy upgrades.
- Automatic Minify support.
0.5 – May 2012
- CSS support for Zen Coding within style tags.
0.4 – May 2012
- Added code block indicators:
spf_codemirror START/END. - Code cleanup.
0.3 – May 2012
- Added Zen Coding code completion to Pages and Forms (HTML).
- Upgraded to CodeMirror 2.25.
0.2 – May 2012
- Changed load order (to allow interaction with other plugins).
0.1 – May 2012
- first release.
Keywords/tags:
Initially released:
May 2012Posted here:
26 May 2012Article modified:
22 Jan 2013









If there is a comment form at the Information URL, you may want to leave your comments/questions there or at the Forum thread for quicker feedback. Otherwise, comment away:
Subscribe to this article's comments RSS feed. [ ? ] View Recent Comments across the site.