Commit graph

33 commits

Author SHA1 Message Date
David Lynch 239aa714fa Edit check: fix an error when drawing selections
Follow-up to 793a1364aa

Change-Id: Ieb4f30ba2fe37fdca8cad559d3e4211c83642a5c
2024-11-10 23:19:13 -06:00
Ed Sanders 793a1364aa Allow multiple highlight fragments to be passed to an edit check
Change-Id: Ie9d7010a1a0ee6a5c570d4fd6988fc876afdb9e2
2024-11-05 11:41:50 +00:00
Ed Sanders f3930e7e12 EditCheck: Use getLinearFragment shortcut
Change-Id: I53859c24567e01e24ff46a88799ee0edadbd8e1b
2024-10-30 20:28:14 +00:00
Ed Sanders d06e9dbc31 Update VE core submodule to master (0e82a6db8)
New changes:
db0f21d03 ve.ce.Surface: Check dataTransfer.files is non-empty
e1cd78933 [BREAKING CHANGE] Move selection handling code to SelectionManager
b4b63a463 Move drag/drop handling code to DragDropHandler
540272769 Use the onPaste handler for dropped content
d3f9d8485 ClipboardHandler tests: Run tests in series
1232c0420 Tests: Introduce ve.dm.example.annotateText to simplify runs of annotated text
69d7ca482 Apply an annotation to imported (pasted/dropped) text
0e82a6db8 ve.ce.ClipboardHandler: Fix async test running

Added files:
- src/ce/annotations/ve.ce.ImportedDataAnnotation.js
- src/ce/ve.ce.DragDropHandler.js
- src/ce/ve.ce.SelectionManager.js
- src/dm/annotations/ve.dm.ImportedDataAnnotation.js
- tests/ce/ve.ce.DragDropHandler.test.js

Local changes:
- Implement new selection manager architecture

Added files:
- src/ce/annotations/ve.ce.ImportedDataAnnotation.js
- src/ce/ve.ce.DragDropHandler.js
- src/ce/ve.ce.SelectionManager.js
- src/dm/annotations/ve.dm.ImportedDataAnnotation.js
- tests/ce/ve.ce.DragDropHandler.test.js

Bug: T371996
Bug: T377427
Bug: T78696
Change-Id: If8d38246badf919c32915beda7c9a14f16e62a8a
2024-10-30 17:52:56 +00:00
Ed Sanders cf8a08f76c editcheck: Remove try/catch around transaction squashing
According to T333710 we haven't seen an error in the last year.

Change-Id: I7ee3447674cdda8a4350b6cf10d5d907c2162e2e
2024-10-17 17:10:02 +01:00
Ed Sanders 4cd67004de editcheck: Remove mw.editcheck.Diff
This object just contained a pointer to the surface and dm,
and had one utility method.

Move the method to mw.editcheck, and pass around a surface model
or document model to other methods as appropriate.

Change-Id: Ie81d76dea2823b633328f982ee20027808bfc8e3
2024-10-17 17:10:02 +01:00
Ed Sanders f91c62c0eb editcheck: Rename shouldApplyToSection to isRangeInValidSection
Also refactor the loop at the end, and reorder arguments.

Change-Id: I378e5103889dd57b29948c932389e3dfa071255f
2024-10-17 17:10:02 +01:00
Ed Sanders 0cfeb76abc editcheck: Move adjustForPunctuation to AddReferenceEditCheck
This method is highly specific to reference insertion. If we ever need
it for another check it can be moved back with a more specific name.

Change-Id: Ia629c8672281f33d45ea1fff6630af9bd331d80e
2024-10-17 17:10:02 +01:00
Ed Sanders de70933dca editcheck: Document some methods and improve some APIs
* Pass just the ve.dm.Document to shouldApplyToSection, instead
  of the whole diff.
* Do the quicker range check first in getModifiedRangesFromDiff

Change-Id: I1bda3a77c1c51f50fd7baadaa3619cf6719a073a
2024-10-17 17:10:02 +01:00
David Lynch 0c91e1795c Edit check: only count ChecksAvailable after the check for source-mode
Change-Id: I96091963af56a40d94445d7b65eb5c35326d0403
2024-09-18 10:26:50 -05:00
David Lynch 709e791acd Edit check: let ecenable bypass the account age requirement
Clean up accountShouldSeeEditCheck since nothing is calling it but the
new method inside BaseEditCheck

Follow-up to e947e53f98

Change-Id: Ic55187bb77f5ef003369313b76a65897fb3be392
2024-09-09 10:52:50 -05:00
David Lynch e947e53f98 Edit check: stop from appearing outside the main namespace
This was accidentally removed in d69d366469 during its refactor.

Because of the change to how checks are decided to be shown, I've made
AddReferenceEditCheck always be required -- later code in
hasAddedContentNeedingReference assumes that it's loaded anyway, so a
wiki deciding to configure it to not load at all for some account types
would have broken saving.

Bug: T373692
Change-Id: I007cd705451581ebacfa12e8ac5502bd1bc56a38
2024-09-04 10:33:22 -05:00
David Lynch 16c2dd919b Edit check: center the text in the proofreading toolbar
Bug: T341308
Change-Id: I5e12cefe690c2b9fba7cd7998a11723931575465
2024-08-22 01:23:27 -05:00
David Lynch 65b695ea2f Edit check: another counter for the save process
preSaveChecksShown + preSaveChecksNotShown = preSaveChecksAvailable
allowing us to use simple stat counters to detect errors in check
generation.

Follow-up to 57daf35bd6

Change-Id: I0586b766b5beec3bd059c90875ad0e2d1f092fab
2024-08-07 21:01:17 -05:00
David Lynch 57daf35bd6 Edit check: some simple counters for steps in the process
Change-Id: Iac0faea1f06eb30ac075a702cdcaaec29e0fbaf0
2024-08-01 11:21:46 -05:00
David Lynch 58e82f36aa EditCheckInspector: initially disable the continue action on mobile
This would cause an error if the continue action was chosen before
selecting an item in the list.

Change-Id: Ic1eb66caff112c09bb60b31a7221c48e2962b3d8
2024-06-27 23:24:10 -05:00
David Lynch 955bfc4b68 findAddedContentNeedingReference was removed accidentally
Replace it with a hasAddedContentNeedingReference that'll need to be
kept in-sync with the internal logic in AddReferenceEditCheck while
we're tagging this.

Follow-up to d69d366469.

Bug: T367920
Change-Id: I9f4f96bf5c6c4b7b3131b1435426b2e283c9833a
2024-06-18 16:12:30 -05:00
jenkins-bot b97d66d149 Merge "EditCheck: Use sourceType:commonjs in ESLint" 2024-06-17 17:53:50 +00:00
Ed Sanders 9a87e1157f EditCheck: Use sourceType:commonjs in ESLint
Change-Id: I0dd72a0129d6f991966a34a502f5a41aab5a154d
2024-06-14 16:25:51 +01:00
David Lynch d69d366469 Edit check API
Change-Id: Ic5504eb2fe8d1d3f22e88abe1dd88790bdfd8b9c
2024-06-12 11:01:04 +01:00
David Lynch d0a57f5197 Add code to support showing multiple checks in pre-save workflow
Leave the feature disabled for now.

Change-Id: Id70762a887c57d9255df22d50bf7badad89040de
2024-06-12 11:01:04 +01:00
Ed Sanders 291844dbee build: Update stylelint-config-wikimedia to 0.17.1
Change-Id: I8e0f087ae3d2644df85a85791b9c49c09567c0f4
2024-06-05 18:47:49 +01:00
Ed Sanders dbc696124f ESLint: Enforce no-var and autofix
Temporarily disable prefer-const as this requires
manual fixing.

Change-Id: I477b69a57e8d33535c6fc71dba196a8605780725
2024-05-21 17:40:52 +01:00
jenkins-bot f95f6768fc Merge "Disable eslint security regexp warnings" 2024-05-09 16:33:35 +00:00
Ed Sanders 1980827aec Use arrow callbacks in other modules
Change-Id: Ib07720923de6657ae55ac29a07c5cc85b088a70d
2024-05-09 10:33:44 +01:00
Bartosz Dziewoński 12613a6ad0 Disable eslint security regexp warnings
They generate a lot of false positives in this extension.

Since this is client-side code, the worst that could happen is a
browser tab hanging, not any real security issues.

Change-Id: I177cfa7e57a6b7b528d558d2cba076e85fd0271f
2024-05-07 20:54:42 +02:00
Ed Sanders e3659d4846 Prefer arrow callbacks
Change-Id: Ia05b27f7c71c33580ffd0718e3bbc673dd8b3d63
2024-05-01 14:11:54 +01:00
Ed Sanders 45ff962bcd EditCheck: Fix the colour of the popup widget anchor
When EditCheck is the first item in the menu, make the
anchor pink as well.

Relies on the :has selector in modern browsers.

Change-Id: I66e760742da25b3797529b0c65a8d90871a0a1da
2024-03-12 17:25:49 -07:00
David Lynch 9c7f772d4f Only activate edit check in visual mode
Change-Id: I9b2dac998cd33a855f56e91c77332ef6ae156f7d
2024-02-15 12:20:03 -06:00
David Lynch 5d6463ebba Edit check config for whether to ignore references in certain sections
Adds two new configs:
* ignoreSections, array of section names that'll be compared
* ignoreLeadSection, bool for whether to ignore the lead section

Bug: T346949
Depends-On: I7ded925b91b1d86b3c76c4135c85a3f0be1dee5e
Change-Id: I44f18fadcafbe011008d8abff566e2ccd7682f4f
2023-12-05 15:47:17 +00:00
Ed Sanders d42a0772bb Move verbose copyright message to AUTHORS.txt
Avoids having to update the date in every file every year,
which we stopped doing.

Change-Id: I7bf7aa0937eef911e00772470091753a7b06fd3d
2023-12-01 16:07:39 +00:00
David Lynch 094c007df0 Allow a global variable to forcible enable edit check
The URL parameter turns out to be a bit painful for people to use in
some situations.

Bug: T350749
Change-Id: I7c88dc604dd321a7c78810b21f7ad8306ff9dab6
2023-11-30 10:27:50 +00:00
Ed Sanders 876a947a7b Move EditCheck files to ./editcheck and structure as a sub-extension
Change-Id: I4085223a93b37e601b3627fc2d6db7978cac820e
2023-11-28 15:56:43 +00:00