This uses JS to figure out if the user is currently in dark mode and set
the Ace theme accordingly. This means the theme doesn't reconfigure if
the user or the OS switches dark mode on/off while CodeEditor is open,
but this is better than nothing.
Ace theme 'monokai' is used for dark mode, and 'textmate' is used for
light mode, as before.
Bug: T375982
Change-Id: Icd683ee51cb86b3352d8f23f652b4ce7a6174b4d
Also move to modules/lib/ like in other repos. As we're using the build
step rather than a direct release, let's leave it as doc-only, but this
at least makes the process more clear.
Also add the README.md and CHANGELOG.md files like we do for others.
Change-Id: I3566e8271ce37807f7d24867680d8229aa97302b
Style the textbox to mimic when CodeEditor is enabled only if
"usecodeeditor" is set, and only before CodeEditor is loaded (I0ce663e
added a gutter even when CodeEditor was turned off, which no one asked
for).
.wikiEditor-ui-text is added client-side, so there's no point in styling
it.
Bug: T351487
Change-Id: I3918e1c120805ca007e8e7eb7e29304ddbb6af56
When the Edit Recovery loading process is finished, add an Ace
editor change handler so that the Edit Recovery fields are saved
whenever there's a change to the CodeEditor data.
This is similar to the change made for CodeMirror:
I352470752130c7b9b2dfc55a066cecf785d40067
Bug: T344406
Change-Id: I2c7826379108a88be7956d84bbfd3200b5ad542f
It was pointed out in the review of Ie3ed681b that the naive fallback
for replaceSelection() was not working because CodeEditor only had a
stub getCaretPosition() implementation. So, let's implement that as well
in case people want to use it. It seems to work reasonably well locally
with the native replaceSelection() disabled.
Bug: T342127
Change-Id: I8d3683808394faefa56c7cdff31dc18978c4dd92
The $.textSelection() facade in CodeEditor is missing a
replaceSelection() implementation. This causes $.textSelection() to
fall back to a naive implementation, which does not work, thus breaking
any gadget or extension that tries to interact with CodeEditor using
this method. As a fix, provide a native replaceSelection()
implementation that calls the appropriate ACE editor method:
Bug: T342127
Change-Id: Ie3ed681b39c5d4d2bed50030a397a2b1c877c9fb
mw.Api#saveOptions will skip the API call and return a 'notloggedin'
error when the current user is not registered.
To handle temporary users as well, just fall back to that behaviour
instead of being explicit, and the right thing will also happen
(probably it will return an error, although the behaviour may change).
Bug: T332430
Change-Id: I4aafd6f74b74971c52b6222f8ec97a4963bb6a7b
I263e08a397 overrode linter options set by Ace worker, such as ES6 and
browser globals. Using changeOptions instead of setOptions avoids this.
Bug: T1092
Change-Id: I31ba98a7a04063df175ed3188fed3a8ef1a2dab0
The linter would bail after 100 detected issues (alerting or not) and
would report the warning 'too many errors (xx% scanned)'
Set a higher limit. 1000 seems enough for navigation popups gadget.
Bug: T1092
Change-Id: I263e08a39712279a06b12cd75ebedcccaf191b58
Now toggleSearchReplace() actually looks at the visibility of the search
box, instead of keeping a boolean, to decide whether to show or hide the
box, in case it was opened by Ctrl-F or closed by Esc or clicking X. So
the button itself is no longer a toggle, but a simple action button. In
addition, it now uses Ace's native replace command instead of
reinventing the wheel. Ace no longer hijacks Ctrl-R and with this Ctrl-H
now works.
Bug: T102486
Change-Id: I6bead1b3209e08a46e31ed3f30c61ca52152b688
Set a specific WikiEditor version dependency of 0.5.2.
Bug: T198781
Change-Id: I6664a7ff2383d83c7d0fa1fd45e2539fad40c1d0
Depends-On: I8b7fd41571a48fa4f6560790d94bb966972e740f
* Use upstream icons where available
* Move extra icons into a ResourceLoaderImageModule
Depends-On: I3e6f65f6f290778d3fbfa22f5d212c26fee12a86
Change-Id: I61cd750613922e58cec18a2886609f20e73f4a61
Since 84926bbd33, WikiEditor doesn't check browser support (because all
supported browsers by MediaWiki exceed these requirements).
Change-Id: I778dcfa75bb0b8a5a530c164e5b908b213d59afe
A recent core change caused zero-valued preferences to start being
returned as numeric 0 rather than string 0. See the linked bug for
details.
Bug: T161875
Change-Id: I183fd9944e65041b0a330725c41fec2b59ca8379
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
* 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
The delayed update of the status bar fails when the CodeEditor is disabled
in the meantime.
Bug: T119869
Change-Id: I6b23148f7a3d79021b87ad5f0f537eda9b68970f
This requires jQuery >= 1.6. This is included in MediaWiki >= 1.18.
This change drops support for MediaWiki 1.17.
Change-Id: I12f3f3e22d9bc47a0a2d9a9d201af4e44012e0a2
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