LivePreview takes the text from the textarea and sends it to the server
via an Ajax call to handle preview and diff. But CodeEditor hides that
textarea, and only updates it when the form is submitted or the "disable
CodeEditor" button is used.
Fortunately, LivePreview already provides a custom JavaScript event to
indicate when it is about to pull the textarea contents. So all we have
to do is listen for that and update it.
Bug: 47235
Change-Id: Iba1b727c55aabcd31afc06cec99618fcdce207d8
Ace uses JavaScript Web Workers for linting code. Ace's attempt to load workers
in JS and JSON modes runs into the mismatch between its require()
implementation and ResourceLoader, resulting in a request for
/worker_<lang>.js, which 404s.
Change-Id: Ia60ef2122c015635ef0ad963a956b4f77cd6f7e8
MZMcBride suggested CodeEditor should be deployed to Meta, citing the
need for a JSON-aware interface for editing articles in the new
Schema: namespace, which are JSON-encoded. The bundled distribution of
ACE supports JSON, but the extension does not include it as one of the
file formats it supports.
Change-Id: Ice63dece67c732b76c23abc617782332435427cf
Presumably the unbind was meant to refer to the event which was bound in
setupCodeEditor(), not a nonexistent function. It appeared to work because
passing an undefined value as the second argument to unbind() causes all
event handlers to be unbound.
Change-Id: I51b8e7de5e95cb17b595a6b8022a6216048cdb41
Updated Ace to the latest version of my fork on Github, i.e.
approximately 0.2.0 plus some improvements to the Lua indenting module.
I have submitted a pull request, so hopefully the next update will be
from upstream.
The suffixed file names (*-uncompressed, *-noconflict) have disappeared
from upstream, replaced by conditional compilation in separate build
directories. There's not much point in maintaining two unused copies of
the entire source tree, so I deleted them. To avoid migration issues, I
re-added symlinks in place of the suffixed files which were previously
referenced from MediaWiki.
Change-Id: Ic9d2450528769539dfea59bdde7620dbec903604
Remove the "using CodeEditor" automatic edit summary. Maybe this makes
sense for a gadget, but it certainly doesn't make sense as an extension
enabled by default for all JS, CSS and Lua pages.
Change-Id: If3b29d3878f5b8b43727ae34e4b5e3a2f4137a6f
* Scroll up a few lines so that the user can see the error context
* Defer processing of the fragment until the load event, otherwise the code editor is not fully initialised and does not properly respond to the navigateTo() call.
Not ready for prime-time. :) Doesn't actually save pages (just updates the live view), and seems to have problems when invoked multiple times.
Not all GeSHi languages are supported.
Colors of course are different.
Set $wgCodeEditorGeshiIntegration = true to enable; adds a 'section edit link' on source bits.
Simply using the existing gadget version modified to load Ace from the extension directory for now, will integrate better into WikiEditor and use ResourceLoader to load Ace itself in upcoming commits.