Commit graph

166 commits

Author SHA1 Message Date
Siddharth VP 1b52f36c7b Configure JSHint to recognize MediaWiki environment globals
Bug: T373068
Change-Id: Ifaa994b4c844ec29aa77182af7159c9bdcdc2441
2024-10-20 13:48:58 +05:30
Siddharth VP 8b7b17f9ee Support dark mode in CodeEditor
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
2024-09-30 00:26:39 +05:30
Siddharth VP 0fd08102b5 status: replace hardcoded colors with corresponding Codex tokens
This fixes text in the status bar displaying white-on-white while in
dark mode.

Bug: T372288
Change-Id: I6a2efbc2f16b7edbfdf6ef79b9a497e187de654f
2024-09-30 00:26:24 +05:30
libraryupgrader faf23a2fa3 build: Updating npm dependencies
* eslint-config-wikimedia: 0.28.0 → 0.28.2
  The following rules are failing and were disabled:
  * modules:
    * es-x/no-object-assign

* grunt-stylelint: 0.20.0 → 0.20.1
* stylelint-config-wikimedia: 0.17.1 → 0.17.2

Change-Id: Ic603e46d510db344805408a972355249455a177e
2024-06-20 05:06:27 +00:00
libraryupgrader 7a396da3a1 build: Updating npm dependencies
* eslint-config-wikimedia: 0.27.0 → 0.28.0
  The following rules are failing and were disabled:
  * modules:
    * no-jquery/no-extend

* grunt-stylelint: 0.19.0 → 0.20.0
* stylelint-config-wikimedia: 0.16.1 → 0.17.1

Change-Id: Ifbde191e4d9155dbecc9c395dd89ec06c91c356a
2024-06-06 05:33:43 +00:00
James D. Forrester 3bb1c3173f Upgrade Ace from 1.15.2 to 1.32.7
Steps, so that others can know how to upgrade later:
* Alter entry in package.json and run `npm i` and then `npx grunt update-ace` to update.
* Test locally for CSS, JS, and JSON pages (as the most-affected types).
* Verify code diffs and add to git staging manually.
* Update foreign-resources.yaml entry manually.

Bug: T342387
Change-Id: I3566e8271ce37807f7d24867680d8229aa97302c
2024-03-15 16:32:40 -04:00
James D. Forrester 46ee5c493b Register Ace as a foreign resource, move credits link to that library
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
2024-03-15 16:32:36 -04:00
jenkins-bot 8565e167d7 Merge "Avoid FOUCs more flexibly" 2024-02-23 19:34:37 +00:00
Nardog 1e646acfdb Avoid FOUCs more flexibly
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
2024-02-22 18:33:14 +00:00
Nardog d798a5ad6c Update toolbar group hiding logic
Accommodate upstream change in WikiEditor (Iff6d806).

Bug: T357222
Change-Id: I10e06d129677e7ac40199a31e4bad7914dda993c
2024-02-11 00:51:18 +00:00
Fomafix b3279e4382 Remove outdated comments about known issues
On tab close on Firefox there is a 'discard your changes?' dialog.

On preview the cursor/scroll position is still on the same position.
Just the focus is not in the textarea, but this in WikiEditor, too.

Change-Id: I0d7b59c39381cdc7da72c0a6c366d74071f7ef54
2023-12-29 10:26:21 +00:00
Ed Sanders 1528c7740f build: Update linters
Change-Id: Idaed1bf627d8d92968b422ad428acd29a179d94a
2023-12-18 17:09:57 +00:00
Ed Sanders 9111107de8 CodeEditor: Avoid movement while loading
Bug: T73015
Change-Id: I0ce663ebad4bb9ab9f435aeba65c545ee21e0680
2023-10-15 07:21:36 +00:00
Sam Wilson f7a7c7afea Add change handler for Edit Recovery
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
2023-09-20 16:15:52 +08:00
Máté Szabó a6030db858 Follow-up Ie3ed681b: Unstub getCaretPosition() as well
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
2023-07-21 14:45:41 +02:00
Máté Szabó 2f7ce4dd50 Add explicit replaceSelection() implementation
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
2023-07-18 16:38:55 +02:00
Jon Harald Søby 075cfc12e4 Remove use of autoMsg in favour of using mw.message directly
Use mw.message directly instead of relying on WikiEditor's
<key>Msg feature.

Bug: T154891
Change-Id: Ifc9016ecd35cb0d8bbbf858b704cb0b574e38f56
2023-07-05 02:03:55 +02:00
Bartosz Dziewoński 62c3d99a7f Use core behaviour regarding saving options for non-registered users
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
2023-03-17 20:33:43 +01:00
David Lynch 333d8b94b7 Update Ace to 1.15.2
- Fix line height regression

Bug: T329686
Change-Id: Ia381d0ba3314a2d879dd18a3bf44f81d4e623b6a
2023-02-21 13:53:16 -06:00
Derk-Jan Hartman 941cc7c109 Update Ace to 1.14.0
- Improved ES6 support

Bug: T324609
Change-Id: I22234ee259c2663a511f9285d4c43d4256e29c66
2023-01-16 23:26:34 +01:00
Nardog a2199fe310 Configure JS linter without overriding safe options
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
2022-12-19 12:45:35 +09:00
Derk-Jan Hartman 177142940d Configure JS linter to handle more lines
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
2022-05-30 21:12:19 +00:00
Ed Sanders 2479c7f1bb eslint: Lint Gruntile.js using server rules
Change-Id: I9e452fc08ae483431ad83dca3c7ebd7f04f5d945
2022-02-07 16:22:02 +00:00
Ed Sanders 17e04cab5e Move var declarations inline
Change-Id: Iccad0c3bf194f8fa418181283ac3b2a037fabe5f
2021-10-06 18:00:20 +01:00
Nardog 86e79cdaf3 Improve accuracy of the search/replace toggle
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
2021-03-25 20:11:52 +00:00
Umherirrender b2aeedd34a Move images folder into modules folder
All resources needed by client should in one folder

Change-Id: Ib9f6ea7bb59f2b5b8115c381290032170d482a98
2021-03-12 20:09:55 +01:00
Ed Sanders ccb909be60 De-emphasise line numbers
Bug: T271956
Change-Id: I336e7a319a7a4eb5f6fc9f07b149d584a15c73c4
2021-01-13 17:07:02 +00:00
Ed Sanders 56d6d1598a Update Ace 1.4.9 -> 1.4.12
2020.07.06 Version 1.4.12
* removed unused es5-shim
* imporved ruby and vbscript highlighting and folding
* workaround for double space being converted to dot on mobile keyboards

2020.04.15 Version 1.4.10
* added workaround for chrome bug causing memory leak after calling editor.destroy
* added code folding support for vbscript mode

Change-Id: I7b2531b1d5571eac15549d58a8295bcf167acd43
2020-08-12 13:22:05 +01:00
Ed Sanders d4cc23f606 Update ace-build 1.2.9 -> 1.4.9 and recompile
Change-Id: I31eeb56eec4995e1bff8248e5c1d4df7f20ad48b
2020-04-14 14:30:34 -07:00
Timo Tijhof c0c70a2312 Remove use of jquery.ui module aliases
Bug: T219604
Change-Id: Ia639ca6728ac23c14fa5b1a21317ddd3220c3727
2019-11-26 20:06:59 +00:00
Ed Sanders c4bc2c7d36 build: Update linters
Change-Id: I0c7b153461300840deb75c695f893b3b4a778dcf
2019-11-15 16:40:39 +00:00
Ammar 3eb4ef07de Fix typo in comments
"Seperately" → Separately

Bug: T201491
Change-Id: Ib7ce92f36db5abe447e38cda513acb580fab9007
2019-10-07 04:59:58 +01:00
Ed Sanders 5cac43ddd3 build: Update eslint-config-wikimedia to 0.11.0
Change-Id: I99fd10fbcce5d5e6b87b6e3faeb7b18c4e573ef7
2019-03-13 22:38:54 +00:00
Ed Sanders 4ad54da406 build: Update linters
Change-Id: I9baecb9fd4b9d9bf86897ccec8289614b136c3a2
2018-12-10 13:31:37 +00:00
Ed Sanders 8c6473826a Remove obsolete aliases from closures
Bug: T208951
Change-Id: Ib3502d54c39e65c2aed38f7e630a8b8286d522c2
2018-11-12 13:16:11 +00:00
Derk-Jan Hartman e8fbe62ef0 Make use of new WikiEditor 2010 toggle tool
Set a specific WikiEditor version dependency of 0.5.2.

Bug: T198781
Change-Id: I6664a7ff2383d83c7d0fa1fd45e2539fad40c1d0
Depends-On: I8b7fd41571a48fa4f6560790d94bb966972e740f
2018-08-17 11:22:36 -07:00
Volker E 75d8b4c112 Replace deprecated OOUI 'find' icon with 'articleSearch' of 'content' pack
Depends-on: I41c3d5502ff58f72bf7441811eaf17702468469b
Bug: T183645
Change-Id: I0535b667084771ecff3a4c0e14616fc9ee586895
2018-04-02 14:26:48 -07:00
jenkins-bot 54be8e3e2b Merge "Use OOUI icons" 2018-03-24 17:47:16 +00:00
Ed Sanders 819c6e1c82 Use OOUI icons
* Use upstream icons where available
* Move extra icons into a ResourceLoaderImageModule

Depends-On: I3e6f65f6f290778d3fbfa22f5d212c26fee12a86
Change-Id: I61cd750613922e58cec18a2886609f20e73f4a61
2018-03-23 22:51:35 +00:00
jenkins-bot 736eb68e21 Merge "Remove browser support comments" 2018-03-21 23:40:07 +00:00
Ed Sanders af94c2b052 Remove browser support comments
* "Tested with" should be assumed to be Grade A browsers
* "Browsers with issues" are all no longer supported

Change-Id: I942ed087636ad8e5f74cd131132909e7434bd957
2018-03-21 23:18:27 +00:00
Ed Sanders d278279abd Remove comment about resolved upstream issue
Change-Id: Ia92bb37bca7613049d9f3cd3601b78864c303d48
2018-03-21 23:18:23 +00:00
Ed Sanders 3d8950e7b7 Remove unused browser matrix
Since 84926bbd33, WikiEditor doesn't check browser support (because all
supported browsers by MediaWiki exceed these requirements).

Change-Id: I778dcfa75bb0b8a5a530c164e5b908b213d59afe
2018-02-13 19:13:27 +00:00
jenkins-bot d2b0b100f4 Merge "Use correct directionality for nested inputs (e.g. find & replace)" 2018-02-02 18:41:05 +00:00
Ed Sanders c56ec08a14 Use correct directionality for nested inputs (e.g. find & replace)
Bug: T186329
Change-Id: I08cb77aa45378dd21cc2176205d3eaad84469db1
2018-02-02 16:14:21 +00:00
James D. Forrester 85536550c3 Remove reference to mw-editButtons-pipe-separator, now removed from MW
Change-Id: Ia214c25b1ca65f6998da9de0949034829d9959d5
2018-01-10 14:29:04 -08:00
Ed Sanders 14df929c95 Match font and size to other source editors
All of our other source editors (2003/06/10/17) use the
editfont classes.

Change-Id: Ic9f31eadaefba1af0c1d75171a46218abbd8bc88
2018-01-04 12:33:48 +00:00
James D. Forrester 7629004d05 build: Bump various devDependencies to latest
eslint-config-wikimedia   0.4.0  →   0.5.0
 grunt-banana-checker      0.5.0  →   0.6.0
 grunt-eslint             19.0.0  →  20.1.0
 grunt-stylelint           0.6.0  →   0.8.0

Change-Id: Ia01949112243c5a496896c0a3a5eda261e0f66bd
2017-10-25 10:54:00 -07:00
Ed Sanders bbe14dbc2b Remove deprecated methods
Change-Id: Ib81592b4a13528a5ecf30d8a5cebbacae20be189
Depends-On: I3b900116ce2dc44338451c07ecdc419bad82014b
2017-10-12 16:03:54 +01:00
James D. Forrester dd8daf7d22 Hide MediaWiki's "Edit help" links which aren't relevant to non-wikitext content
Copied from WikiEditor.

Bug: T173715
Change-Id: If3234240ec8530dafd6cf0faaa2fba31e09e1a89
2017-08-28 14:08:23 +00:00