Commit graph

10950 commits

Author SHA1 Message Date
Ed Sanders 007bb6fa09 Refactor diffpage init
Avoid re-rendering the diff if it hasn't changed.

Change-Id: Icbc8eb58625cf7c5485d0045e26993a170016309
2018-03-04 14:45:33 +00:00
Ed Sanders 43ea4c2b51 Fix infinite recursion in positionDiffElement
updateSize eventually calls setDimensions, which calls
positionDiffElement, so protect against infinite recursion.

Change-Id: I07992f337394712000e6e12c637c6e1442869722
2018-03-03 18:47:08 +00:00
jenkins-bot ad6ded970f Merge "ve.ce.MWBlockImageNode: Fix handling of borders" 2018-03-02 13:15:50 +00:00
Ed Sanders c8d0f62095 fetchSpecialCharList: Set directionality
Specifically, set arabic(extended) and hebrew to 'rtl'.

Logically depends on I14abd3e0c0d23f79aa01d96c216eea913024b4c8
to set the dir attribute in UI.

Bug: T56310
Change-Id: I1c7e28d3d2f20ca84115be6d49650cd9a81d78dd
2018-03-01 23:22:45 +00:00
jenkins-bot e7d7d5bab1 Merge "autosave: Don't store initial document state until first change" 2018-03-01 18:47:39 +00:00
jenkins-bot fbbda2a480 Merge "ve.ce.MWBlockImageNode: Remove unnecessary #setupSlugs override" 2018-03-01 18:39:48 +00:00
Ed Sanders 11ac2736a1 autosave: Don't store initial document state until first change
1. It wastes valuable time during setup.
2. If a user reloads the page without making changes we
   should give them the latest html from the server to
   minimise the chance of an edit conflict.

Change-Id: I9a1f8cfd65ef2552fe2c3d6d2bbf975851b52003
2018-03-01 18:25:10 +00:00
Bartosz Dziewoński d239b6ee6a ve.ce.MWBlockImageNode: Fix handling of borders
After change 89aecd54ba (2014),
there is no 'border' value for the 'type' attribute, instead
there is a 'borderImage' attribute only present when 'type'
is 'none' or 'frameless'.

Change-Id: Id87ba09b647f5f69b1c9350209e66acdea2c9d69
2018-03-01 01:08:30 +01:00
Bartosz Dziewoński 5b7c93f0d5 ve.ce.MWBlockImageNode: Remove unnecessary #setupSlugs override
MWBlockImageNode already can't have any slugs:
* It can't have inline slugs, because it can't directly contain
  content (`this.canHaveChildrenNotContent()` is true)
* It can't have block slugs, because it can't contain paragraphs
  (`this.isAllowedChildNodeType( 'paragraph' )` is false).

(The only thing it can contain is a mwImageCaption.)

Change-Id: Ice6505da2356f004ef048ed0b1a9e03d08af02d1
2018-03-01 01:08:30 +01:00
jenkins-bot 6155cd4434 Merge "Remove autoGenerated hack" 2018-02-28 18:41:29 +00:00
jenkins-bot 9840316ee9 Merge "Centralize Parsoid resource name parsing logic" 2018-02-28 15:09:20 +00:00
Ed Sanders 90b6a1b5cf Clarify autosave comment
Change-Id: I0bdaf989886be8537ea45237ceea88a5cca11fc1
2018-02-28 14:36:58 +00:00
Ed Sanders 19d9e9eb98 Tag TODO comments with bug number
Change-Id: I965e8d4bed4fdfa24738ca5cce0ae3f51e7f2b40
2018-02-28 14:36:42 +00:00
Bartosz Dziewoński 98a1bb09c0 Centralize Parsoid resource name parsing logic
Let's keep the ugly regexp and the comments about why we do this in a
single place.

This is mostly without behavior changes, with three exceptions:
* ve.dm.MWImageModel#attachScalable now passes a title with spaces
  instead of underscores to the Scalable (this doesn't matter because
  it's normalized to use spaces later anyway).
* ve.dm.MWImageNode#getFilename now returns a title with spaces
  instead of underscores. This is used in some API queries and when
  rendering thumbnails for missing files, and this format is actually
  more correct for both of these.
* ve.dm.MWTemplateModel now URI-decodes the template title. This
  actually fixes a bug where trying to edit a template transclusion
  whose title contains a '?' would throw an exception about invalid
  title.

Also, clarify that the return value of ve.dm.MWImageModel#getFilename
and ve.dm.MWImageNode#getFilename is different :(

Change-Id: I8e09015cea82308017ed925ec755b7231518126e
2018-02-28 03:01:05 +01:00
jenkins-bot 8727ecd181 Merge "Do not use deprecated jquery.byteLength" 2018-02-27 22:10:23 +00:00
jenkins-bot b5ceb1b956 Merge "ve.ui.MWSaveDialog: Allow limiting comment length by characters rather than bytes" 2018-02-27 22:06:01 +00:00
Bartosz Dziewoński 974ea82c50 Do not use deprecated jquery.byteLength
Change-Id: If3f921d60563bd614c269d1d26b745161f8cfc7b
2018-02-27 22:35:29 +01:00
Bartosz Dziewo??ski dbfe6c0b5a ve.ui.MWSaveDialog: Allow limiting comment length by characters rather than bytes
Bug: T185948
Change-Id: I882d69beb1cd442868c8d73988f5b3a2bbb084bc
2018-02-27 22:35:08 +01:00
jenkins-bot 12323a022e Merge "autosave: Use upstream methods in ve.dm.Surface" 2018-02-27 21:03:52 +00:00
jenkins-bot b3adaa5fc1 Merge "Show notification when document is recovered (or fails)" 2018-02-27 21:03:51 +00:00
Ed Sanders c670ce76ee autosave: Use upstream methods in ve.dm.Surface
Change-Id: I150b21d7767153d8457b5da658bb8b51b5464aa9
Depends-On: I859b57aef9d591597956f3d942dd2cf1b0aecee0
2018-02-27 20:54:59 +00:00
Ed Sanders a46b30a161 Show notification when document is recovered (or fails)
Change-Id: Id2f6651ba7743c05043bbbe64cd9cb7bd762d74b
2018-02-27 20:54:18 +00:00
jenkins-bot c44390e6f8 Merge "Use session storage to auto-save" 2018-02-27 20:20:31 +00:00
jenkins-bot 92470ae024 Merge "Always set sourceMode=true on dm.MWWikitextSurface" 2018-02-27 16:49:09 +00:00
Ed Sanders 76caef6b4b Use session storage to auto-save
Ensure we start with the same HTML (i.e. if an edit has
been made since the crash-recovery):
* Whenever an article target is activated, stash the initial
  document html, other parsoid response data, and the request
  parameters (pageName, mode, section) in session storage.
* Whenever an article is fetched through the target loader,
  recover from session storage if the request parameters match.

Store transactions:
* On document transaction (debounced) append the latest
  changes to session storage.
* If a document state is recovered from session storage,
  attempt to re-apply the stored transactions.

Clear transactions:
* Whenever the target is torn down (i.e. save, deliberately
  closing the editor to go back to read mode)

Other:
* If writing to session storage fails once, disable future
  attempts for that session (assume storage quota exceeded)
* Disable tempWikitextEditor when recovering. We don't have
  the transaction code loaded yet to perform the recovery.

Bug: T57370
Depends-On: I3832243fc347a99641fcb7e39a887a153c9a3b22
Depends-On: I448fb566fe9f7f5b5a76e88b70ca000e3d35b415
Change-Id: Id9d877f903cf4796a52f90991c030417a9f8786f
2018-02-27 12:19:06 +00:00
Ed Sanders 366219e953 Always set sourceMode=true on dm.MWWikitextSurface
Change-Id: Id46d5ef9c8a585784b8fbd55418d012fff96823f
2018-02-27 12:19:06 +00:00
Ed Sanders 31f7015260 Whitelist style tags from Parsoid, e.g. TemplateStyles
Bug: T188143
Change-Id: I7a30d8a8c40de8b786d59c8bf0ebcb77f2baeb2a
2018-02-26 16:52:01 +00:00
jenkins-bot 72756d5a26 Merge "MWImageNode: getHashObject -> getHashObjectForRendering" 2018-02-24 13:42:15 +00:00
Ed Sanders d17121d1f3 MWImageNode: getHashObject -> getHashObjectForRendering
The latter was introduced for this very purpose: defining
which attributes affect the rendering (in this case the
thumbnail URL). getHashObject should be reserved for making
full semantic comparisons.

Bonus: Don't distinguish between block/inline images
for URL caching purposes.

Change-Id: I6e6d2547a0d110f07c4d18b8179c168d8c251059
2018-02-24 12:44:53 +00:00
David Lynch abe3d0a4a5 DiffPage.init: Enforce a valid diff mode
Bug: T173400
Change-Id: I48b97e10fc6c6e2ca84563b58dd0bb8f42fa251f
2018-02-22 11:48:37 -06:00
jenkins-bot 3d93d195c7 Merge "Drop IE10 support" 2018-02-22 00:55:50 +00:00
Ed Sanders 05a504887d Drop IE10 support
Change-Id: Ib1cb8fb32c499ba0bdc87ec55e1e2e95d2eb39ec
Depends-On: I68c882e64fba95d5e1bf41f64658fcef7524dcf5
2018-02-22 00:47:38 +00:00
Jforrester 2e87e03a29 Merge "ve.ce.MWGalleryNode: Ensure we always have a focusable element" 2018-02-22 00:33:23 +00:00
jenkins-bot c5cc11079b Merge "ve.ui.MWGalleryDialog: Handle galleries with 0 items" 2018-02-22 00:31:30 +00:00
Bartosz Dziewoński 180eb91f3f Increase selector specificity for .ve-ce-focusableNode-invisibleIcon
Otherwise our width/height rules are overridden by OOUI styles.

Change-Id: I2bbf81231615e6fcfd95573f5f590b5101e66bdf
2018-02-21 22:30:45 +01:00
Bartosz Dziewoński a5e2f60d7e ve.ce.MWGalleryNode: Ensure we always have a focusable element
For galleries with 0 items, this would previously return an empty
jQuery collection, which caused funny rendering issues later.

Bug: T75230
Change-Id: Ia68e4f1b74b5ec494fa3d86f0b792f69eadb02fb
2018-02-21 22:22:49 +01:00
Bartosz Dziewoński 3d422bac2a ve.ui.MWGalleryDialog: Handle galleries with 0 items
We still don't allow inserting such galleries, but we can handle them
in existing content.

Bug: T75230
Change-Id: I5d7350f00871ac295b0ebc00a633b44570347d85
2018-02-21 22:11:41 +01:00
jenkins-bot dd94837192 Merge "MWTemplateTitleInputWidget: recover gracefully if TemplateData not present" 2018-02-21 18:14:12 +00:00
David Lynch bd64b58071 MWTemplateTitleInputWidget: recover gracefully if TemplateData not present
Bug: T187917
Change-Id: Ica0c853e1a7bc908651260df115d59d1939a7939
2018-02-21 11:53:56 -06:00
jenkins-bot 5de7185687 Merge "Rebaser: Generate random doc name if none provided" 2018-02-21 16:37:36 +00:00
jenkins-bot 8d3e702976 Merge "Disable tempWikitextEditor for section=new on talk pages" 2018-02-21 01:29:58 +00:00
Derk-Jan Hartman 249c52b6a4 Hide historical diff controls when UA doesn't support JS
Bug: T187780
Change-Id: If29974323ef21016edbbb66870914a6dc37e7bbb
2018-02-20 16:54:31 +00:00
jenkins-bot 8f33fc6225 Merge "Add clearfix to diff page's visual diff element" 2018-02-20 16:52:39 +00:00
jenkins-bot d040645244 Merge "Avoid jQuery.parseHTML" 2018-02-20 16:50:06 +00:00
Ed Sanders 7fe496d8ef Avoid hiding generated #toc
Bug: T187636
Change-Id: I713479616feddb01c48c9bb6dda2f9c4aaf182e0
2018-02-20 16:18:27 +00:00
Ed Sanders fcf6ea9e67 Add clearfix to diff page's visual diff element
Bug: T187687
Change-Id: I4de925964fde7b0fffc6540ba821f9a8162cffe7
2018-02-20 15:04:25 +00:00
Ed Sanders ee5b80aeee Avoid jQuery.parseHTML
Bug: T187713
Change-Id: Ic156d6fb670fa2f79cf3c1d5fe0c6272b53b6440
2018-02-19 15:41:20 +00:00
Ed Sanders f2e7361460 Disable tempWikitextEditor for section=new on talk pages
The temp editor doesn't know about the title input
widget yet, so disable for now.

Bug: T185633
Change-Id: I3e44dcc30ee8372080c7cd8c5fc27eb167e24fc6
2018-02-16 18:32:41 +00:00
Ed Sanders 1bef5a03ce Rebaser: Generate random doc name if none provided
Change-Id: Ib790fa5d61df7f2318cd014d5ffa60a3ab3861d3
2018-02-16 18:09:19 +00:00
Ed Sanders 33858c6818 MWSaveDialog: Another check to see if visual diff is still visible
Bug: T187282
Change-Id: Ia29a335bf6b1bad0eeb55b54094475c7fcc18dfe
2018-02-16 15:21:12 +00:00