Commit graph

41 commits

Author SHA1 Message Date
Ed Sanders 1e6968b5c0 ve-cite: Ensure references are always unique by generating originalDomElementsHash
This is a bit of an abuse of the originalDomElementsHash property.
In future we could add a 'uniqueId' attribute, but this would need
to be ignored in a few places in core.

Bug: T299378
Change-Id: I7d1eb362aeb74ba93f5225330226a95535746b92
2022-01-27 01:14:52 +00:00
Ed Sanders a2c927f8b8 ve-cite: Handle ref nodes with mw:Error RDFa
Bug: T299378
Bug: T299672
Change-Id: I7bc7dfb4fb9c0c9b140b793e6e0b2d00b7fe67e0
2022-01-21 00:00:34 +00:00
Ed Sanders 1a2ae0682f ve-cite: Use proper method for comparing linear data (attempt 2)
In Ifb0ba3caf8d we removed this reference equality check and replaced
it with a deep object comparison, however due to the fact that
hashes for MWReferenceNodes were simplified in I8c26686d7b to
improve visual diffs, this resulted in a overly simplified comparison
that couldn't distinguish references with the same "name".

Instead do a deep object comparions of the standard node hash object.

Tests added in Ia0bbd40528 assert that this doesn't result in the
regression that caused T296044.

Bug: T296086
Change-Id: I7b37fb54e14bfe28a07f722a2c45fd4e4a2d44f2
2021-11-19 14:24:42 +00:00
jenkins-bot ea7f9bf0d3 Merge "Revert "Use proper method for comparing linear data"" 2021-11-19 00:59:20 +00:00
Bartosz Dziewoński 4fcc4bc42d Revert "Use proper method for comparing linear data"
This reverts commit bad697bd32.

Bug: T296044
Change-Id: Ie442e482aa3b60754fe457d835c4cf6400f42d94
2021-11-19 00:35:28 +00:00
jenkins-bot cc111ca5fd Merge "Move eslint client config to modules, fix warnings" 2021-11-09 18:14:37 +00:00
jenkins-bot a11cf9858c Merge "Move var declarations inline" 2021-11-09 18:14:35 +00:00
jenkins-bot a90c67b6e8 Merge "Use proper method for comparing linear data" 2021-11-09 14:00:01 +00:00
Ed Sanders 0d4bb626f1 Move eslint client config to modules, fix warnings
Change-Id: I86857b82fa7d5c47c0056da4ad270fcb2a4d965f
2021-11-03 16:38:31 +00:00
Ed Sanders cf95dbd4be Move var declarations inline
Change-Id: I824a65e72a72e5acf65c54a63299469f7acb649d
2021-11-03 16:38:31 +00:00
Adam Wight 3c02ee38b2 Clean up javascript code smells
These were discovered using SonarCloud.

Change-Id: Ie36fa248e4b395bb97b8969ece6688ec055afb55
2021-11-03 12:28:07 +00:00
Ed Sanders bad697bd32 Use proper method for comparing linear data
Previously we checked the elements were reference-equal
which is fragile and breaks when linear data freezing is
enabled in debug mode.

Change-Id: Ifb0ba3caf8d3e5a67c9694358cac12cc412fe723
2021-11-02 23:15:13 +00:00
Ed Sanders c763fb5cc3 MWReferenceNode: Ignore changes to reference list index
This means that all reference nodes are treated as comparable
in the diff (provided they are in the same group) so will
not show up in the article diff if their index changes.

Changes to the reference list are already handled separately
by the visual diff.

Bug: T170235
Change-Id: I8c26686d7b2fe3bf91af7d4dcab1caf3247dbe47
2021-01-21 14:40:15 +00:00
Bartosz Dziewoński 72f79aae3b Add "reference" class to references in VisualEditor
* Add it to CE HTML, for compatibility with site styles.
* Add it to DM HTML of newly created references only. Existing
  references just use whatever classes we got from Parsoid, to avoid
  unnecessary DOM changes and dirty diffs.

Bug: T265930
Depends-On: I61a2132f3876e2d9567d985358f51eb51c479813
Change-Id: I9d6856f03071c09617b8ae7db938135a3e30fe8e
2020-11-06 18:04:13 +00:00
Ed Sanders 8e3bc8cb2c Match line-breaking whitespace in reference names
Bug: T263698
Change-Id: I436b0fbf1756e08fe9ff9013aff7479d5ec653f6
2020-09-24 20:29:00 +02:00
Ed Sanders e66dd259e6 ve.dm.Node: blacklistedAnnotationTypes -> disallowedAnnotationTypes
Bug: T254646
Change-Id: I38f8c1a8259c2ca1ae1ea4d4ce374fc39f46f676
Depends-On: I8e23231bf4ff4022a85b4dfe214184fbb3543fce
2020-06-12 10:13:19 +00:00
Ed Sanders 85a4e23008 build: Update devDependencies
Change-Id: I38b506d6e058f639e0e7d95c3e60616dbef5af10
2020-06-09 11:29:03 +01:00
Ed Sanders 2f3fc5594d Render placeholder citation as […] to show it isn't finished
Bug: T220502
Change-Id: I11f2aea22d9b9c83d7a642e86e0c2f4c2fb3a430
2019-04-23 14:34:43 +00:00
Ed Sanders 817bfbfa54 Avoid jQuery in ve.dm.Model.static.describeChange(s)
Change-Id: If30d12289eff66470044931ea5b38d2b81d04075
2018-09-28 10:55:45 +01:00
Thalia 2c77a9d66a Get document data using updated interface
Depends-On: Iea426be573f07c976b0c142357d5ed83e51db013
Depends-On: I36dad61ed614f007b16d7e9f47fcbfd02347f239
Change-Id: I9d9615f69d40822a72f31f0d86d7997dd0812523
2018-07-29 00:07:28 +00:00
Ed Sanders 3b53f6906b Use getHtmlMessage for DiffElement
Bug: T195243
Depends-On: Ib4ad16858e4241d33d018830dbcfded63ff703af
Depends-On: Ib5fa39e4f2f529948354b03a141542e23d169fe0
Change-Id: I4b01904d48a9520c8bb1451e0978aaa404ca858c
2018-06-20 15:31:46 +00:00
Ed Sanders 8487745c55 Don't compute ref contents in converter preview mode
Depends-On: I0f1b90056e9d1a4fa0e188700604709297593924
Change-Id: I7f98d7b6609c896f91a6d256d58aeb2ff53bc181
2018-04-30 17:47:43 +01:00
Thiemo Mättig bbc1f2c91d Use standard form for @license tags
See https://spdx.org/licenses/

Change-Id: Ic091ebc3844abcd6de90b3241382fb4732200a6d
2018-03-20 03:18:37 +00:00
David Chan 21e1fc5742 Follow-through rename of originalDomElementsIndex->originalDomElementsHash
Bug: T188900
Change-Id: If2b908acc634253c35b220f267bcca648f45310b
Depends-On: If60d0c637fe92f0e7afe916c064fafb17980d063
2018-03-06 21:00:35 +08:00
James D. Forrester be1f7c0b74 VisualEditor: Use reflist diff i18n for reflists and ref ones for refs
Change-Id: Ieb3f1a30c1777f11a7334423156df4c9fdb9d79f
2018-02-22 16:00:36 -08:00
jenkins-bot 6b1e7e126f Merge "doc: Bump copyright year" 2018-01-03 19:18:07 +00:00
James D. Forrester 0999d771b6 doc: Bump copyright year
Also make the overly-terse statement clearer.

Change-Id: I752bb82444bf7cb41480076bace42331dc35a598
2018-01-02 17:05:50 -08:00
Ed Sanders 366d44926a MWReferenceNode: Generate 'sup' tags by default
Bug: T45094
Change-Id: I8973328095f36cce2cebbf335ee7421187eedfad
2018-01-02 15:39:08 +00:00
Thalia ed8b563add VisualDiff: Show less information about ref nodes
If a ref node is highlighted as changed because its index
has changed (e.g. because an earlier reference was inserted
or removed), describe this more elegantly.

Bug: T170235
Bug: T171377
Change-Id: I2513bb82099a92529516e4e217e61a2d0a2dd43b
2017-09-05 14:01:39 +01:00
Thalia 1a5d90b4e3 Visual diff: Show correct reference indices in diff
Bug: T162819
Change-Id: I7eec4ee12a24ff99388cc0c95a24d50f321511f9
2017-06-26 19:19:03 +00:00
James D. Forrester 9a17d9342b Describe group changes for references and references lists
Bug: T160589
Change-Id: Ifccafdf08704f67027dae2703ff2ded809fb6ab7
2017-05-20 14:26:58 +00:00
jenkins-bot e5c5886287 Merge "doc: Bump copyright year notice, 'team' name" 2017-04-20 23:24:51 +00:00
David Lynch 4841b7496c MWReferenceNode: Don't try to remove from the internal list if it's not added
Recent changes to setRoot in ve core (719f8c667) cause unroot to occur at a
point we weren't expecting, when adding a new reference.

Bug: T163267
Change-Id: If02ea08bb8b6db3be41d51ab44ce2a74cfe07914
2017-04-20 18:18:19 +01:00
Ed Sanders 1fe0fb2e70 Only remove from internal list if unroot from correct document
Bug: T163267
Change-Id: I11ff56fbd437e46aab516a50235f8077eea0af5b
2017-04-20 18:18:02 +01:00
James D. Forrester 0d20873fa6 doc: Bump copyright year notice, 'team' name
Change-Id: Ia090c417a1aa716b255613199b5e49616bf0517a
2017-04-20 16:50:43 +00:00
Ed Sanders 61a624584b Send better HTML to the clipboard
Change-Id: Id8539697e6b30fd98e672452eda9b9c792c3c366
2017-03-20 13:42:03 +00:00
Ed Sanders 4c0e837dad Use stricter test for originalDomElementsIndex
Change-Id: I43a0f639fa50fb2bbe9f935dd141d595571d8e24
2016-11-02 12:51:10 +00:00
Ed Sanders f4240f13f9 Use 'super' to call parent methods
Change-Id: Iba051a1e84b2ea805d0b3795933587c735ec0d88
2016-11-02 12:43:14 +00:00
Ed Sanders fc4788d51b Move originalDomElements to IV store and use new hash
Depends-On: I8a71c1a40ec35108d0a9a388da6f75632f8dc53c
Depends-On: I0fbb6324eede94558426178cbdad6b5daf0f8318
Change-Id: I32c9b5f984fcf96e3354841ecfcd444149e8f159
2016-08-24 18:14:47 +00:00
Ed Sanders 06376669d9 ve.dm.MWReferenceNode: Override static cloneElement instead of getter
The getter isn't always used, but the static method is.

Change-Id: I9b3df7f4e8056cdb554c3ed9a27c39148b2b3237
2016-05-04 13:39:38 +00:00
Ed Sanders 18f616b9b8 VisualEditor: Move code for Cite into this repo
This code has been developed over three years now in the repo of MediaWiki's
integration of VisualEditor. It has grown and developed significantly during
that time, but now is pretty stable. A number of hacks inside the MediaWiki-
VisualEditor code base have been used to prevent this code from being loaded
on wikis where the Cite extension is not deployed, but this state of affairs
is and always was meant to be temporary.

This code is under the MIT licence which is a tad messy, but not impossible.
It's clearly labelled as such. The list of authors has been updated to take
into account the influx of new functionality.

Bug: T41621
Bug: T104928
Change-Id: I39936ed83d5a60471a0a75da753f498e80aef234
2016-02-04 08:41:54 -08:00