Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-12-20 23:37:07

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

soo_editarea: EditArea integration with Txp tag highlighting

EditArea is a JavaScript-based code editor for browser textareas. Features include:

  • Code highlighting
  • Browser tab-key override for proper tabbing in the textarea
  • Full-screen mode
  • Find & replace w/ regex support
  • Multiple undo/redo

soo_editarea provides easy integration of EditArea into Textpattern. (Well, pretty easy: there are a few steps involved.)

Features:

You can set plugin preferences for:

  • Syntax language for Page & Form editing, allowing custom syntax file
  • Source path, making it easier to share one EditArea installation across multiple sites
  • Various EditArea options (tooltip language, font size & family, &c.)

Available at http://ipsedixit.net/txp/124/soo_editarea

Version History

  • 0.1.5 (2012/01/24)
    • Added pref for EditArea plugins (as requested by mrdale)
  • 0.1.4 (2011/04/27)
    • Added default height/width prefs (as requested by mrdale)
  • 0.1.3 (2010/12/30)
    • Fixed bug with Internet Explorer (type attribute in script tag)
    • General code cleaning
  • 0.1.2 (2010/12/20)
    • More preference options (tooltip language, font size & family, tab-to-space conversion)
  • 0.1.1 (2010/12/20)
    • Documentation update [thanks to Marc C. for the suggestions]
  • 0.1.0 (2010/12/20)
    • EditArea integration for Txp’s Page Template, Form, and CSS editors

Suggested by the (apparently defunct) atb_editarea plugin, and discussion on the Txp forum.

Last edited by jsoo (2012-01-26 01:10:08)


Code is topiary

Offline

#2 2010-12-20 23:59:24

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

Re: soo_editarea: EditArea integration with Txp tag highlighting

Wow, thanks! Just got it all working, great plugin.

The only part that I kind of misunderstood at first revolves around the separate txp syntax instructions:

To have Txp tags appear in a different color, add a new syntax file at edit_area/reg_syntax/. (Whenever you upgrade the EditArea files you will have to remember to preserve this file.) Then change the soo_editarea option for Page Template & Form syntax (the installation instructions tell you how to set plugin options).

What I did:

  1. download txp.js and put it in the reg_syntax subfolder
  2. install soo_plugin_pref
  3. click on the soo_editarea plugin’s “Options” link and
  4. type “txp” in the “Page Template and Form Syntax” box.

That got the Textpattern tags highlighted in a different color. Nice :-)

Offline

#3 2010-12-21 00:16:28

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: soo_editarea: EditArea integration with Txp tag highlighting

Thanks Marc; I’ll amend the instructions to make this clearer.

Edit: Done, and released version 0.1.2 with more options.

Last edited by jsoo (2010-12-21 02:49:32)


Code is topiary

Offline

#4 2010-12-21 08:38:54

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: soo_editarea: EditArea integration with Txp tag highlighting

Could you share a screenshot?


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#5 2010-12-21 13:43:29

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: soo_editarea: EditArea integration with Txp tag highlighting

the_ghost wrote:

Could you share a screenshot?

Added screenshots to info page.

Or try the EditArea demo.


Code is topiary

Offline

#6 2010-12-21 14:33:28

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: soo_editarea: EditArea integration with Txp tag highlighting

In Safari Mac the letters are blurred and unreadable, the same in iCab, in Google Chrome it is sharp.

Offline

#7 2010-12-21 14:49:00

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: soo_editarea: EditArea integration with Txp tag highlighting

GugUser wrote:

In Safari Mac the letters are blurred and unreadable, the same in iCab, in Google Chrome it is sharp.

This is a known issue with EditArea and Safari. You can hack EditArea (as suggested in that link) or have Safari spoof a different user agent. It may also be possible to solve this with CSS, but I haven’t looked into it closely. Admittedly, that would probably be the cleanest solution.

iCab is also a WebKit browser so the solution is probably the same. (I haven’t used iCab for about 10 years so I don’t know.) OmniWeb is yet another WebKit browser, that works as is with EditArea. Oddly, though, the above hack fixes Safari but then makes OmniWeb blurry. (However, with OmniWeb it is easy to spoof different user agents on a per-domain basis.)


Code is topiary

Offline

#8 2010-12-21 17:37:20

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: soo_editarea: EditArea integration with Txp tag highlighting

Jeff, this looks good, thanks.

Offline

#9 2010-12-21 22:11:05

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,473

Re: soo_editarea: EditArea integration with Txp tag highlighting

In fact, by changing the user agent (in the same Safari), the quality of the characters is better. The best result is obtained if Safari faked to be Opera. Strange behavior of Safari.

Offline

#10 2010-12-22 00:15:02

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

Re: soo_editarea: EditArea integration with Txp tag highlighting

Very nice! Easy to set up and it works well for me, I usually use Firefox or Chrome TXPing.

Well done Jeff, and just in time for Christmas too.

Offline

#11 2010-12-22 09:25:54

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,752
Website

Re: soo_editarea: EditArea integration with Txp tag highlighting

Truly a great improvement but that display bug in Safari is dreadful. Even with the User Agent changed, the display still seems to start diverging when changing the text size (I then get double lines showing beneath each other).

Out of interest, would perhaps codemirror be a viable alternative in this respect? It hasn’t got all the bells and whistles of EditArea but it’s pleasingly lean compared with EditArea and, to me at least, seems quite a bit faster.


TXP Builders – finely-crafted code, design and txp

Offline

#12 2010-12-22 13:53:57

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: soo_editarea: EditArea integration with Txp tag highlighting

CodeMirror looks like a nice project. Its mixed-language mode is a major advantage over EditArea for certain applications, but I didn’t see it as important to Txp. Maybe, if Textile syntax highlighting were possible, because then you could have mixed Textile/Txp highlighting in the Write panel. Textile parsing is not feasible in EditArea, AFAICT, but, from a glance at a CM parser file, looks like it might be possible there. Then again, mixed Textile/Txp parsing would probably take some work to get anywhere near robust.

So far I find EA sufficiently snappy that I don’t really notice the lag.

I see what you mean about changing the text size when using the user-agent workaround. The EA/Safari hack I linked to works correctly. Obviously a hack isn’t ideal in that you have to redo it on every upgrade, but EA doesn’t seem to be updated all that often. And, with the hack, I can still use OmniWeb with user-agent spoofing, and text resize works. (I learned all this working with Sam’s new project, which includes this hacked version of EA.)


Code is topiary

Offline

Board footer

Powered by FluxBB