Commit graph

28 commits

Author SHA1 Message Date
thiemowmde ce63522726 Fix wrong "this reference is used twice" in VisualEditor
This patch also updates a second place that does almost the same.

That other place also excludes placeholders. We intentionally don't
do this in this new place.

Bug: T241885
Change-Id: Ib003b8a7bbe247db6f7da0a4efcfd4e5967fd033
2023-04-12 15:19:11 +02:00
Ed Sanders 59d900d951 ve-cite: Show $originalRefList even if there are no refs in the model
This original use case at T187495 is for he.wiki, where it is likely
that all the references are defined in templates, so the model
will always be empty, even though $originalRefList is populated.

Change-Id: Ia2785a20bf82ab97466276a57936bc9299e1cabe
2023-02-22 17:19:22 +00:00
Ed Sanders 84489c15b3 Don't attach DOM nodes from the DM store to the main document
Bug: T298147
Change-Id: I194ff1d576547dc717c523a490083fbcf903d87c
2021-12-21 20:32:05 +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
Bartosz Dziewoński 28a8739ce5 Show empty reflist message on initial load and after switching too
The message was only shown when a new reflist was inserted, or when
any references were changed.

Bug: T284472
Change-Id: I7c1e981c93bf7e163f9fb747aad30a24e9a497f1
2021-08-24 12:24:07 +02:00
Ed Sanders 299e5d3655 Avoid exceptions if node teardown happens before setup
Change-Id: I7f55091023a3c0e92ce216e51f24bbc423f136c7
2021-06-03 22:50:44 +01:00
Adam Wight fe7356622e Extract backlink formatting into a function
No-op, prepare for reusing this code in subreferences.

Bug: T243278
Change-Id: I8ad9778b0fecd462ff18eccbe86885dd6fc21c76
2020-01-24 09:03:17 +00:00
Thiemo Kreuz d622356a73 Remove dead extra comparison from VE JavaScript code
The first code snippet in this while already covers this case. The loop
will end the moment it can't find another parent any more.

This was found via
https://sonarcloud.io/project/issues?id=mediawiki-extensions-Cite&types=BUG
as a potential bug. After looking at the code I'm sure it's not one.

Change-Id: Id914252c88b27420dfa47dcc918fc58d9ee2a65d
2019-05-17 13:48:37 +00:00
Ed Sanders 475d825918 Use MWPreviewElement in view mode, instead of building a view node
Also "unwrap" paragraphs using CSS instead of DOM manipulation.

Change-Id: I5565c2c43580d5d47bc65ee06d9d14fccace90c6
Depends-On: Ibbf989dcebf2d21fd2ac481f17062f366ff29e41
Depends-On: I284bcd5dd25cdbb883427ebacb41af1bbf50b60f
2018-05-13 20:01:19 +01:00
Ed Sanders 2ae4cfe0ab Use ve.ce.nodeFactory.createFromModel
Also use ve.dm.nodeFactory.createFromElement

Depends-On: I259face33154b795143c8820abdfb6b4a495f141
Depends-On: I7fc539f75a1c9d672efc139b7884ecdfdff5f301
Change-Id: I032182616c409e65138b16fe7b238e7f7b3a8710
2018-05-11 17:08:12 +00:00
Thalia a2722ca947 Add separate message for missing reference in references list
Message indicates that a preview of the reference is missing,
instead of implying that the user was trying to edit it.

Bug: T188682
Change-Id: I5f5f8d5d0910ab2608696bbed380d4592cb6c7f1
2018-03-24 17:32:55 +00: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
Ed Sanders e8dd5fed93 MWReferencesListNode: Guard against run-after-teardown
Change-Id: Icea7580d04d7093ab2b27b2d757e625d7559b94c
2018-02-28 17:35:53 +00:00
jenkins-bot 1881fff06b Merge "Render reference list from originalDomElements until modified" 2018-02-26 17:22:26 +00:00
Ed Sanders caaa3551c4 Avoid jQuery.parseHTML
Bug: T187713
Change-Id: I1fd569ba0624d8d25c5ac89d35c27b1bdc2397a7
2018-02-19 12:20:21 +00:00
Ed Sanders f739008cbd Render reference list from originalDomElements until modified
This helps on wikis where there are no real refs because they
are template-generated, and is a performance improvement elsewhere
as re-rendering long ref lists can be slow.

Bug: T187495
Change-Id: I47a9206ff7ee61f8fd716dc7658b8bfad927f656
2018-02-15 21:20:16 +00:00
Ed Sanders f1d1cf38f5 Render ref list from CE node when converterting for clipboard
Bug: T186407
Depends-On: Iee635eaf42e3780da4e46e3c0f12417aa331655b
Depends-On: I1500f42dc0bf761f495e25c2d3d047157292df7d
Change-Id: Ia3b2549eb246fc0af56446a7d6a32ec0f54f4099
2018-02-06 16:47: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 a3a4bd945b VE: Support 'responsive' attribute
Bug: T53260
Change-Id: I1e0ae39e8c30653b7ba0f537723a4bcd79ac3162
2017-09-19 17:03:39 +01:00
Ed Sanders a024a7d2c6 Debounce reference list updates
Ideally update wouldn't be called multiple times
for simple transactions, but this should prevent
unnecessary updates if that does happen.

Bug: T176066
Change-Id: I1e7a21c19cee7d50ca160749f243c57f2fb08bab
2017-09-18 14:08:48 +00:00
Ed Sanders cec36fed6e Add 'references' class to reflist node
On en.wiki and others, this is the class that has
the 90% font size.

Change-Id: I23aaeefb2c42643be7c0daef99cdf89132b93308
2017-08-28 17:07:52 +01:00
David Lynch 05ffafc2e4 ce.MWReferencesListNode: wait for content before destroying temporary view node
Probably as fallout from the jQuery 3 update and associated promise-async
changes, `viewNode.destroy()` in the reflist preview caused problems when
adding a new reference with the generated content nodes which were actually
having to make an API call for their contents. New functions for waiting for
content generation to finish were added to core, and will defer the
destruction of the placeholder view until after it's done rendering.

Bug: T168932
Change-Id: I700bff9979a3356626aa311bfdf030da686f5878
Depends-On: Ic12973c0b46af50e0f1933137282a142f32e7de2
2017-08-16 11:47:47 -05: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 a42c656c53 build: Replace jscs+jshint with eslint
Change-Id: Ibcfab289a6dd4dcac853aa2e5338516994067cd5
2016-11-02 12:50:48 +00:00
Ed Sanders f4240f13f9 Use 'super' to call parent methods
Change-Id: Iba051a1e84b2ea805d0b3795933587c735ec0d88
2016-11-02 12:43:14 +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