Commit graph

6504 commits

Author SHA1 Message Date
jenkins-bot 540cb864ca Merge "ve.ui.MWGalleryDialog: Dedupe code for saving properties of each image" 2018-03-12 12:28:10 +00:00
jenkins-bot 2ae3f5f1c2 Merge "ve.ce.MWBlockImageNode: Allow normal CE rendering to handle the caption" 2018-03-10 17:28:34 +00:00
Bartosz Dziewoński 3c676013f8 ve.ui.MWGalleryDialog: Dedupe code for saving properties of each image
Currently this only handles the caption, but there will be more.

Change-Id: Ia8a25de89375d0ba873f4891b053c7aceab15534
2018-03-10 17:16:16 +00:00
Bartosz Dziewoński 26e7728272 ve.ce.MWBlockImageNode: Allow normal CE rendering to handle the caption
Overriding ve.ce.BranchNode#onSplice seems pretty scary, some bug
could cause two captions to be inserted and it wouldn't even be
visible in the editor.

Instead, allow normal splice handling to happen when the caption is
added/removed, and only override the position where it is inserted
(to account for the image node this.$a).

The caption node is already removed from DM/CE if the image type is
changed to one that doesn't have captions, and even if that failed it
is also hidden in CSS, so we don't need to handle this.

Change-Id: I54f52b288118d692708311512dd674cc85d5d9e3
2018-03-10 17:16:16 +00:00
jenkins-bot 00eb598352 Merge "Update rel attribute checks to be aware of multiple rel values" 2018-03-09 21:44:53 +00:00
jenkins-bot 04e5f6f208 Merge "LinkCache: styleParsoidElements find mw:WikiLink with ~=" 2018-03-09 21:44:52 +00:00
David Lynch b6c6d10d1e ce.MWTransclusionNode: increase invisible selector specificity
5f6664e2 in VE core changed the specificity for some of the rules this
expected to override.

Bug: T189267
Change-Id: I510e151cc431c321d1d45fde9030d56f059d84ab
2018-03-08 19:27:52 -06:00
David Lynch 4e10d5b975 Update rel attribute checks to be aware of multiple rel values
Various checks didn't think a rel attribute could contain multiple values.
Mostly they don't, but to play it safe let's adjust the checks.

Change-Id: I29823b7c8c65ef6b2ff41ce9a801840000972e9c
Depends-On: I33a456351ab025d0c81cfb1a1577d5a2ae9df51a
2018-03-08 14:34:56 -06:00
jenkins-bot 8e79d85583 Merge "Blacklist Web of Trust junk from being added to pages" 2018-03-08 00:33:48 +00:00
David Lynch f8c5608caf LinkCache: styleParsoidElements find mw:WikiLink with ~=
`noopener` being added to the rel caused issues.

Bug: T189175
Change-Id: I33a456351ab025d0c81cfb1a1577d5a2ae9df51a
2018-03-08 00:14:16 +00:00
Bartosz Dziewoński b05ac142c6 Blacklist Web of Trust junk from being added to pages
Bug: T189148
Change-Id: Icc4b2d0ddf5104e26a3f563816f6f971d71e2531
2018-03-07 22:12:43 +01:00
Ed Sanders 045f3b7640 Follow-up I5357a909: Fix logic for autosave from edited state
Bug: T189071
Change-Id: I5439a73ffcf26795f58625720b1f1667ee3965cc
2018-03-07 18:43:28 +00:00
Jforrester 16437646fe Merge "Update VE core submodule to master (ca771b8bc)" 2018-03-06 13:14:21 +00:00
James D. Forrester d144599cea Update VE core submodule to master (ca771b8bc)
New changes:
7551f6c66 [BREAKING CHANGE] Rename class ve.dm.IndexValueStore->ve.dm.HashValueStore

Local changes:
Follow-through rename of IndexValueStore->HashValueStore

Bug: T188900
Change-Id: If60d0c637fe92f0e7afe916c064fafb17980d063
2018-03-06 12:55:30 +00:00
jenkins-bot eb125877e2 Merge "Revert "For empty / whitespace-only headings, output <p> instead of <h#>"" 2018-03-06 12:22:31 +00:00
Ed Sanders a274bdb8f7 Revert "For empty / whitespace-only headings, output <p> instead of <h#>"
Parsoid now handles empty headings for us in
scrub_wikitext mode (which we use).

This reverts commit 884f301aa0.

Bug: T187913
Change-Id: I8690bbced64be76622929f78f9c9e0d8f85d4be8
2018-03-05 23:27:52 +00:00
David Lynch 09237b71ef mwExample: add test case for cross-document numberedlink paste
Bug: T188429
Change-Id: I722f30f07abd65dba93e9ba297b6933ef8ca79c2
2018-03-05 13:35:25 -06:00
David Lynch 795b428477 MWNumberedExternalLinkNode: set an explicit type
This lets copy-paste between documents retain the numbered status rather than
falling back on pasting "<a>[3]</a>".

Update the part of LinkCache which selects on mw:ExtLink, so it will handle
possible multiple values in the link rel.

Bug: T188429
Change-Id: Ia5e4c9fa45e94da9cbfcd2a42d017d0fda1c511f
2018-03-05 11:59:41 -06:00
Ed Sanders 4c759e2587 autosave: Handle switched document with no transactions
Always store immediately if fromEditedState is true. Also
now that we only store if there is state to recover, remove
the check for transactions before deciding to show the notification.

Change-Id: I5357a9098b91e303f5c71881ea03a080d2969fff
2018-03-04 23:40:24 +00:00
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