Commit graph

161 commits

Author SHA1 Message Date
Fomafix 84be29b197 Replace $( document ).ready(...) by $(...)
In jQuery 3 $(document).ready(...) is deprecated.
https://jquery.com/upgrade-guide/3.0/#deprecated-document-ready-handlers-other-than-jquery-function

Change-Id: Id8cfdfa74c1789db1b24c39c16e51c7a0c408f11
2017-01-05 23:03:28 +01:00
Ed Sanders 6042898fcf Use OOUI for confirm dialog
Would be nice to do this for the goto line prompt,
but such a OO.ui.prompt doesn't exist yet.

Change-Id: I6b24e51b5b106ece80e265ff5417878f108619b7
2016-12-24 22:49:21 +00:00
Ed Sanders 1818ed4bea Add missing i18n for 'go to line' prompt
Change-Id: If4f7c243f23fc809c95cf671d5b47ec978a9fdb9
2016-12-09 13:49:46 +00:00
Ed Sanders 7fddf35aa8 build: Remove jshint/jscs, add eslint/stylelint
Change-Id: I4304ca95de7dd395676f40bcbb35a447c039ba21
2016-12-09 13:31:08 +00:00
Derk-Jan Hartman 07b24bb9f0 Remove inline CodeEditor for <syntaxhighlight>
This was an unfinished module to enable the CodeEditor to do inline
editing of <syntaxhighlight> blocks. It was never finished and I think
that with the VE and WE 2017 work, it likely will never be finished
either. For that reason, it is better to remove it altogether.

Change-Id: I83714188a53d2ca6bb7bf0dc6d0c89b7fb45a47a
2016-11-14 23:47:28 +01:00
Derk-Jan Hartman c9d4d7663e Simplify modeloading
Analogous to I82d278920695be12aa80a79548abf8b8ce5445fd, make sure that
we can lazy load any language that Ace supports. Not because we need
it, but because it's the nicer way to do it.

Change-Id: I19b8a31041814ac1273d62a24b5ed622fd91a7a8
2016-10-21 14:13:26 +02:00
Derk-Jan Hartman 46d76471e1 Use slice instead of substring per code conventions
Change-Id: Id9b08270c377f2b31486dbdb9492b77860f436e7
2016-09-26 21:36:53 +02:00
Derk-Jan Hartman c158ae5602 Update Ace and use scoped require / define
This brings Ace to upstream commit
4a55188fdb0eee9e2d3854f175e67408a1e47655

Bug: T127643
Change-Id: I7699e842d7b561b8a35cf7a4ea048f4126eaf856
2016-03-14 00:26:27 +01:00
jenkins-bot e10ed30111 Merge "Replace toolbar with OOUI/OOUI-style SVGs" 2016-02-29 23:33:18 +00:00
Ed Sanders b5312f1d4c Replace toolbar with OOUI/OOUI-style SVGs
* Use resource loader embedding for better performance
  (uses a slightly hacky method to achieve this, the only
  alternative would be to fix the WikiEditor API, but that
  would introduce a version dependency)
* Use SVGs from OOUI where available or create new ones where not.
  These are used and available under the OOjs UI MIT licence.
* Provide PNG fallbacks using LESS mixin
* Remove unused icons

Change-Id: If38d51d24958716e2617c4cb515e7c0575cdfeba
2016-02-29 13:00:15 -08:00
Ed Sanders 41e9cee298 GotoLine: Don't throw an exception if the user cancels the prompt
Change-Id: I540ba492cf3acda01ad61800561cda0276f36c76
2016-02-27 22:39:39 +00:00
jenkins-bot 0a7dc634fc Merge "Adapt toolbar icon change to change 19789d76 in WikiEditor" 2016-02-23 22:01:27 +00:00
Fomafix ecfc6514d3 Remove check for existence of mw.hook
mw.hook was introduced with 2e970257 in MediaWiki core for REL 1.22.

Change-Id: Ib81ba150c4056be19ede2145308489d0b286aea0
2016-01-29 12:32:14 +00:00
Fomafix d4a5b7eddf Adapt toolbar icon change to change 19789d76 in WikiEditor
Bug: T125201
Change-Id: I58c1d246d3fbb8031e3be482f349a0538c44152c
2016-01-29 11:07:47 +00:00
jenkins-bot 74e4cc383f Merge "Abort previous unfinished API request before sending new request" 2016-01-27 20:57:22 +00:00
Fomafix 135716727d Abort previous unfinished API request before sending new request
This change requires 81171ab3 from core included in MediaWiki 1.27.

Change-Id: I8dec32bf49e412510cf5d98f2f946bfd337f47a1
2016-01-27 11:07:38 +00:00
Fomafix d10cfbb1bf Update URLs from http://ace.ajax.org/ to https://ace.c9.io/
http://ace.ajax.org/ redirects to https://ace.c9.io/

Change-Id: Ib915fec2855bfcec1a7d9b3c91dd3dd13db703ab
2016-01-27 11:01:54 +00:00
jenkins-bot 49f5843e65 Merge "Use module "mediawiki.api.options" to save options" 2015-11-30 19:01:06 +00:00
Fomafix aeb072ce8a Avoid accessing undefined context
The delayed update of the status bar fails when the CodeEditor is disabled
in the meantime.

Bug: T119869
Change-Id: I6b23148f7a3d79021b87ad5f0f537eda9b68970f
2015-11-30 12:49:30 +00:00
Fomafix 370b597b79 Enable the "Go to line nummer" button on read-only pages
Bug: T114618
Change-Id: I17b5c05673489935a80db2e115d211695c17bde5
2015-11-30 09:09:53 +00:00
Fomafix c59add0448 Use $.map from jQuery
This requires jQuery >= 1.6. This is included in MediaWiki >= 1.18.
This change drops support for MediaWiki 1.17.

Change-Id: I12f3f3e22d9bc47a0a2d9a9d201af4e44012e0a2
2015-11-29 20:16:03 +00:00
Fomafix eacbcd828a Use module "mediawiki.api.options" to save options
This change requires MediaWiki 1.25.

Change-Id: Id476b7422bd47751813f671982ceecd6d9844718
2015-11-29 16:00:13 +00:00
Paladox b6e9f6cca4 Add jshint and jscs to npm, Also add composer.json
Instead of running the jshint test through jenkins, Run it through npm
instead.

Also add composer.json for running php code sniffer and phplint instead of
running phplint through jenkins.

Also update grunt-jsonlint to 1.0.6

Change-Id: Icd9aa1b1c7213d056aa5294a804341053141b0bd
2015-11-29 12:03:16 +01:00
jenkins-bot 52ef9085a9 Merge "Do not try to save options for anonymous user" 2015-11-29 10:38:09 +00:00
Fomafix 2278f87b89 Do not try to save options for anonymous user
This change requires 65062d3c from core included in MediaWiki 1.20+.

Change-Id: I130ab8e93107e066d2cb757c511c844e161b703f
2015-11-28 23:10:40 +00:00
Fomafix 22f1a0c3d2 Fix error message in set user options fail
* Write error.info instead of "[object Object]" into console.
* Avoid accessing result.error when not defined.

Bug: T119809
Change-Id: I23a124cbaf8ef9376c4c6071dec4d7e846f1eabe
2015-11-28 22:51:20 +00:00
paladox 6d052a8011 Update Ace to 29-10-2015
Updates ACE to commit:
3fb55e8e37

This includes basic scrolling support in mobiles
https://github.com/ajaxorg/ace/pull/2555

iOS 6 or later supported.

Android 4.x or later is supported.

Re enabled indent and outdent seems to work now, Ive tested it.

Bug: T119086
Bug: T69328
Change-Id: If8ecc499c281c92c53982cee281a88119a773514
2015-11-19 19:32:21 +00:00
Derk-Jan Hartman 838c627728 Make sure that wikieditor context is ready
This fixes a bug where the event could be triggered before the
WikiEditor context was ready. Also make sure that the fragment monitor
takes into account the possible disabled state of the CodeEditor.

Bug: T103802
Change-Id: Id5564c4a91a0a14632024781f3e57b68c4803970
2015-08-27 21:22:09 +02:00
Fomafix c09b7f5b78 Define variable event
* Declare event as first function parameter.
* Move event.preventDefault() to the synchronous end of the function.

Change-Id: I813355088cbf215264dcccd474e97630915d63c5
2015-08-14 15:12:04 +00:00
Fomafix db1692c38c Remove quotes around object properties keys
Change-Id: Ie2126869364dcf56beb1190c80b6d8c36b282dce
2015-06-27 20:22:54 +00:00
Matthew Flaschen a7f5ae257c ucFirst has been deprecated, so inline it
Also, it wasn't declaring the dependency, so this fixes that as well.

Bug: T103612
Change-Id: Ic37fe3fec02ee4b328bd88ef46107431758216da
2015-06-23 23:40:51 -04:00
Fomafix 887bae8ac9 Remove explicit setting of the width of the textarea
The setting of the width is not necessary and sometimes it generates
a width which is to wide.

Bug: T102736
Change-Id: I7ed715fba4d65e7a571421b7a06d604e6b0958f7
2015-06-17 04:23:56 +00:00
Derk-Jan Hartman aba51ef4f5 Additional CodeEditor buttons
- toggle invisible characters.
- search and replace (disabled)
- indent/outdent
- line wrapping
- go to line

Icons by Connor Shea

Bug: T61923
Change-Id: I9e434d1b23f8254bc654ebbd31b5e4b70bbf5fe1
2015-05-26 01:43:47 +00:00
Derk-Jan Hartman a9cdbcacb4 Add tooltip to annotation indicator
In the past I had made the annotation indicators clickable, and your
cursor will in this case navigate to the next annotation in editor.
This was not really easily discoverable, so I have added a tooltip to
make it slightly more discoverable.

I also added a CSS line to prevent users from accidently selecting the
text (or rather numbers) in this area, which I had noticed happened to
me at times when trying to click it.

Change-Id: I47ecba232ff925169d0f64d85ae34ff6564cc1a5
2015-05-25 11:07:41 +02:00
Derk-Jan Hartman 76b4899835 Only block for errors when saving
Bug: T70765
Change-Id: I947f7f5bda4272677dd8d090e155b1010a66795d
2015-03-29 16:22:42 +02:00
jenkins-bot 442e3a0338 Merge "Remove trigger 'LivePreviewPrepare'" 2015-02-05 12:17:30 +00:00
Fomafix d3be0b552b Fix whitespaces
Change-Id: Ia26f885ac2423d9f4a67b9e4d58a90aba22d0f07
2015-02-05 12:13:18 +00:00
Derk-Jan Hartman 7254cda535 Ace: Update to 2015-01-28
Updated to
6b88b939c2

Includes fixes for drag delay (bug 60432)
and chrome useragent detection: Github issue
https://github.com/ajaxorg/ace/issues/1950

Bug: T62432
Change-Id: I5ac67a812f09ac43e73475613afc9a3f1ddc9a75
2015-01-28 11:04:27 -08:00
Fomafix f64a164986 Remove trigger 'LivePreviewPrepare'
Depends on I30bd709d8 in mediawiki-core.
The '#wpTextbox1' gets read by textSelection( 'getContents' ).
The trigger is not necessary anymore.

Change-Id: Iae54a2422ff1814f8858723d51fcb10d04645c51
2015-01-03 15:35:06 +00:00
Derk-Jan Hartman 2d4810f186 Add setContents to textSelection impl of CodeEditor
Change-Id: I0a5434b9d40d8945b6b801e2aa2b4b23466ea71c
2014-11-29 20:10:44 +01:00
jenkins-bot 8d45645cdc Merge "Disable CodeEditor on mobile" 2014-10-31 17:28:35 +00:00
Derk-Jan Hartman c91e62b74f Improve the CodeEditor toolbar
There isn't much in it yet, but it's a start.
Also needs a patch in WikiEditor, which is forcing some elements to be
visible for no apparent reason.

Change-Id: I6b57e5c11066a104a89bef3b7c8efd2129a80a8f
2014-10-26 18:09:26 +00:00
Derk-Jan Hartman 37228b2578 Split jquery.textSelection and WikiEditor api overrides
Split context.evt up into 2 objects
- context.fn, where WikiEditor API functions are defined
- textSelectionFn, where all textSelection API function are defined.

- scrollToTop() is moved to the WikiEditor API block
- getElementAtCursor() is removed. It is no longer in use by the
WikiEditor API or the textSelection API.

This depends on MediaWiki core change I14492572

Bug: 29328
Change-Id: I57bc7791dc61b7edcf258e6c16445d5a4a8783cf
2014-10-16 21:18:15 +02:00
Timo Tijhof 72f3c78381 Use returnFalse instead of jQuery.noop
Follows-up 86622b6.

While these functions looked like placeholders in a configuration
object to allow calling them unconditionally, they actually had
meaning. They were event overrides to prevent WikiEditor from
running its own event handlers.

They were implicitly returning false by having no return statement
(implying a 'return undefined', which casts to false).

The separate functions were already quite obfuscated as returning
false, using $.noop made it even harder to understand what's
going on.

Use an explicit return value instead.

Change-Id: I0852fbc9225d069f50085787d2d0105fd7b1743c
2014-10-16 20:37:18 +02:00
Fomafix 86622b63fb Use jQuery.noop
This avoids the definition of several empty functions.

Change-Id: Ic6fe5c46e1ed90217c1935dd0a87c6b97a0ad513
2014-10-16 19:25:17 +02:00
jenkins-bot aefe1def47 Merge "Use mediawiki.api.parse" 2014-10-16 17:16:42 +00:00
jenkins-bot 18423323d2 Merge "Apply coding conventions for JavaScript" 2014-10-16 17:16:41 +00:00
Fomafix d3e3a9796e Use mediawiki.api.parse
Change-Id: I9106245c6c0ee98093155c8b9a8f92b270bde063
2014-10-10 13:31:02 +00:00
Fomafix 3b30aaf78a Apply coding conventions for JavaScript
* Fix closure invocation
* Avoid global variablesin closure
* Avoid unused variable
* Fix whitespaces

Change-Id: I67552a67e8ab493e5af8717c11668430886ee468
2014-10-10 13:24:22 +00:00
Fomafix 9e2d2c842a Apply coding convections for JavaScript
* Reorder functions to avoid forward references
* Remove unused variables saved and summary
* Fix whitespaces
* Avoid else after return
* Combine var blocks

Change-Id: I2a66645c24b9cce287c4196f2c4a762420ad80a0
2014-10-10 11:58:58 +00:00
Derk-Jan Hartman 7bfd574cbe CodeEditor: Keep experimental Geshi editor working
Still experimental, not really functional, but this fixes it to at
least run again.

Change-Id: Ia71aa9421179654a063c706e0cbf3016a2fcc280
2014-08-28 19:41:19 +00:00
Derk-Jan Hartman 4aa22a1df1 Undefined function mw.log.error
Bug: 68557
Change-Id: Ib9e8b291711f3d582ab70cab25ace6f61500f5af
2014-08-14 22:18:02 +02:00
Derk-Jan Hartman 853282fa34 Disable CodeEditor on mobile
Disabled on our known android/iphone/ipod UAs, because of Bug 55345.

Change-Id: I8c5377889c349df14d43803fecaab09d7554e97a
2014-07-14 12:18:35 +02:00
Derk-Jan Hartman c949981553 Allow on the fly loading of language modes
Change-Id: Ie04138677dead4c23b1bcfef4e1f7a2cd6e8826e
2014-07-10 16:47:42 +02:00
Derk-Jan Hartman 96f421386f Clear the statusbar if no annotations are left
Bug: 64758
Change-Id: Id2a26742420d03242265e537dc5404707c4bf714
2014-05-09 09:17:59 +00:00
Derk-Jan Hartman 1373c915df CodeEditor: Add basic code completion and snippet support
Bug: 48828
Change-Id: If7d165fc849ca9687dd7d511b0d111b9969fb2a7
2014-05-06 22:55:16 +02:00
jenkins-bot 26973c1fa9 Merge "Persistent disabling of CodeEditor" 2014-05-06 17:39:33 +00:00
Derk-Jan Hartman 0c172d6359 Persistent disabling of CodeEditor
This makes it so that if you do not have WikiEditor enabled, you also
will not have CodeEditor enabled. In the feedback we have seen so far,
this seems to be desirable for those users (bug 55936).

Also people were not able with the cookie pref for the editor, because
it can easily expire. This introduces a hidden pref, controlled by the
enable/disable CodeEditor button, to preserve this value instead (bug
46779).

It also gives a more reliable way to detect if the editor is enabled or
disabled. mw.user.options.get( 'usebetatoolbar' ) and
mw.user.options.get( 'usecodeeditor' ) combined should be able to convey
this information to something like WikEd (bug 62250).

Bug: 46779
Bug: 62250
Bug: 55936
Change-Id: I4639f68c00a2b9183a6f89b5e00983c07a8592a2
2014-05-01 10:33:26 +02:00
Derk-Jan Hartman 96afba23d6 IE8: Fix line endings in CodeEditor
IE8 uses innerText, which is a bit more sloppy with line ending
preservation than other browsers are. Instead of copying the value into
the DOM and have the Editor pick it up during init, just set it directly
on the EditSession. Should even be faster.

Bug: 64559
Change-Id: Iafbb07afb6d06ed94057f8ddf8b080fd136d7fb3
2014-04-30 14:26:53 +02:00
Derk-Jan Hartman 0154e0d0e8 Fix trailing comma
Also applied upstream at https://github.com/ajaxorg/ace/pull/1938

Bug: 64559
Change-Id: Ieb55819b634c14335806bd7ce3e6c1f063a346cc
2014-04-29 20:51:51 +02:00
jenkins-bot 8da019fe29 Merge "CodeEditor: Disable in IE7, too unstable." 2014-04-29 17:48:24 +00:00
Derk-Jan Hartman a99f5c824c CodeEditor: Disable in IE7, too unstable.
Bug: 64559
Change-Id: I59a8cebf1d1c7f3e839295d8a85739d9c2dc2683
2014-04-29 14:35:02 +02:00
Derk-Jan Hartman 7847555702 Update Ace to 29-04-2014
Updates ACE to commit: 4949e18f00e4dbf34fc8a213909ef6ae3e1a1015

This includes fixes for IE7/8 support, which was broken in the last ACE
release. Specifically
051128c16f (diff-502b909e9de186749df3051f8d4bfa42L137)

Bug: 64559
Change-Id: I0765c5f95de81a5ce9632f6eb5422b98c02941ff
2014-04-29 11:03:14 +02:00
jenkins-bot 0343d914c3 Merge "Add a status bar to the CodeEditor" 2014-04-22 17:37:11 +00:00
Derk-Jan Hartman 0759a6de4f Allow the CodeEditor in read only mode
Depends on: I6885d617e18562acf0331e8db5790b53b489dbc2
Bug: 45258
Change-Id: Ie69e9c33bc307ec34abb7dcf3f427cfbe407fde3
2014-04-16 23:54:01 +02:00
Derk-Jan Hartman 00905d1829 Add a status bar to the CodeEditor
- Show counts of errors/warnings/info annotations. This is useful
  because the annotations are in the gutter, so in big files it takes
  a lot of scrolling to look for errors
- Clicking the totals count skips you to the 'next' annotation
- If the current line contains an error, show the message of the error
  in the status bar.
- Show the current line:column number, the selection range and the
  editor mode.
- Degrades to a useful and readable but not pretty state in IE7

More complex version of: Ib9f08fcbc0365302756095b9027289736856fc73

Bug: 63294
Change-Id: Ided0804d5eb7864452287087dd1cf5a3dd8ff078
2014-04-14 09:46:55 +02:00
Derk-Jan Hartman 262bfde28e Ask for confirmation when saving document with errors
Bug: 63202
Change-Id: Ifbdf976f3c0f27da67d7cf034c040d4279d62217
2014-03-30 00:47:10 +01:00
Derk-Jan Hartman 03327915be Work around a problem with web workers in ACE
This will do for now, but we need a better fix upstream

Change-Id: I621066a4eb5ba1e14f92d2896852026d23b4be18
2014-03-25 10:59:08 -07:00
Derk-Jan Hartman 28c4b5ac10 Update ACE to Mar 16, 2014
This should be merged at the same time as it's followup patch, which
fixes an issue with loading webworkers when hosted on protocol
relative URLs.

Amongst other issues, it fixes bug 60156 with } pairing

Bug: 60156
Change-Id: I962c70ea2a07d27e0c3774095d63f9a5cd3de76e
2014-03-25 17:46:47 +00:00
helderwiki 6276431c6e Remove inexistent hook "LivePreviewPrepare"
This hook is never fired, therefore, per code review of
Ife952fc165dacea3ae7726e09bf61279f4bdae59 it should be
removed from CodeEditor.

Bug: 47235
Bug: 52071
Change-Id: Ic9dd9066f7d1676f45381cb6796425f13490fea3
2014-03-19 20:21:04 +00:00
Derk-Jan Hartman d0ec3d6982 Fix JSHint for CodeEditor
Change-Id: Iaf5c1fde6e002ea31eeef88f1963090e14784a7a
2014-03-17 00:28:35 +01:00
Derk-Jan Hartman b50d6d2fc7 Revert "Update ACE to Jan 17, 2014"
The update throws an error for the workers. Better we revert this for
now.

This reverts commit c2eed4f0e6.

Change-Id: I7090b833dc41a25a2c360113c10717055c003330
2014-01-22 16:29:24 -08:00
jenkins-bot 0b9626eab3 Merge "Update ACE to Jan 17, 2014" 2014-01-19 07:37:14 +00:00
Derk-Jan Hartman c2eed4f0e6 Update ACE to Jan 17, 2014
This fixes a breakage with } pairing
Also adds support for CORS loading of the workers.

Bug: 60156
Change-Id: I7333a107b49bb6aec0f91f443f5823e82a327fab
2014-01-18 01:49:45 +01:00
Derk-Jan Hartman 2de765b86c JSHint: fix the last jslint/hint failures
Change-Id: I3695d0da964ee607d91510c490793aca1ace5d58
2014-01-11 12:11:57 +01:00
Derk-Jan Hartman 85fdb01d00 Enable ACE webworkers
Now that the RL path is set correctly we can enable the webworkers
This adds syntax checker and linting

Change-Id: Ie9177d4acae45f2aadb1dfd3e66049195056bca0
2014-01-11 08:39:31 +00:00
Derk-Jan Hartman a6e4d82b58 Remove extraneous border in CodeEditor
Change-Id: Iedfed3e8722cb8440797d692739322d7fdf05b43
2014-01-09 22:26:19 +01:00
Derk-Jan Hartman 62da94ce68 Remove trailing commas
Also submitted upstream as:
https://github.com/ajaxorg/ace/pull/1742

Change-Id: Ia71b4e35a7168ea4c437ae728de71e5b0fe03bbe
2014-01-09 18:01:43 +00:00
Derk-Jan Hartman 05e6be051c CodeEditor: Update to package 12.02.2013 (December 2013)
ACE defaults to a white background now. I have no preference in
this, but it is caused by a change in the TextMate theme. There is a
bugreport (Bug 55423) about the old blue background.

This fixes an annoying problem with Safari 7, where characters are no
longer properly measured by ACE.
https://github.com/ajaxorg/ace/issues/1534

Fixes double-click to select:
https://github.com/ajaxorg/ace/issues/956

Set proper basePath so that require works, allowing conditional loading
of ACE resources. Need for Find to work after this update

Bug: 55423
Bug: 45876
Bug: 58521
Change-Id: Ia64b67b4553f77c6ba3d2aefec4bab62d111deb7
2014-01-02 11:11:32 +01:00
Siebrand Mazeland daf1aee4e8 Combine var statements
Change-Id: If005690ab8ecf21e64399781acbecd1ec3b02172
2013-12-31 18:44:56 +01:00
Siebrand Mazeland 2d121364d3 Update formatting of JavaScript files
Change-Id: I7a18b7f76f7c0a064645f23974f1fe09dafc4ca2
2013-12-31 13:03:11 +01:00
Siebrand Mazeland 37e2ec1286 Fix some JSHint issues
Change-Id: I46ae3ce2f39b35af6d75a94b5132eea0e6672064
2013-12-31 12:58:35 +01:00
jenkins-bot 2ce7afebbd Merge "Explicit dir="ltr" for code" 2013-08-26 20:47:32 +00:00
Krenair 7a9b6a5168 Save real tabs and allow configuration by users via JS hook
Bug: 39616
Change-Id: I64c3b9b53f1265f5b9c19edb480040113fa85590
2013-08-25 18:45:16 +01:00
Amir E. Aharoni 54c5b35bc3 Explicit dir="ltr" for code
Change-Id: Ia7d6958a10481c39abb1406b67210cac998818e7
2013-08-24 11:19:30 +03:00
MatmaRex d841459c2e Adjust after changes in core
I6a6c12a9, Id27555c6.

Change-Id: I2e93cfffd7b31b090c93f7911e1e45f2a6619371
2013-05-17 22:04:51 +02:00
Brad Jorsch b802deafbf Make CodeEditor cooperate with the experimental live preview
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
2013-05-07 11:08:47 -04:00
Ori Livneh 8ee19004b3 Disable background linting using WebWorkers
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
2013-02-14 19:05:45 -08:00
Ori Livneh 4ae61874af (Bug 42561) Enable Ace's JSON mode
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
2012-12-01 01:09:55 -08:00
Tim Starling 4fb277c607 Fix unbind call in disableCodeEditor
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
2012-07-13 16:31:23 +10:00
Tim Starling 4bb8a4c984 Updated Ace
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
2012-07-09 02:13:50 +00:00
Tim Starling 84cdb4f4bf Remove automatic edit summary
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
2012-07-03 13:19:56 +10:00
Tim Starling 8fe95e1469 Fixed a couple of minor issues in r115010:
* 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.
2012-04-23 11:40:43 +00:00
Tim Starling 7fc4552a8d Allow links to specific lines of code using a special fragment syntax 2012-04-23 04:09:47 +00:00
vvv 0ac1a47dbb * Update the list of the languages
* Make the language to be used determined on server side
* Allow extension to enable code editor for certain pages
2012-02-06 21:59:13 +00:00
vvv ea66677b66 * Update Ace
* Fix JS code in order to make Ace work with new updates
2012-02-06 20:59:17 +00:00
Sam Reed 2d686fcbb5 Swap
/*
 *

for

/**
 *
2011-10-26 03:49:06 +00:00
Brion Vibber bf67581924 CodeEditor ext: Add an experimental demo (off by default) mode to edit SyntaxHighlight_GeSHi sections inline using Ace editor
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.
2011-08-04 22:33:59 +00:00
Brion Vibber 67cc93c468 CodeEditor ext: Update Ace editor to upstream 237c2243734b7968e39bf3c97fa5bb3b26a920c4
Fixes issues with control keys: https://github.com/ajaxorg/ace/issues/294
2011-08-02 14:37:03 +00:00
Brion Vibber 852e1ee551 Fix for CodeEditor's form submit handler; unbind the handler when we disable the editor, and rebind it when we enabled it. Prevents sometimes failing to copy in updates properly or failing during save because an obj is unavailable. 2011-06-17 20:56:34 +00:00