Commit graph

341 commits

Author SHA1 Message Date
Ed Sanders 63492f1276 Disable IP mentioning until outstanding issues resolved
Bug: T251478
Change-Id: Ied56673c08d9a9803eb58b0e373a866d21a8945f
2020-05-06 19:15:19 +01:00
Ed Sanders cb90e6edee Move IP users to bottom of suggestions
Bug: T251478
Change-Id: I55088f9724303d2c46d829a14e0dc8abd5dc38b8
2020-05-06 18:53:02 +01:00
Ed Sanders 9fab4add17 Config: Separate useVisualEditor into enableVisual and use2017Wikitext
Currently use2017Wikitext is missing some implementations.

Change-Id: Ib5f9bcc588561a80ca11de85518e6fae64e5b104
2020-05-06 18:03:36 +01:00
Ed Sanders 56d8721fd7 Switching between VE & wikitext (plain)
Bug: T234403
Change-Id: I84a639ab8e31ec9f683a63b0ecf184f426df09dd
2020-05-06 18:03:36 +01:00
Ed Sanders d18496f025 Allow visual mode to tested with ?dtvisual=1
Bug: T251963
Change-Id: Ie86ed2097e3dc008f73d9b498627f9d025b865d5
2020-05-06 18:03:12 +01:00
Ed Sanders 44fd8ec0ef Parser: Return mw.Title from getTitleFromUrl
Change-Id: I2c3ce50c5ff7486d6c1f3a0c26cb3a9f1c252b60
2020-05-05 21:34:46 +00:00
Bartosz Dziewoński 0269626adc Handle   and other entities in the timestamp/timezone
Bug: T251838
Change-Id: Iba8d7c71e332c63229eec4bc7c80b10627135784
2020-05-05 22:38:16 +02:00
David Lynch b7ad053105 @Username completion in VE (source or visual) mode
Bug: T232601
Depends-On: I075cac9aa195574c3d416a40bbdc5ec2d64424e2
Change-Id: Ie605e783b333be0f81099d8d953725c38eb4cee1
2020-05-05 09:44:08 -05:00
Ed Sanders 5da26e2d0b parser: Have getAuthors return a list
Change-Id: Ieda881a26f802a9e8c73822fcbcc70dd6035bbb6
2020-05-05 12:13:12 +01:00
Ed Sanders 5271b3eafd Move CommentController to separate file
Change-Id: I6dbf16801058e7e41d38a0ce5753c298d380b780
2020-04-30 17:05:04 +01:00
Ed Sanders 2aa6e5f583 Allow inspectors to position beyond the surface
Change-Id: I3cd0e433ea117b1b469e5a2111f4c7988c48abfd
2020-04-30 17:05:02 +01:00
Ed Sanders a5ed469843 Create CommentController class and move most Controller methods to it
This means we have an instance for each comment, which makes keeping
track of local variables much simpler, and will make switching out
the widgets easier.

Change-Id: I7584870225b1a14146852987d6a40ad05957387c
2020-04-29 22:21:32 +02:00
Ed Sanders 75da1e0b3a ReplyWidgetVisual: Use hasContent instead of hasBeenModified for isEmpty
Change-Id: I093a4b68573809e5222db01aead3ce00ed9a87ae
2020-04-29 16:32:00 +01:00
jenkins-bot 922443f68f Merge "ConfirmEdit CAPTCHA support" 2020-04-29 12:04:44 +00:00
jenkins-bot e624e17471 Merge "Remove client-side timeout when saving pages" 2020-04-28 22:38:27 +00:00
jenkins-bot bb096d8f50 Merge "Revise error messages when replying to comments affected by templates" 2020-04-28 22:35:47 +00:00
jenkins-bot 431716577b Merge "Add 'cursor: pointer' to the reply link" 2020-04-28 22:33:34 +00:00
jenkins-bot ba3fd84243 Merge "Minimum keyboard-accessibility for the reply link" 2020-04-28 22:33:33 +00:00
jenkins-bot 5fdf6ae466 Merge "Fix inserting replies inside a <pre>" 2020-04-28 22:31:45 +00:00
Bartosz Dziewoński 021c981817 Add utils.getNativeRange() method
Change-Id: Iab6c5fa092560ee9dff808bbcc405722914febe7
2020-04-28 23:11:26 +02:00
Ed Sanders 04f8e21554 Implement auto-save for ReplyWidgetPlain
Bug: T240257
Change-Id: Ica51fb51a5091b11aceb3cd5c484ef9c71b98af2
2020-04-28 20:32:20 +02:00
Bartosz Dziewoński 047e8eb82c Fix inserting replies inside a <pre>
In the future, we should think about a better solution that also
handles other elements (T250126), but this is an easy fix for now.

Bug: T250512
Change-Id: I1321f0da523ddb4a999b8c453b9094a267b38ae2
2020-04-27 23:23:31 +02:00
jenkins-bot f376230459 Merge "Move VE toolbar to top right" 2020-04-27 21:17:01 +00:00
Bartosz Dziewoński c07243c88f Add 'cursor: pointer' to the reply link
Bug: T250337
Change-Id: I77949f59ac4da27e7a25b5c35ca2a9df66f22872
2020-04-27 18:30:07 +00:00
Bartosz Dziewoński 7cb7722b76 Minimum keyboard-accessibility for the reply link
Using an approach similar to that in jquery.makeCollapsible.

Bug: T249915
Change-Id: Ia3dc43d23c29cd936a9445766e394f96f096da75
2020-04-27 18:30:00 +00:00
Bartosz Dziewoński 4ad9aa8449 parser: Don't crash on links to invalid titles
Bug: T251045
Change-Id: I1a7b8b9b34d38ec4e3edc12687bdf99bb0e61bd8
2020-04-27 19:59:26 +02:00
Ed Sanders cd7acc741b Move VE toolbar to top right
Change-Id: I97b322ded505df608eda73a7c6a04157e993d73b
2020-04-27 16:42:35 +01:00
Bartosz Dziewoński b1376413f0 Revise error messages when replying to comments affected by templates
Bug: T248607
Change-Id: Iea49d16bb0e5c71b36a79248f3f91f7987e65702
2020-04-26 19:50:32 +02:00
Bartosz Dziewoński 7ef3bffb1e Show error on pages with fostered content to avoid page corruption in Parsoid
When the user clicks a "Reply" link on a page that is affected by the
'fostered' lint error (indicating fostered content in the HTML
representation), display an error and refuse to edit it, as Parsoid's
transformations will damage the page content.

The error message includes a link to documentation about lint errors,
and a link to the editor that will highlight the error location.

Depends-On: I723ec766d1244d117f8d624440026fe5af0d3403
Bug: T246481
Change-Id: Ic60cb58f98d10dc9b113469e5d3bbfb2d2b0564f
2020-04-21 17:40:39 +00:00
Bartosz Dziewoński 40c18508ec ConfirmEdit CAPTCHA support
Depends-On: I6605017fd31a4f96c529dd0beb69e9f4433cebc1
Bug: T247513
Change-Id: If9b3162969aa6ee67baff80aa84fa719bd3c3720
2020-04-21 18:55:38 +02:00
Ed Sanders d3c46a2967 eslint: Disable max-len
Change-Id: I7e49dc170dba62b88f1879ae670f806f6b54d4e9
2020-04-21 15:50:19 +01:00
Bartosz Dziewoński e3e36e11ac Remove client-side timeout when saving pages
Bug: T249071
Change-Id: I367c5931c05cf944bfad0f9fff69f06b32880411
2020-04-20 23:29:10 +02:00
Ed Sanders 0f7eb2e36a Add "watch this page" checkbox
Bug: T245222
Depends-On: I1e0e9bb9da53a62f8a20126e579dcd6300bd2376
Change-Id: If966d2fa97648452a50a2318988a8b64d7c449cd
2020-04-20 12:40:44 +01:00
Ed Sanders ba89657994 Add a share feedback link
Bug: T249016
Change-Id: I64abeebeea332a7a4a37fd4bfd6d5f9a5defc8b5
2020-04-14 23:04:18 +00:00
Ed Sanders d40e427b5b Remove extra linebreaks from wikitext
Extra lines currently render empty list items which are invisible.
Remove these as the user probably didn't intend from them to appear
in the wikiext.

Bug: T249867
Change-Id: I75c1192a94b918783d362d38cd91a508bb169d56
2020-04-14 20:29:38 +00:00
Ed Sanders f04abd02d4 Improve autosign handling of 3/5 tilde sigs and add tests
3 or 5 tilde signatures will be assumed to be erroneous and fixed
to 4 tilde signatures. This will be visible in the preview so shouldn't
come as a suprise to users.

Bug: T245628
Change-Id: I741f0761a6fb10c99cf3239ac5c6c7e1a2b872c7
2020-04-14 20:29:31 +00:00
Ed Sanders 5597787eb4 ReplyWidget: Replace .mode with #getMode
.mode was only set the end of the constructor.

Change-Id: I1a14167d1b2e524742da31f78c6cbfaf96aec667
2020-04-14 19:42:29 +00:00
David Lynch e38aad96e4 Add override config for instrumentation rates
Bug: T250086
Change-Id: I32fbf3d6562fb0a93698a24bbd8177149a19fed3
2020-04-13 12:38:40 -05:00
Bartosz Dziewoński 55b43a70d4 Fix skipping to the end of the paragraph when there is no wrapper
Bug: T249217
Change-Id: I77847901d98f56dbcbcf379c6c17f41e06a3a939
2020-04-03 18:11:59 +00:00
Bartosz Dziewoński a14293c8e7 Remove Parsoid section wrappers before finding transclusions
The section wrappers can be marked as template-affected when the
previous or next section is transcluded, causing comments to be
unnecessarily uneditable. The new test case demonstrates this.

Depends-On: I03bc455d5484a6c51f3fa2397c64936b829fe7e3
Change-Id: I895a04990d79a3475d778b4fef054ea0bb076f0b
2020-03-24 23:31:21 +01:00
Bartosz Dziewoński 807afd1ec0 Save the reply directly to the transcluded page
* When we discover the comment comes from a transcluded page, follow
  the transclusion to find the source page. We follow transclusions
  recursively, up to an arbitrary limit of 10.
* In the reply widget, display the title of the page where we will
  save the reply, to avoid users confused why their edit won't show up
  in the history. In the wikitext workflow this is done by redirecting
  the user to the edited page at the end, but it seems less surprising
  to stay on the current page.
* After saving the reply, we must purge the current page, otherwise
  the new content will not be immediately visible on it.

Bug: T247535
Change-Id: I1c6631aa65a2fce6c1c2f0dd4a8c7aa6389caf94
2020-03-24 22:29:42 +00:00
Bartosz Dziewoński dab37fd7b4 parser: Make #getTranscludedFrom return page title in text form
It's more convenient for display or comparing it with other things.

Depends-On: I03bc455d5484a6c51f3fa2397c64936b829fe7e3
Change-Id: I88d7aa68977210b16860075ed52983a5e99ee0f7
2020-03-24 22:29:35 +00:00
jenkins-bot 85472b7e31 Merge "ReplyWidget: Double-check that we can post before posting" 2020-03-20 19:37:48 +00:00
jenkins-bot 5b8b801989 Merge "Use 'baserevid' instead of 'basetimestamp' for edit conflict detection" 2020-03-20 19:30:15 +00:00
Bartosz Dziewoński 7fcd880fa5 controller: Fix minor issues with error popup
The rejection handling callback was accidentally resolving the
promise, which resulted in an error like 'TypeError: Cannot read
property '$element' of undefined' when the resolution value was
used.

Fixing this reveals that we weren't removing the placeholder list
element correctly. This wasn't immediately visible because of the
.empty() call in the next resolution callback, but it would have
caused something similar to T245574.

Follow-up to 6964f0c965.

Change-Id: I3aeb9a86046c4ccaa6c39301edc7285d02b0320c
2020-03-20 19:01:03 +00:00
Bartosz Dziewoński 9d2cb7bdd0 Also update 'jsconfigvars' when previewing
This fixes a warning in the API: 'Property "modules" was set but not
"jsconfigvars" or "encodedjsconfigvars". Configuration variables are
necessary for proper module usage.'

We were already updating them when saving.

Change-Id: I3e16e3fd4b43a438c27645cca90517b6b4be7db7
2020-03-19 18:19:15 +01:00
Bartosz Dziewoński a6ce1e23a7 ReplyWidget: Double-check that we can post before posting
Bug: T246058
Change-Id: Ic87b062c2fd6d7f48933a94e140ce392003ee65a
2020-03-19 01:03:09 +01:00
Bartosz Dziewoński e9b583d1c3 parser: Improve merging multiple comments on one line
Now also works if the "follow-up" comment is wrapped in e.g. `<small>`.

Change-Id: Ic37cb6afdb42021f109a1818f5c4299d907ed094
2020-03-14 13:34:42 +00:00
Bartosz Dziewoński 04365c0188 Merge RL modules which are only loaded by 'ext.discussionTools.init'
Bug: T240474
Change-Id: I1b83aa18666be8f1ea6a3602b299f92574d42cb7
2020-03-14 14:33:23 +01:00
Bartosz Dziewoński 92c3f079b8 controller: Make edit summary use the wiki's content language
Bug: T246043
Change-Id: I591e1a3ed3e7c8b68f5e203a0c77d057793fc767
2020-03-14 14:17:29 +01:00
jenkins-bot f97e6303a3 Merge "controller: Show error messages immediately when loading fails" 2020-03-13 22:13:19 +00:00
Ed Sanders 1be47f0599 Support saving multi-line comments in VE
Change-Id: I3e19fac750dbb8d10b6e1bf6081453c75768e625
2020-03-13 16:12:01 +00:00
Bartosz Dziewoński 6964f0c965 controller: Show error messages immediately when loading fails
Previously you'd only learn about the issue when saving failed.
Now a modal alert dialog with the error message appears.

This means that we have to wait for the loading to finish before we
can display the ReplyWidget now... this should not be noticeable,
since we preload in #init.

Bug: T247533
Change-Id: I5468e67c449d530a0d15f69bff954d37a5b6a14c
2020-03-12 19:24:00 +01:00
Bartosz Dziewoński 4e135c7f07 Use 'baserevid' instead of 'basetimestamp' for edit conflict detection
This has two benefits:
* Allows detecting a conflict if two edits are saved in the same second
* Doesn't ignore conflicts with yourself (T246726)

Depends-On: Id7565018f66860b5c2ba688777508db1b88700ae
Bug: T246726
Change-Id: I22eaa1af5692854870d31e08b171a070a2fda0de
2020-03-12 16:31:32 +00:00
Bartosz Dziewoński 574d519f92 ReplyWidget: Fix spacing for save error messages
This was accidentally removed in c8564f6ccb.

Change-Id: Ie08ad6f8e34abedec437e418dea492cce35d74ca
2020-03-11 22:01:44 +01:00
Ed Sanders 2fcd975764 Fix padding in visual mode
Change-Id: I43229baedf73ea9273b8796792de909b7bcbd462
2020-03-11 15:03:44 +00:00
Bartosz Dziewoński 9cb497fc97 Check wgIsProbablyEditable before showing 'Reply' buttons
Bug: T240582
Change-Id: I127cd937ed2725c649dc34a8d18a29560c09fb44
2020-03-10 21:19:33 +01:00
Bartosz Dziewoński 1fff57fdff controller: Move code for transcluded comment errors
This is a problem we can detect at the loading stage, rather than at
the saving stage, so move it from #postReply to #getParsoidCommentData.

Follow-up to e3e4ef9de4.

Change-Id: I19362399f9ff2fdc487ea4900654bc61d990575f
2020-03-09 21:59:12 +01:00
jenkins-bot 2e0c299a1f Merge "Fix signatureRanges overlapping for some comments" 2020-03-09 20:31:54 +00:00
jenkins-bot 1b052248e8 Merge "Replace the closest() polyfill" 2020-03-09 20:31:33 +00:00
Bartosz Dziewoński e3e4ef9de4 parser: Detect comments transcluded from another page
When trying to reply to a comment that is inside a transclusion,
detect if it's transcluded from a subpage or simply wrapped in a
template, and show appropriate error messages.

References:
* VisualEditor ve.dm.Converter#getAboutGroup()
* VisualEditor ve.dm.ModelRegistry#matchElement()
* Parsoid Linter#findEnclosingTemplateName()

Bug: T245694
Change-Id: If3dd1ebbf1d02ee4379c200019bfc3a8ec02325b
2020-03-09 20:28:56 +01:00
Bartosz Dziewoński b4029c3c58 Fix signatureRanges overlapping for some comments
If two signatures for a single comment were near each other,
we would sometimes treat them as one huge signature.

Change-Id: Ied4b3aa535a9ca6bebef8a004ae48b7d5a8f2f9b
2020-03-09 13:28:22 +00:00
Bartosz Dziewoński 2a0f53fed9 Replace the closest() polyfill
If we can't use the native closest() due to lack of browser support,
then I'd rather have a simple loop that implements the functionality
we need, instead of a fallback to another native method with limited
browser support and experimental implementations.

Change-Id: I0bf84aa25fc398e329b533afb28317d19716d57a
2020-03-09 13:28:14 +00:00
Ed Sanders aa91832d4e Tidy up ReplyWidgetVisual setup
Change-Id: Id575a5382a6e4cad5bdc00b66683ed0a06d749fd
2020-03-09 13:13:30 +00:00
Ed Sanders 3af3f3ed8c Wrap reply link in container so it may contain more links in future
For example 'Edit'.

Change-Id: I3d3027724cfd69a6719932bb2cb80fa711010fc4
2020-03-09 12:52:18 +00:00
Ed Sanders 23966cc098 Move wikitext comment building to the controller
Change-Id: I6374ea570f093ae5286c14ed49a9be4f32f23ff5
2020-03-09 12:52:06 +00:00
jenkins-bot 9913a77d61 Merge "controller: apply ve.fixBase to the parsed Parsoid response" 2020-03-05 16:09:55 +00:00
jenkins-bot f7c3b701f9 Merge "Only allow opening one reply widget at once (on IE 11)" 2020-03-05 14:46:37 +00:00
jenkins-bot bba0007d44 Merge "parser: Return signature and timestamp ranges" 2020-03-05 14:46:00 +00:00
Bartosz Dziewoński 0ca851aa92 parser: Return signature and timestamp ranges
Currently not used for anything. May be used later for editing
comments (T245225) or reformatting timestamps (T240360).

Note that a comment may have multiple signatures+timestamps,
and we return them all so that you have to deal with that.

Fix some unrelated incorrect documentation comments.

Bug: T245220
Change-Id: I51b8bf4a3bb7968f35e32c7e44c95c2ab079d9ac
2020-03-05 14:28:17 +01:00
Bartosz Dziewoński 898db0d57a Only allow opening one reply widget at once (on IE 11)
We disable the other reply links using 'pointer-events: none' in CSS,
but IE 11 doesn't support that.

I tried hiding them instead and using @supports rules in CSS to apply
'pointer-events: none', but the result was worse than this.

Change-Id: Iab2bfe9c623f3d32cce9776277f33483155a0c42
2020-03-05 13:31:29 +01:00
David Lynch 0085b7c912 controller: apply ve.fixBase to the parsed Parsoid response
Also, add the missing dependency on ext.visualEditor.core.utils.parsing.

Bug: T245781
Change-Id: I26130f1afd7dd93012aea8a24943d966250c2472
2020-03-04 15:46:08 -06:00
Bartosz Dziewoński 6ab57649a7 ReplyWidget: Set line-height to match normal wikitext editor
Now it also matches the font in the reply editor used when
$wgDiscussionToolsUseVisualEditor is true.

Depends-On: Ia866af0163b538596bfbb8c96a330186b667f85f
Bug: T246846
Change-Id: I21bdbe798949c0027eea16904ec6bc125c4746d8
2020-03-04 15:45:04 +01:00
jenkins-bot fa47fc9dee Merge "Move edit conflict retry code to controller" 2020-03-03 23:45:18 +00:00
jenkins-bot a8de849a4e Merge "Remove somewhat useless ReplyWidget.prototype.getParsoidCommentData" 2020-03-03 23:45:17 +00:00
jenkins-bot f1fc955dc3 Merge "Reply-to placeholder" 2020-03-03 22:59:44 +00:00
Ed Sanders 3274b0c9df Move edit conflict retry code to controller
Change-Id: Id14e93624d1828253402c04c97193fd686f67d9f
2020-03-03 13:25:14 +00:00
Ed Sanders 126266c741 Remove somewhat useless ReplyWidget.prototype.getParsoidCommentData
We always pass the same arguments to the controller method and
two of those are global config values, so just pass the comment ID
each time it is used instead.

Change-Id: Ic68c70bdadb29310e930dd10fd6c6137d01ad22f
2020-03-03 13:20:23 +00:00
Bartosz Dziewoński 606d6b34ec Add reply links at the end of a line, even if the signature is in the middle
Previously they were added at the end of the text node containing the
timestamp, which was usually the end of the line, but not always.

And also fix the same problem for inserting the actual replies (or
reply widgets). This replaces an undocumented hack that prevented our
own reply links from triggering this bug (without it, the reply widget
would be inserted before the reply link rather than after).

While we're here, remove unintentional spacing that appeared before
some reply links, caused by trailing whitespace in text nodes.

Add tests for all of the above.

Bug: T245695
Change-Id: I354b63e2446bb996176a2e3d76abf944127f307e
2020-03-02 21:39:37 +01:00
Bartosz Dziewoński 711d5c4371 Parse Parsoid document as XHTML to avoid IE 11 bugs
This is the same as in VisualEditor. ve.parseXhtml has workarounds for
IE 11 bugs that would cause dirty diffs when saving.

Note that we must use ve.serializeXhtml to convert the document back
to a HTML string, but this is already the case (the conversion happens
in mw.libs.ve.targetSaver.saveDoc).

Change-Id: Ib6dec0002eaf33fc0d4a45331a6d38e5c5d7ab8c
2020-03-02 18:14:35 +01:00
Bartosz Dziewoński 85b2cf00b1 modifier: Fix IE 11 incompatibility due to 'parentElement'
On IE 11, the 'parentElement' property is only supported on element
nodes, not on text nodes.

https://developer.mozilla.org/en-US/docs/Web/API/Node/parentElement#Browser_compatibility

There's no reason to use it here, 'parentNode' is the same for the
nodes we're concerned with.

Also remove the use in code adapted from MDN to avoid repeating this
issue in the future.

Bug: T246565
Change-Id: I0120feb3737c462f2a64e4ec084249a0fd57d0f0
2020-03-02 18:14:35 +01:00
Bartosz Dziewoński ea26009896 Work around mw.Uri crash on fallback encoding in links
Bug: T245889
Change-Id: I182f9ffa84a3b3cf4afafd536360572eda9d2714
2020-02-29 19:08:01 +01:00
Ed Sanders 7cb82b6862 Reply-to placeholder
Sets the placeholder text to "Reply to <user>".

Bug: T245227
Depends-On: I7f3a58b7093d00aace9f9c6a95a121ba4e901ad8
Change-Id: Ie51f1848c17bb892e7f64adf6f7f19fc38e56202
2020-02-29 17:29:07 +00:00
Bartosz Dziewoński 656b413b4b ReplyWidget: Disable "Reply" button if input is empty
Bug: T246058
Change-Id: Ib46f265eff3a4b4f59b5085ab33c5ebbef76003c
2020-02-29 03:58:28 +01:00
DLynch 2b21314671 Correct the integration for logging
Bug: T244874
Change-Id: I12d1a92f9a72b0ecd3fa7e2aa20289d1f57a46dc
2020-02-28 17:42:21 +00:00
jenkins-bot 9a1921488e Merge "Instrumentation: abort-navigate case" 2020-02-27 23:24:01 +00:00
jenkins-bot 0e22b4c79f Merge "Clean up the interface after discarding a reply" 2020-02-27 23:05:00 +00:00
Bartosz Dziewoński d068d2ef2c Clean up the interface after discarding a reply
Bug: T245574
Change-Id: I016a7a5c44e0d15a153143177976cceb8d6d3d1b
2020-02-27 18:09:34 +01:00
David Lynch e2bf0d25d2 Instrumentation: abort-navigate case
Bug: T244874
Change-Id: I0f8030e17d09d5b828732fc386b0b899f8c32564
2020-02-25 23:28:24 -06:00
Bartosz Dziewoński e9c401e3aa Ignore LRM and RLM before timezone indicator
They are not generated by MediaWiki, but they often appear when users
sign others' unsigned comments by copy-pasting the timestamp from the
history page.

Add test config data for nlwiki, exported by running this in the
browser console:

  copy(
    JSON.stringify( { wgArticlePath, wgNamespaceIds, wgFormattedNamespaces }, null, 2 ) + '\n' +
    JSON.stringify( mw.loader.moduleRegistry['ext.discussionTools.parser'].packageExports['data.json'], null, 2 )
  );

Bug: T245784
Change-Id: Icbcdc5a028e9ce2cb09173f87769e525ec3082fc
2020-02-25 00:20:00 +00:00
David Lynch fb006e6373 Instrumentation
Bug: T243364
Change-Id: I8573993db0dad408f09202e548206b009c106cc9
2020-02-24 19:50:27 +01:00
jenkins-bot 37bf81bf37 Merge "When launched from an old revision, reply to latest revision" 2020-02-24 16:23:21 +00:00
jenkins-bot 4d6bdcafb1 Merge "Try to resolve edit conflicts" 2020-02-24 16:23:20 +00:00
jenkins-bot 1dfa501cc6 Merge "Rebuild Parsoid document before attempting to save" 2020-02-24 15:53:54 +00:00
jenkins-bot e94ebddaa4 Merge "Use built-in mw.Api 'badtoken' handling, also 'assert'/'assertuser'" 2020-02-24 15:48:01 +00:00
Bartosz Dziewoński da11a3be73 When launched from an old revision, reply to latest revision
The "Reply" buttons were active when viewing an old revision of the
page (&oldid=1234). This was probably unintentional, and it would undo
all more recent comments if you saved yours.

However, I think it would be a useful feature. You often end up
viewing old revisions when reviewing changes to pages from your
watchlist or email notifications.

Now, when the reply widget is launched from an old revision, it will
try to find the relevant parent comment in the latest revision of the
page, and edit that revision when inserting the reply. If the parent
comment is gone, it shows a useful error message.

Bug: T235761
Change-Id: I8c5b631d3bfb62196fd219cbcd7d497408d187a7
2020-02-21 17:09:47 +00:00
Bartosz Dziewoński ff0386239f Only detect comments with real signatures
Consequences of this are visible in the test cases:

* (en) Tech News posts are not detected.
  Examples: "21:22, 1 July 2019 (UTC)", "21:42, 29 July 2019 (UTC)"

* (en) Comments by users who customize the timestamp are not detected.
  Examples: "10:49, 28 June 2019 (UTC)", "21:34, 14 July 2019 (UTC)"

* (en) Comments with signatures missing a username are not detected.
  This sometimes happens if a comment is accidentally signed with
  '~~~~~' (five tildes), which only inserts the timestamp.
  Examples: "17:17, 27 July 2019 (UTC)", "10:25, 29 July 2019 (UTC)"

* (pl) A lone timestamp at the beginning of a thread is not detected.
  It's not part of a post, it was added to aid automatic archiving.
  Example: "21:03, 18 paź 2018 (CET)"

Bug: T245692
Change-Id: I0767bb239a1800f2e538917b5995fc4f0fa4d043
2020-02-21 01:30:54 +01:00
Bartosz Dziewoński 7761f62b42 Fix edit summary for comments in 0th section (no heading)
Bug: T245765
Change-Id: I9eb4726ef096b8d7459cc1409814514ec1dc89ae
2020-02-21 00:44:42 +01:00
jenkins-bot d8b0cf747f Merge "Blacklist/convert tables and headings in VE target" 2020-02-19 21:07:44 +00:00
jenkins-bot 8043769e5c Merge "Remove vertical padding from VE visual target" 2020-02-19 21:07:43 +00:00
Ed Sanders 5f966e845b Remove vertical padding from VE visual target
Compensates for vertical padding on paragraphs.

Match source mode padding to that of a TextInputWidget.

Change-Id: Ia53d8d2a6b9eff464c6c61152d02250088049bf9
2020-02-18 15:53:45 +00:00
Ed Sanders 97cf4e8440 Blacklist/convert tables and headings in VE target
Change-Id: I5e58fb1da1cb793bad5fb9640ef2dbf14c96d082
2020-02-18 15:44:40 +00:00
Ed Sanders 1a93e420b3 Sig preview: Increase opacity
Closer matches disabled-grey which is more accessible.

Change-Id: Ieb98e88bb42fdec1f1089919cf2c0c5f72b21877
2020-02-18 15:43:06 +00:00
Bartosz Dziewoński 7ea6cdf326 Try to resolve edit conflicts
The most common case of edit conflicts on talk pages is several people
responding to the same comment at the same time.[citation needed]

We can easily resolve this case by fetching the latest revision of the
page and re-running our code to insert a reply on it.

When we can't insert a reply, that probably means the parent comment
was deleted or moved, so display an error message indicating that
instead of the generic one.

Bug: T240643
Change-Id: Ic686acc747580d46779960211a02e9830a6ae86f
2020-02-15 05:43:14 +01:00
Bartosz Dziewoński 6f404e5ce2 Rebuild Parsoid document before attempting to save
Previously, we only built the Parsoid document once (on page load) and
kept it around forever. Every time we tried to post a reply, it was
added to this document, even if it wasn't saved due to some error.
This resulted in duplicate replies when the user managed to actually
save.

Now we only keep around the HTML string and some metadata fetched from
the API, and rebuild the actual document every time before adding a
reply.

Bug: T245333
Change-Id: Ib1c344a7d613cdf67644aa243147c5e699c2c1e7
2020-02-15 05:09:34 +01:00
Bartosz Dziewoński 80cddf549c Use built-in mw.Api 'badtoken' handling, also 'assert'/'assertuser'
This ensures that expired tokens are refreshed and retried, while
invalid tokens caused by the user logging in/out cause an error. We
should think about displaying a better interface for the latter case.

Bug: T245327
Depends-On: I485f99e1f5f493262b0c9af22370da01adf1e09c
Change-Id: Ibc097ed68e3ae72223b0680ee8895f7884399958
2020-02-15 03:07:02 +01:00
Bartosz Dziewoński 3896babde3 Improve comment ruler drawing in debug mode when indentation is weird
Ignore the horizontal position of the comments' bounding boxes entirely.
It can be crazy because of de-indentation in the middle of the comment,
and even just text formatting with padding/margins (e.g. `<code>`) can
make it look weird. Just draw the rulers based on detected indentation.

Change-Id: Id4e5edf076d44bdedfb45958260d797daea29ed1
2020-02-11 02:32:32 +01:00
Bartosz Dziewoński a491e3aaac Rename the lines denoting child comments in debug mode to "rulers"
I got tired of typing "relationship".

Change-Id: I318bdd1c049d7ab7fdeb1512a083cf8f4121d598
2020-02-10 22:14:38 +01:00
Ed Sanders c8564f6ccb Re-style preview
Bug: T238177
Change-Id: Iabc7cfa7595d60cbd0482340bd159002ee5a6b0e
2020-02-08 00:13:41 +00:00
David Lynch 16215bbea2 Change tags method so anon edits will get tagged
Bug: T242184
Change-Id: I38baddc0febe02f6d2321be616adc018c87b5a54
2020-02-07 01:19:11 -06:00
David Lynch 2fcc23ae61 Add editor-mode changetags
Bug: T242184
Change-Id: Ib307e44ec883b01e0705c889f97e16326519f4c2
2020-02-06 20:22:27 +01:00
Bartosz Dziewoński e5e6fdd3af Stop using native Range objects, they're too annoying
Native Range objects are automatically updated when the DOM elements
they refer to are affected (e.g. detached from the DOM, or their offset
changes because of siblings being added/removed).

This seemed harmless or maybe even slightly useful, but it turns out
it conflicts with VisualEditor, which has to wrap the entire page in a
new DOM node when it opens (and unwrap it when it closes), effectively
temporarily detaching it from the DOM, which destroys all our ranges.

Just use a plain object that stores the same data as a Range. And when
we need to use Range's API, we can simply construct a temporary one.

Bug: T241861
Change-Id: Iee64aa3d667877265ef8a59293c202e6478d7fb6
2020-02-05 19:42:03 +01:00
David Lynch 664b2890d7 Tag DiscussionTools edits
This sets up the tags:
* discussiontools
* discussiontools-reply
* discussiontools-edit (not yet implemented)
* discussiontools-newsection (not yet implemented)

The tags are flagged as user-addable, because otherwise they can't be
passed through to the VE API (at least, not without editing it so that
it explicitly knows about them, which seems like a strange
interdependency). It's assumed that letting users who know about the
tags add them to random changes via action=editchangetags would be
(a) the pettiest and most inconsequential vandalism possible, and
(b) unlikely to happen.

This relies upon I2c1d0f8d69bc03e5c1877c790247e165f160e966 in
VisualEditor to not also tag the edits with `visualeditor`.

Bug: T242184
Change-Id: I4e5e26afdd52279df242e1912f073b415b812c3b
2020-02-04 11:15:18 -06:00
jenkins-bot 601226199d Merge "Handle comments before first section heading" 2020-01-30 23:19:29 +00:00
Bartosz Dziewoński e29b8173bf Handle comments before first section heading
The loop in parser.js assumed that there was always a heading before
any comments (not counting the page title, only section headings).

Bug: T243869
Change-Id: I3a0bb06716e75d4a17e25c40748673a071ee5f30
2020-01-30 00:14:46 -08:00
jenkins-bot f735e47fdd Merge "Attach highlights to positioned container" 2020-01-30 00:07:04 +00:00
jenkins-bot 3b4ae40658 Merge "Don't use RangeFix for node rects" 2020-01-30 00:02:49 +00:00
Ed Sanders 4b3d92a5e9 Attach highlights to positioned container
Bug: T240639
Change-Id: I41a547acd3e5d7e9a49f99fc5ef35738d038007e
2020-01-29 15:22:20 -08:00
Ed Sanders 087d1eb428 Don't use RangeFix for node rects
Change-Id: I60e45ee9288fbdad26bb85997a7b4a24234fa8b4
2020-01-29 15:22:19 -08:00
jenkins-bot 95a663ff62 Merge "ReplyWidget: Handle save errors" 2020-01-29 20:51:50 +00:00
Ed Sanders 7de6b4e04a Use simple targetSaver API call
Depends-On: Ida47968c995166b1dca36fc9fe28fac374010564
Change-Id: Id3decabb803a65d79cb09668bde4e0b498ad057c
2020-01-24 15:45:43 -08:00
Bartosz Dziewoński 890588f36a Pick reply insertion point based on parser tree, not DOM tree
I don't like that I had to special-case `<p>` tags (top-level
comments) in this code. I feel like it should be possible to handle
top-level comments and replies in a generic way, but I couldn't find
a way to do it that actually worked.

Notes about changes to the behavior, based on the test cases:

* Given a top-level comment A, if there was a "list gap" in the
  replies to it: previously new replies would be incorrectly added at
  the location of the gap; now they are added after the last reply.
  (T242822)

  Example: "pl", comment at "08:23, 29 wrz 2018 (CEST)"

* Given a top-level comment A and a reply to it B that skips an
  indentation level: previously new replies to A would be added with
  the same indentation level as B; now they are added with the
  indentation level of A plus one. (The old behavior wasn't a bug, and
  this is an accidental effect of other changes, but it seems okay.)

  Example: "pl", comment at "03:22, 30 wrz 2018 (CEST)"
    and reply at "09:43, 30 wrz 2018 (CEST)"

* Given a top-level comment A, a reply to it B, and a following
  top-level comment C that starts at the same indentation level as B:
  previously new replies to A would be incorrectly added in the middle
  of the comment C, due to the DOM list structure; now they are added
  before C. (T241391)

  (It seems that comment C was supposed to be a multi-line reply that
  was wrongly indented. Unfortunately we have no way to distinguish
  this case from a top-level multi-line comment that just happens to
  start with a bullet list.)

  Example: "pl", comments at "03:36, 24 paź 2018 (CEST)",
    "08:35, 24 paź 2018 (CEST)", "17:14, 24 paź 2018 (CEST)"

* In the "en" example, there are some other changes where funnily
  nested tags result in slightly different results with the new code.
  They don't look important.

* In rare cases, we must split an existing list to add a reply in the
  right place. (Basically add `</ul>` before the reply and `<ul>`
  after, but it's a bit awkward in DOM terms.)

  Example: split-list.html, comment "aaa"; also split-list2.html
    (which is the result of saving the previous reply), comment "aaa"

* The modifier can no longer generate DOM that is invalid HTML, fixing
  a FIXME in modifier.test.js (or at least, it doesn't happen in these
  test cases any more).

Bug: T241391
Bug: T242822
Change-Id: I2a70db01e9a8916c5636bc59ea8490166966d5ec
2020-01-23 21:13:12 +01:00
Bartosz Dziewoński 30fcfec1fd parser: Merge multiple comments on one line
Even when you have multiple signatures by multiple users in one
paragraph (or list item), it's still basically a single comment.
We don't want to offer multiple buttons to reply to it.

The changed parser test cases are illustrative:
* All affected comments in the "pl" example are comments with a
  "post-scriptum", which is now more intuitively treated as part of
  the main comment.
* The first comment in the "en" example would probably have been
  better if it wasn't merged, but a weird use of the outdent template
  causes us to not be able to distinguish that the two parts of the
  comment display on separate lines.
* The last comment in the "en" example (isn't that neat?) was previously
  incorrectly treated as two comments, because there's a timestamp in
  the middle of it (the user is referring to another comment).
* Remaining affected comments in the "en" example are also comments
  with a "post-scriptum" and their treatment is clearly better now.

It also accidentally fixes some problems with modifier tests (but not
all), where previously <dl> nodes would be inserted in the middle of
<p> nodes, to reply to the comments which are now merged.

Bug: T240640
Change-Id: I0f2d9238aff75d78286250affd323cd145661a11
2020-01-22 02:21:43 +01:00
Bartosz Dziewoński 6d243ed74a ReplyWidget: Handle save errors
Bug: T240519
Depends-On: Ie18666b41f4aff1ab4bcf93f9df6e3000ac7b500
Depends-On: I2a731cb273401074e65f9283c1f629dbdb272002
Change-Id: Ice92fafb1f546510dab28e3f8aa7d2280668965a
2020-01-21 22:21:57 +01:00
Ed Sanders e83af3a4e9 Allow plain reply widget to grow without limit
Matches the behaviour of the VE widget.

Change-Id: If6540c4e91566da878c95b40e98ebe5f996125ce
2020-01-21 19:30:34 +00:00
Ed Sanders fe48688a76 Teardown the widget as soon as possible
Bug: T241393
Change-Id: I5978133637844fcad81af426465b6f16829ee9b3
2020-01-15 16:21:59 +00:00
Ed Sanders cc5976e8db Fix <escape> handler again
Sepatate #teardown and #tryTeardown methods to make it
obvious what they do. Have <escape> call #tryTeardown
like the cancel button.

Change-Id: Ica0f3295bfee378bcd15d0b6a3ccea3c7917ad9b
2020-01-14 15:01:49 +00:00
jenkins-bot ad48d8d2f9 Merge "Option to integrate VisualEditor instead of textarea" 2020-01-09 18:08:18 +00:00
jenkins-bot 719bfee1b3 Merge "ReplyWidget: Load modules required by the content when previewing" 2020-01-08 23:28:21 +00:00
jenkins-bot 45e811a688 Merge "ReplyWidget: Pass 'title' when previewing" 2020-01-08 23:28:20 +00:00
jenkins-bot 88a467ec16 Merge "Fix re-initialization after page is updated" 2020-01-08 23:28:19 +00:00
jenkins-bot 8282cefb68 Merge "Fix crash when opening VisualEditor NWE while DiscussionTools enabled" 2020-01-08 23:28:18 +00:00
Ed Sanders 2f1cf65233 Option to integrate VisualEditor instead of textarea
* Add config option $wgDiscussionToolsUseVisualEditor (default false).
* Add new modules ext.discussionTools.ReplyWidgetPlain and ...ReplyWidgetVisual,
  replacing ...ReplyWidget. Load only one of them depending on the config.

TODO:
* Also add the visual mode of VisualEditor, this only uses NWE now.
  There is already code to support saving from it, but no mode
  switcher tool

Co-Authored-By: Ed Sanders <esanders@wikimedia.org>
Co-Authored-By: Bartosz Dziewoński <matma.rex@gmail.com>
Change-Id: I9b6db865d51baf400fb715dc7aa68ccd8cdd4905
2020-01-07 22:15:03 +00:00
Ed Sanders c03cfde566 Fix 'escape' to teardown
Change-Id: Icc35ed83a1fa46ed592f617d0ff5dd60361c412d
2020-01-07 22:13:50 +00:00
Bartosz Dziewoński 25eb55000f Fix re-initialization after page is updated
I did this wrong in a6147ffac8, the
'dt-init-done' class was never cleared. Put it on another element.

Bug: T241861
Change-Id: I136bd9c12bcc80cff01f5d26a8a53524f0c533c6
2020-01-04 18:49:55 +01:00
Bartosz Dziewoński 0de5591889 ReplyWidget: Load modules required by the content when previewing
Unfortunately mw.Api#parse doesn't provide us with that part of the
response, so we have to manually construct the parameters.

Bug: T241193
Change-Id: Ie91d5ebc2ef483a69524b838dd3cb852e7c85cd2
2020-01-02 16:00:03 +01:00
Bartosz Dziewoński d7aded339c Fix crash when opening VisualEditor NWE while DiscussionTools enabled
The hook 'wikipage.content' fires whenever new "page content" is added
dynamically (e.g. after a VisualEditor edit). It's used by the code
for sortable tables, collapsible content, etc., to ensure they behave
correctly after the page content is changed without reloading the page.

We use this hook to add our "Reply" links. However, VisualEditor (and
NWE) also fires this hook for the contents of the edit notices box (to
support collapsible boxes there: T179315). Our code was crashing
because it could not find talk page content inside of that, and this
crashed VisualEditor as well.

Use .each() to handle any number of results (0, 1 or more), instead of
assuming there is always 1.

Bug: T241396
Change-Id: I877b1ae06bf1d7cd585ec6f9c1fb596cc3b86e7e
2020-01-02 14:44:18 +00:00
Bartosz Dziewoński e9b1037ec6 ReplyWidget: Pass 'title' when previewing
Bug: T241221
Change-Id: Ibabc32c9e5aeec6acec3bab9ad67d6ba3c4f27e8
2019-12-27 19:30:24 +01:00
David Lynch 5eea2d42fb ReplyWidget: calling undefined clear method
Caused by 49edbb82ab.

Bug: T240729
Change-Id: I23bf7fcb7e0265f9770629590702a07a3dbed2b1
2019-12-13 16:49:10 -06:00
jenkins-bot 2680307b37 Merge "Prompt users when pressing 'cancel' with content in the widget" 2019-12-13 19:00:41 +00:00
jenkins-bot b1d5e2953a Merge "Add beforeunload handlers" 2019-12-13 19:00:40 +00:00
Ed Sanders 49edbb82ab Prompt users when pressing 'cancel' with content in the widget
And actually discard the contents when they confirm.

For now this uses the generic editor message, but that can
be tweaked later.

Bug: T240271
Change-Id: I2dfa19b2cc7ac49d7efea37ac8c9429c75934a91
2019-12-13 18:15:48 +00:00
Ed Sanders 179b29a598 Add beforeunload handlers
Bug: T240259
Change-Id: I376ea116a0fd1fdf794d9eb9e1d15f3d34babd88
2019-12-13 18:11:22 +00:00
Bartosz Dziewoński 0568d42042 Correct typos to fix edit conflict detection
* Query parameters for the API must be in lowercase.
* Also, 'starttimestamp' was misspelled.

Bug: T240643
Change-Id: I6497770dfc3a9512af063b846c3f73aa5603b637
2019-12-13 15:29:42 +01:00
Ed Sanders ccbbf386d2 Live preview
Change-Id: I1654e95e94686b27818cbc465d5a9e8600404634
2019-12-12 23:59:24 +00:00
Ed Sanders fc55b452b3 Show 'terms' message
Copied from Flow.

Change-Id: I5fe67948ba41a5a3364d8b0237583548c787d772
2019-12-12 22:26:22 +01:00
Ed Sanders 83ddc3d627 Show anon warning
Message copied from Flow.

Change-Id: Id003a1e57447b3087cd973964b3a88886d2cb7d6
2019-12-12 15:53:18 +00:00
Ed Sanders 763450db24 Create autoSign method and add whitespace trimming.
Method can be used by preview logic later. Whitespace trimming
avoids sig ending up on newline in a <pre>.

Change-Id: If6f06f17395af0c6645082c1b9493be87422c059
2019-12-12 15:28:42 +00:00
Bartosz Dziewoński 3e5a67010f Use module.exports/require() rather than mw.dt namespace for defining classes
The packageFiles system makes it easier to export site config data
from PHP to JS, which we need a lot of, but it's awkward when mixing
it with defining and accessing classes via a namespace like mw.dt.

The only thing remaining in mw.dt is mw.dt.pageThreads, which is
described to be "for debugging", so we should keep it easy to type.
Also we still use the namespace for documenting classes.

Everything else can be reached by require()'ing a ResourceLoader
module, for example instead of `mw.dt.ui.ReplyWidget`
you'd do `require( 'ext.discussionTools.ReplyWidget' )`.
(When debugging from browser console, use `mw.loader.require` instead.)

Change-Id: I6496abcf58c21658d6fd0f3fc1db1f7380a89df7
2019-12-10 22:47:40 +01:00
jenkins-bot 2c5e125fe3 Merge "Disable buttons while posting" 2019-12-09 19:17:50 +00:00
Bartosz Dziewoński da668b72d5 Identify comments by username+timestamp+seq
Possible use cases:
* Matching comments between PHP and Parsoid HTML [implemented here]
* Finding the same comment in a different revision of a page
  (e.g. while resolving an edit conflict, or to allow resuming
  composition of autosaved comments) [implemented for highlighting
  user's own posted comment only]
* Permanent links to comments [future]

The reasoning for this form of ID is:
* _Timestamp_ by itself is a nearly unique identifier, so it's a good
  thing to start with
* Users may post multiple comments in one edit (or in many edits in
  one minute), so we need the _sequential number_ to distinguish them
* _Username_ is probably not required, but it may reduce the need
  for sequential numbers, and will help with human-readability if we
  add permanent links

The ID remains stable when a new comment is added anywhere by anyone
(excepts comments within the same minute by the same user), or when a
section is renamed.

It's not always stable when a comment is moved or when an entire
section is moved or deleted (archived), but you can't have everything.

Change-Id: Idaae6427d659d12b82e37f1791bd03833632c7c0
2019-12-09 13:45:31 +00:00
Ed Sanders f59482d638 Disable buttons while posting
Bug: T239865
Change-Id: Id32e35e223def1f31f52d26284638a0f00338ea7
2019-12-09 13:41:54 +00:00
jenkins-bot a2ab3188eb Merge "i18n all the things" 2019-12-07 22:20:49 +00:00
Ed Sanders 682732897d i18n all the things
Change-Id: I01da9a88cd69facfeb33b37a727d1cd65c12a78d
2019-12-06 18:51:02 +00:00
Ed Sanders 1de021e570 Disable widget and show as pending while posting
Change-Id: I4a820fdbe8cdc0702dd48ba6ee7e999916cfb599
2019-12-06 17:55:29 +00:00
Ed Sanders 308375ca4b Submit on ctrl+enter
Bug: T239859
Change-Id: I05cca4b7f841c317b35faecf61e30950e17c0e09
2019-12-06 17:55:13 +00:00
jenkins-bot 689945bde8 Merge "Use editfont (monospace by default) for ReplyWidget" 2019-12-03 19:38:31 +00:00
jenkins-bot a7db61d43f Merge "Highlight comment after saving" 2019-12-03 16:49:01 +00:00
Ed Sanders a6147ffac8 Highlight comment after saving
* Init on wikipage.content hook
* Update page state variables after save

Change-Id: I05a3c766668999f05cfe06473652429025595196
2019-12-03 16:40:35 +00:00
Ed Sanders 723622ab5c Use editfont (monospace by default) for ReplyWidget
Change-Id: I6ebcb02402526044c5aac135d57276f23589579e
2019-12-03 16:29:25 +00:00
Bartosz Dziewoński 872c73e1b2 Reserve space for the "Reply" link when hiding it
Otherwise the rest of the page may shift if hiding the link changes
line-wrapping. It felt super confusing when it happened to me while
I was testing an unrelated thing.
https://phabricator.wikimedia.org/F31254175

Change-Id: I53aecdbf3bfba579b48875532d251de0f1c81d6c
2019-11-25 16:23:00 +00:00
Ed Sanders 55b8405e22 Plain ReplyWidget styling
* Make full width
* Set min rows and autosize
* Position and align actions

Change-Id: I298629980a821c94e04d83c918f9b45dc9436c44
2019-11-22 16:55:15 -05:00
Ed Sanders a17fb49a68 Scroll ReplyWidget into view
Change-Id: I302346c85aacf9e410ff1468723b30fd04351032
2019-11-22 16:45:26 -05:00
jenkins-bot 59248558d1 Merge "Move postReply code to controller" 2019-11-22 19:35:59 +00:00
jenkins-bot 7a66c470d6 Merge "Implement basic saving" 2019-11-22 19:34:20 +00:00
jenkins-bot 3e709fea84 Merge "Fix opening/closing widgets multiple times" 2019-11-22 19:30:23 +00:00
jenkins-bot 124604f2b1 Merge "Wrap up the plain textbox in a ReplyWidget" 2019-11-21 14:21:19 +00:00
Ed Sanders 87696c9c3c Move postReply code to controller
Change-Id: Ie66273d9b9f70b625ab7757c93b5884a01c70751
2019-11-21 08:24:57 -05:00
Ed Sanders 2b36ebe668 Implement basic saving
Depends-On: I63fa04598e0d703fe1ba715c9c5a0abbb0d7ba5b
Change-Id: Ie15f94a2b779da559615c3b1fac55c98aca59fd4
2019-11-21 08:24:09 -05:00
Ed Sanders 8a0a400449 Fix opening/closing widgets multiple times
For now don't allow more that one widget to be open at once.

Change-Id: I3bb5ad8e79853f9b4115b761bd97e9d6d835a5c4
2019-11-21 08:22:25 -05:00
Ed Sanders 41676098fa Wrap up the plain textbox in a ReplyWidget
Depends-On: I765d657c172d96c3b2e2ae5998083e4926a31f15
Change-Id: I3c71fc014b723b0762e2c2be2e0295c57ecfb40d
2019-11-21 08:22:24 -05:00
Ed Sanders 9733f72354 Use Parsoid hack to remove whitespace from replies
Change-Id: I1ad0f5498c3c409df6d4eb2d400a0f714dff9908
2019-11-19 21:24:33 +00:00
jenkins-bot eb0c09ad1d Merge "Fetch Parsoid document for modification" 2019-11-05 21:57:03 +00:00
jenkins-bot e4bdd4e645 Merge "Rewrite list modifier in plain JS and move to separate file" 2019-11-05 21:57:03 +00:00
Ed Sanders 83a4539900 Fetch Parsoid document for modification
Change-Id: I479954bef3657ddce593795fd4e6b882ee31ce4d
2019-11-05 14:14:41 +00:00
Ed Sanders 16de8fb288 Rewrite list modifier in plain JS and move to separate file
Change-Id: Idc4867f1fe266de21e8964e5887aabd545d6c7ee
2019-11-05 14:13:18 +00:00
Bartosz Dziewoński 4021ca1642 Add unit tests for parser#getTimestampParser
Change-Id: I03cba04489194539d6ff3a32acdb9a8fe3d499e5
2019-10-30 00:13:56 +01:00
Bartosz Dziewoński fc34556b04 Fix parsing links to subpages in user signatures
Change-Id: I381087c252eeb7530e63c4d99cecc1b2ee041b0a
2019-10-30 00:13:56 +01:00
Bartosz Dziewoński c83201b10c Fix parsing non-standard case in links to user contribs
Change-Id: I2da72e2731019ad5be0ba33aa229ad914a7aaf10
2019-10-30 00:13:56 +01:00
Bartosz Dziewoński e8012b7094 Fix incorrectly detecting a section heading inside the table of contents
Change-Id: I7209b523c3322b3b379e6aa82a4b2014cc39c404
2019-10-30 00:13:56 +01:00
Ed Sanders a9340f0c84 build: Update linters
Change-Id: Iee2e91b24218c6120f4a20d6ea38ea03c6292ef0
2019-10-28 12:29:56 +00:00
Bartosz Dziewoński 37c9f49cff Re-add debug highlighter
We removed it in c40c112514 when we added
a more practical use for the parser, but I keep wishing I had it to
experiment with the parser code.

Now it's off by default and can be used by adding &dtdebug=1 to the URL.

Change-Id: I6a92bfe7f55af0949b391606b04c3cfa0f996f2a
2019-10-24 23:21:40 +02:00
Bartosz Dziewoński 9efe8b1dd4 Add unit tests for parser#getTimestampRegexp
Depends-On: I6c3d186de1877f73d4a4e3fec7d6d632a5d5fa83
Change-Id: Icdb44f793a8f5e56666ec635bb8b0125041b5aab
2019-10-24 23:21:29 +02:00
Ed Sanders 396b76dc14 Separate parser from init so it can be loaded separate
e.g. for unit tests

Change-Id: I711427721915193e070e1590ab1afc07425840a9
2019-10-23 13:44:49 +01:00
Bartosz Dziewoński 97ce480767 Document methods in parser.js
Change-Id: I9272a619770f805f36686d722eebba586d2650e4
2019-10-22 14:38:53 +00:00
Bartosz Dziewoński 96af61bbc4 Minor naming and comment cleanup after re-reading the code
Change-Id: I5d0309329e56034697070ebadf551ac704323d5c
2019-10-22 14:38:46 +00:00
Bartosz Dziewoński db80e48933 Handle timestamps in daylight saving time
Add the Moment Timezone library. Add a script for managing libraries,
like in MediaWiki core.

Depends-On: I9a59a6ad01850b30327e4215f2be61b8d1c41277
Change-Id: I64bc79e7d0ccdf42b006e5a225c8aa70ea5f4e15
2019-10-22 16:33:21 +02:00
Bartosz Dziewoński 3dc5d79b20 Fix regexp for HTML heading tags
Change-Id: I91b8c2626e76d340da83b9e36a655c3f5158ac3c
2019-10-20 17:18:01 +00:00
Bartosz Dziewoński 282cf3c386 Escape regexp special characters in date formats
For example, the default date format for Japanese (ja) is
"Y年n月j日 (D) H:i", which contains parentheses.

Change-Id: I4fce11f2913959dad06b3846d03df1da1e84e435
2019-10-20 17:17:55 +00:00
Ed Sanders c40c112514 Create simple reply widget demo
Change-Id: I03a98495364babf1b80bf64121efb09097ebe85a
2019-10-20 16:51:07 +00:00
Bartosz Dziewoński b105bf7ded Detect and parse timestamps, signatures, comments and threads
Bug: T232780
Bug: T234404
Change-Id: Ie9c80121089742cfc7cd7c04d694c2e0fe8d6a98
2019-10-18 13:59:07 +02:00