Ticket #12423 (new feature request)

Opened 2 years ago

Last modified 5 weeks ago

Include Ace (or similar) as default code editor

Reported by: scribu Owned by:
Priority: normal Milestone: Future Release
Component: Editor Version: 3.0
Severity: normal Keywords:
Cc: mitchoyoshitaka, aurimas

Description

We've dropped CodePress since it wasn't quite up to par in regards to browser compatibility.

How about using  Bespin for editing plugin and theme files?

Change History

There's already a plugin that does this (on a separate admin page):

 Better File Editor

comment:2 follow-up: ↓ 12   c00l2sv2 years ago

Bespin has poor support for non HTML5 browsers [1].

What about CodeMirror [2]? Pretty active development and cross-browser support, bsd-like license [3], clean look[4].

[1]  https://wiki.mozilla.org/Labs/Bespin/UserGuide#Requisites [2]  http://marijn.haverbeke.nl/codemirror/ [3]  http://marijn.haverbeke.nl/codemirror/LICENSE [4]  http://marijn.haverbeke.nl/codemirror/contrib/php/index.html

I've also been looking at EditArea.  http://sourceforge.net/projects/editarea/

comment:4   jane2 years ago

I was at a panel with one of the guys behind Bespin last week and he said flat out that Bespin was created knowing that they didn't have to worry about IE based on their audience. It was a Canvas vs Flash panel at sxsw, and though it looked cool, it looked very niche in availability based on our general audience browser stats. I don't think we can use Bespin unless we are going to try and be trailblazers for Canvas/HTML5 and basically pull an early-2000s web standards trick and just say 'your browser sucks, upgrade,' which is sometimes tempting, but would be a bummer for users who don't get to install software on their machines and are stuck with pre-9 IE (schools, libraries, government agencies, etc). Injecting a Chrome frame into IE is their workaround I think.

comment:6 in reply to: ↑ 5   nacin23 months ago

  • Milestone changed from 3.1 to Future Release

Replying to c00l2sv:

Also found this:  http://shjs.sourceforge.net/

General thoughts here. By all means, we should identify and test as many projects as possible. That said, I don't think we want to repeat mistakes made with CodePress in regards to project activity.  http://shjs.sourceforge.net/ has only one maintainer (as does EditArea and countless others) though it also hasn't had a release since 2008.

It would be naive to think that just because a project supports IE6 now, it'll always support every presumably more standards-compliant browser in the future (not to mention future standards). Aside from that, inclusion in WordPress would reveal existing bugs thanks to a larger userbase.

Finding an active (and willing) project should be as important an objective as finding one that works cross-browser.

What are the chances to fork an existing project and maintain it exclusively for WordPress (patching and bug fixing if problems arise)?

  • Summary changed from Include Bespin as default code editor to Include Ace (or similar) as default code editor

Bespin, which became SkyWriter, now has merged with and is superceded by  Ace. Ace doesn't require canvas for its rendering engine. It is tri-licensed (MPL/GPL/LGPL).

  • Cc mitchoyoshitaka added
  • Cc aurimas added

FWIW, note that Mozilla themselves have decided not to use Ace wholesale for integration into the browser for Firefox's DevTools initiative (think native Firebug).

More info on that decision here:  https://wiki.mozilla.org/DevTools/Features/CodeEditor#Evaluating_the_Options

The bug for their work on integrating their winner, the Orion code editor, into fx is here:  https://bugzilla.mozilla.org/show_bug.cgi?id=660784

comment:12 in reply to: ↑ 2   WraithKenny6 months ago

Replying to c00l2sv:

What about CodeMirror [2]? Pretty active development and cross-browser support, bsd-like license [3], clean look[4].

I've been using CodeMirror in Scripts-n-Styles and like it alot. The best feature is mixed-mode support so that script and style tags are appropriately highlighted in html which in turn is highlighted in a php file which is properly highlighted.

CodeMirror is a solid and unobtrusive editor (degrades gracefully, ie, doesn't impact without javascript) which is simple to include into the plugin/theme editor pages. For example, I've quickly integrated it into Scripts-n-Styles to see what would be involved (and because I thought it'd be useful):

 https://github.com/unFocus/Scripts-n-Styles/blob/master/js/code-editor.js
 https://github.com/unFocus/Scripts-n-Styles/blob/master/includes/class.SnS_Admin_Code_Editor.php
 https://github.com/unFocus/Scripts-n-Styles/blob/master/css/code-editor.css

The CodeMirror part of it works great (though there are bugs in the wp side of the editor). There are also quite a few other plugins that configure CodeMirror in more advanced ways, to include Search-n-Replace, Auto-complete, and more. (This also means it is somewhat tested in the wordpress environment.)

CodeMirror is open and actively developed  https://github.com/marijnh/CodeMirror2/graphs/impact

Supports Firefox 2+, Chrome (any version), Safari 3+, Internet Explorer 6+, Opera 9+  http://codemirror.net/

Anyone still interested in this? I think I remember something about splitting the editors completely out of core and into a "Core Plugin" like the importer plugin. If so, any interest in that? (I'd contribute if it had blessing.)

Note: See TracTickets for help on using tickets.