Textpattern CMS support forum

You are not logged in. Register | Login | Help

#11 2012-05-30 10:36:31

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

Re: spf_codemirror - syntax-highlighting and code-completion admin plugin

@ Dale

Zen Coding for CSS now works – but only within style tags (Pages & Forms) – for raw CSS (Style) just temporarily wrap your style sheet in a style tag.

e.g. in Presentation > Styles type:

style + TAB and then, within the style tags, type @f + TAB.

Offline

#12 2012-05-30 20:35:50

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,202
Website

Re: spf_codemirror - syntax-highlighting and code-completion admin plugin

cool! So now I’m adding a /*<style>*/ at the top of my css and a /*</style>*/ at the bottom and I can use abbrs at will. very nice.

Offline

#13 2012-06-06 05:16:16

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 583
Website

Re: spf_codemirror - syntax-highlighting and code-completion admin plugin

This Zen Coding stuff is pretty nice. Great tools here, Simon. Thanks!

Offline

#14 2012-07-27 16:55:43

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,202
Website

Re: spf_codemirror - syntax-highlighting and code-completion admin plugin

Hi Simon.

What are the odds of you hacking in a find and replace mechanism, and/or code folding.

It’s beyond my capabilities, and I’m guessing it’s a lot of work, but I thought I’d ask anyway.

I love this plugin BTW. Thanks

Offline

#15 2012-08-06 16:46:56

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

Re: spf_codemirror - syntax-highlighting and code-completion admin plugin

mrdale wrote:

What are the odds of you hacking in a find and replace mechanism, and/or code folding.

Hi Dale

.. unlikely, especially in the short-term as I’m not around much for the next month or two. I’ll have some time in mid-September so I’ll have a look then.

Thanks,

Simon

Offline

#16 2012-10-09 09:19:29

lucidlee
New Member
Registered: 2008-11-20
Posts: 3

Re: spf_codemirror - syntax-highlighting and code-completion admin plugin

This is a really useful enhancement, thanks.

Unfortunately I’m getting some crinkly activity when I select rubyblue or elegant as the theme.
When I try editing a style the edited line is actually some random number of lines above the insertion cursor.
Sometimes if I swap themes midstream I can get it to behave properly but its not a repeatable fix. Am I the only one experiencing this?

Its only minor I guess since the other themes work just fine, but I find the rubyblue theme is the most readable.

Lee
Safari 6.0, MacOSX 10.7.4, MAMP (MySQL 5.2, PHP5.4)

Offline

#17 2012-10-09 10:02:32

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,194

Re: spf_codemirror - syntax-highlighting and code-completion admin plugin

Am I the only one experiencing this?

Nope. Add these lines to the end of your cm_combined_min.css:

.CodeMirror-lines pre {
	line-height: 1.411em;
	}

.CodeMirror-gutter-text pre {
	line-height: 1.461em;
	}

Probably won’t suit your environment/theme offhand.

Edit: Added pre to second selector

Last edited by uli (2012-10-09 13:52:18)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#18 2012-10-11 14:21:59

lucidlee
New Member
Registered: 2008-11-20
Posts: 3

Re: spf_codemirror - syntax-highlighting and code-completion admin plugin

Hey that seems to work! Thanks

UPDATE: I spoke too soon. It works but there are sporadic failures. I don’t see a pattern yet though.

UPDATE 2: Now I think I see the pattern. Editing goes screwy below commented text paras. Eg try editing this snippet:
@<script type=“text/javascript” src=”<txp:site_url />site-design/js/prettyPhoto.js”></script>

<!—[if IE 8]>
<link rel=“stylesheet” type=“text/css” media=“all” href=”<txp:site_url />site-design/css/ie8.css” />
<![endif]—>

<txp:output_form form=“del_custom_colours” />

<txp:if_section name=“default”>
<script type=“text/javascript” src=”<txp:site_url />site-design/js/loopedSlider.js”></script>
</txp:if_section>@

Last edited by lucidlee (2012-10-14 23:54:06)

Offline

#19 2012-10-26 18:29:09

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,202
Website

Re: spf_codemirror - syntax-highlighting and code-completion admin plugin

I’d love to be able to toggle fullscreen with a keystroke. Any chance of building that into the plugin?

Offline

#20 2012-10-27 17:37:06

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,202
Website

Re: spf_codemirror - syntax-highlighting and code-completion admin plugin

Full-screen toggle

I just hacked full-screen via keystroke F5 into the plugin… here’s how to do it…

Step 1

Find the function function spf_textarea_common() { on around line 175 and add these Lines right after it and before the line containing EOF;

<script type="text/javascript">
function isFullScreen(cm) {
      return /\bCodeMirror-fullscreen\b/.test(cm.getWrapperElement().className);
    }
    function winHeight() {
      return window.innerHeight || (document.documentElement || document.body).clientHeight;
    }
    function setFullScreen(cm, full) {
      var wrap = cm.getWrapperElement(), scroll = cm.getScrollerElement();
      if (full) {
        wrap.className += " CodeMirror-fullscreen";
        scroll.style.height = winHeight() + "px";
        document.documentElement.style.overflow = "hidden";
      } else {
        wrap.className = wrap.className.replace(" CodeMirror-fullscreen", "");
        scroll.style.height = "";
        document.documentElement.style.overflow = "";
      }
      cm.refresh();
    }
</script>
<style type="text/css">
  .CodeMirror-fullscreen {
	display: block !important;
	position: absolute !important;
	top: 0px !important; left: 0 !important;
	width: 100% !important;
	z-index: 99999999999 !important;
  }
</style>

Step 2:

Add these lines at the end of each page’s codemirror call before the line }); You will have to add a comma at the end of the previous line as well.

	extraKeys: {
	"F5": function(cm) {setFullScreen(cm, !isFullScreen(cm));},
	"Esc": function(cm) {if (isFullScreen(cm)) setFullScreen(cm, false);}
	}

Tested on a Mac with Firefox running TXP 4.6 with a modified Hive theme

Offline

Board footer

Powered by FluxBB