Commit graph

199 commits

Author SHA1 Message Date
Alex Monk ac2242af5f Follow-up I18162f04: Set contentType: 'multipart/form-data' on some requests again
But not all

Change-Id: If9d88bb8d6c532992e8118e504f2fae45c0ca96a
2015-02-26 01:24:16 +00:00
Alex Monk 8e48f94580 Use mw.Api to run requests rather than our own stuff in ve.init.mw.Target
Bug: T58659
Bug: T89435
Change-Id: I18162f04c50f48606378aed62ee99fccdc3159f6
2015-02-25 01:57:22 +00:00
Roan Kattouw 86e1d1214b Factor out the Parsoid API request into its own method
This will allow us to more easily split the API request
into two requests (one for the HTML, one for metadata)
by returning a $.when() promise, and to initiate these
requests earlier (by storing a promise and returning it
in this method).

Change-Id: I4a5d1b8c47a3dc2edfe89925e63dcf90d7038e45
2015-02-24 02:41:21 +00:00
Roan Kattouw 3611664663 Update VE core submodule to master (7d2a68e)
New changes:
0ceafd5 Fix V8 deopt for ve.ce.BranchNode#onSplice
01d2d4b [BREAKING CHANGE] Store originalDomElements instead of htmlAttributes
96005a7 Localisation updates from https://translatewiki.net.
42e672e ve.ui.Toolbar: Don't call #updateToolState from #initialize
373562d Localisation updates from https://translatewiki.net.

Local changes:
Update for htmlAttributes going away

Change-Id: I576a1e5d5883b03d1fff6666926f80a5682a280f
2015-02-18 15:35:46 -08:00
Roan Kattouw 71a26929e4 In setupSurface, build the model tree separately
Otherwise it gets built lazily when building the view tree,
and that makes it difficult to instrument it separately.

Change-Id: Ie8c2027e87a87e59323165f0edbba49c4a66d1b3
2015-02-18 21:12:36 +00:00
Roan Kattouw 70db70bc0e Add a bunch of trace.foo.{enter|exit} events logged through ve.track()
Tracked stages are:
* activate: wraps the entire activation
* domLoad: API request for Parsoid HTML
* parseResponse: parse HTML, interpret things like link cache data
* convertModelFromDom: create linear model from Parsoid DOM
* createSurface: build DM and CE trees, create DM, CE and UI surfaces
* initializeSurface: initialize UI and CE surfaces, and CE nodes
* setupToolbar: toolbar setup and attachment
* initializeToolbar: toolbar initialization (deferred so not wrapped by activate)

Bug: T89536
Change-Id: Ife5664e872bad68dcf3c123f274f9c8a38a06031
2015-02-18 21:11:25 +00:00
Roan Kattouw 237bb053d6 Remove the sanity check
It's slow, especially on large pages, and it's triggered
very infrequently these days, and only for known bugs.

In the future we should replace this with a debugging
interface that displays the DOM diff between the original
DOM and the round-tripped DOM, as opposed to the boolean
interface we have now.

By extension, this also means the visualeditor-needcheck
tag won't be applied to new edits any more, although
its registration and messages are kept around because
edits with this tag still exist in page histories.

Bug: T87161
Change-Id: I909153492a5786b4b69fccd42ce3c1d4bdb3a059
2015-02-17 17:14:34 -08:00
Roan Kattouw 70c64e0613 mw.Target: Hopefully fix plugin garbage removal code
Follows-up 0547d8c8.

It's still very difficult to test whether this code works, but
doing $( newDoc ).remove( 'selector1' ).remove( 'selector2' )...
demonstrably doesn't work, because 1) the selector passed to remove()
filters the collection, it doesn't descend into it, and 2) remove()
returns the collection of removed items, so chaining it doesn't work.

Instead, use $( newDoc ).find( 'selector1, selector2, ...' ).remove();

Also normalise selectors.

Change-Id: I97f3b28c4d5120f08e5d7fbf4598ddc0c01d4ecf
2015-02-17 23:52:41 +00:00
Ed Sanders 2b48c4991e Fix DOM structure on setup/teardown
* Ensure that the toolbar remains inside the target so that
  target triggers still work
* To keep the page title beneath the toolbar, move it inside
  the target on setup, and restore it on teardown
* Have teardownToolBar/DebugBar return promises so we know
  when teardown is completely finished.

Change-Id: If2a9ce9a653aed51d21c8e8dd7795f2533d54f70
2015-02-10 16:59:43 -08:00
jenkins-bot 3351d84bf0 Merge "[BrowserTest] Restore the indentation list screenshot scenario" 2015-02-05 09:17:55 +00:00
jenkins-bot b43e798bb4 Merge "Make API module's LinkCache data transmission format more efficient" 2015-02-04 01:18:21 +00:00
Roan Kattouw e367ecc948 Make API module's LinkCache data transmission format more efficient
We used to send data like { title: { missing: true|false } }
With this change, we send data like { missing: [titles], existing: true|[titles] }
where 'existing' is set to true (assume all non-missing titles exist)
for current revisions and to an array of existing titles for
old revisions.

This is because we always output this data for links in the current
revision, even when loading an old revision: in that case we rely
on the client to request the omitted information, so there we can't
assume that all pages we don't have information about exist.

Bug: T88259
Change-Id: I7b58b3f669cc78fd81b60859cf76928a9087066f
2015-02-03 11:30:40 -08:00
Timo Tijhof 1d00894497 mw.Target: Add mw-body-content class before we attach surface
If added afterwards, this causes child elements styles with
'em'-values to get redrawn (or even animated).

Bug: T88387
Change-Id: Ic1aba14b7cfe0ff6e7191f0b6052ed9cc4585fcd
2015-02-02 20:25:02 -08:00
James D. Forrester bed038b509 build: Bump devDependencies to latest
Updates:
* grunt-contrib-csslint  0.3.1  ->  0.4.0
* grunt-contrib-jslint   0.10.0 -> 0.11.0
* grunt-jscs             0.8.1  ->  1.2.0

For jscs, leaving requireSpacesInsideArrayBrackets to avoid headaches for now.

Change-Id: I62d34444edbba65c8bd22d2fa5e50e16cabb0042
2015-02-02 14:30:39 -08:00
Alex Monk 9841d1012c Update "Watch this page" option when necessary
On load and change the user presses the button

Bug: T78694
Change-Id: I1df2836f8ba4ae647bfb142513e5de9f32ecd0fe
2015-01-31 02:43:59 +00:00
Amir E. Aharoni 8da4c9b3cc [BrowserTest] Restore the indentation list screenshot scenario
* Add a class to the indentation toolbar button, similarly to what was done in
  Ib0cb67151d893a5d2efccf798d6b25d197ed34d2
* Fix the definition of the indentation pull-down element acordingly.
* Restore the Indentation menu screenshot scenario, which was disabled in
  I3e892baa9cb2c8c1303fab232a2b1c64ebdd8f26

Change-Id: If2d92aab6d04aa487d6f753fa7cac94f8d8215c8
2015-01-27 13:35:39 -08:00
jenkins-bot 7dee4f18d7 Merge "Don't rely on 'user' and 'site' modules working correctly" 2015-01-26 22:31:28 +00:00
Roan Kattouw 6623ff4197 Use DOM rather than jQuery for <base> resolution
Avoiding a Sizzle context switch, see https://github.com/jquery/sizzle/issues/311

Bug: T87416
Change-Id: I40dd2cb17f9c3d14d0ee1aa5b542263775feedb7
2015-01-26 10:00:32 -08:00
Bartosz Dziewoński 4cce592cce Don't rely on 'user' and 'site' modules working correctly
I think somebody somewhere pointed to this as the reason why VE
wouldn't load when user's common.js has syntax errors, but I actually
can't reproduce that. Not sure if this is needed, but looks like a
good idea anyway.

(Once more, with feeling. Reverted broken attempt: aa531488.)

Change-Id: I252c5c20f75b3bbea51200560408dc4cfc7174f6
2015-01-13 19:18:54 +00:00
James D. Forrester 2f8b3e0d96 build: Bump copyright notices to 2015
Change-Id: Ie92dab7411116d3410195c3fb0a3513c664c0c30
2015-01-12 20:34:19 -08:00
Jforrester c17e3f89c6 Revert "Don't rely on 'user' and 'site' modules working correctly"
This reverts commit aa53148852.

Bug: T86550
Change-Id: Id97dec739939312caaa10d36197f105a595c1365
2015-01-12 18:49:39 +00:00
Bartosz Dziewoński aa53148852 Don't rely on 'user' and 'site' modules working correctly
I think somebody somewhere pointed to this as the reason why VE
wouldn't load when user's common.js has syntax errors, but I actually
can't reproduce that. Not sure if this is needed, but looks like a
good idea anyway.

Change-Id: I3abecacf083c1c9dfb2ea30207a9911eeea54b50
2015-01-11 19:01:56 +01:00
Amir E. Aharoni cd4bd7a73c Add classes to toolbar UI elements
This cleans up the selectors for the elements on the toolbar
so that they can be tested.

Class names in the form of ve-test-* are added to elements
that have words for labels: 'Paragraph', 'Cite', 'Insert'.
There is no other way to look up these elements in the DOM
except using the UI text, but it is different in different languages,
so this is unusable for the language_screenshots job,
which is multilingual by its nature.

Bug: T76143
Change-Id: Ib0cb67151d893a5d2efccf798d6b25d197ed34d2
2014-12-30 12:16:44 +00:00
Timo Tijhof 2b7ae8c175 Remove use of bind() for inline functions
Follows-up b0e8900, 447e8de, d3f26e65.

Contrary to binding a reference, this-overiddes for inline
functions gets messy and fragile. There's also a minor
performance overhead that can be avoided. No separation of
concerns, eiter, as the object is held by the closure.

Also:
* Remove left-over instances of @method.
* Remove redundant '0' argument to setTimeout.
* Use null instead of $ for apply() on static methods like $.when.
* Use .empty().append() instead of .html(). Does the same but
  without additional overhead and without confusion association
  with "html" which isn't used (it doesn't serialise and re-parse
  or clone, it just appends when given one or more nodes).

Change-Id: I797a3667c67d52568150be9be5d043d149f22077
2014-12-16 23:27:53 +00:00
Ed Sanders 45518019eb Update VE core submodule to master (9ac8136)
New changes:
9929b6d [BREAKING CHANGE] Make ve.init.target an OO.ui.Element

Local changes:
* Fix target constructors now they generate this.$element

Change-Id: Ia6bf604c67305834a3f73863a10336cfbb83fa77
2014-12-11 14:00:28 -08:00
Ed Sanders d6067d5718 Update VE core submodule to master (cf1e167)
New changes:
776e801 Delimit text nodes in debug observations
72643bc Remove debug bar hiding now it is handled by the surface
cf1e167 [BREAKING CHANGE] Multiple surface support and demo

Local changes:
Account for detachable toolbars in core being setup in a different order.

Change-Id: I29156948711d55ba5f6dd4f6c35ca0e4cca32373
2014-12-11 12:49:29 -08:00
Ed Sanders 34a82928c1 Update VE core submodule to master (3feadb2)
New changes:
fc4af20 Fix filibuster expansion bug
3feadb2 [BREAKING CHANGE] Refactor for multiple surfaces

Local changes:
* Use target.getSurface now that targets can have multiple surfaces
* Remove debug bar code now surfaces manage their own
* Remove import rules code now implemented in base target

Change-Id: I18d6f9f2f36431959d31347b4c1952a1aca1350e
2014-12-10 16:39:10 -08:00
Roan Kattouw 29995d806b Remove IEHacks.css in favor of .ve-init-target-ie class
Move reference style hack to MWReferenceNode.css, and move
heading style hack to ve.init.mw.Target.css

Change-Id: Icbd53f8df998c9f7bcc701b7c29dc226dfc5c05f
2014-12-08 15:45:23 -08:00
James D. Forrester baffe9d7e1 Update VE core submodule to master (32397d8)
New changes:
5e60f12 Ensure clipboard key is removed from paste target
32397d8 Update OOjs UI to v0.4.0

Local changes to compensate for new OOUI version, and updated wfUseMW call.

Change-Id: I005f7b23a36e04f1305d4aa037c19a5c7db9a699
2014-12-06 12:28:07 -08:00
Ed Sanders 7dc4dd66a0 Remove duplicate startSanityCheck from ViewPageTarget
Method was moved to parent, but not deleted from child. Also move
sanityCheckPromise to parent where it is used.

Change-Id: Ie2b00330d796cd089fd4bc84d9332c316500633f
2014-12-01 19:19:51 +00:00
James D. Forrester e90cbe6a37 Follow-up I5bc30eca7: Register <visualeditor-formatdropdown-format-blockquote>
Also push it into correct place in the toolbar, and disable it from media and
reference dialogs' toolbars.

Change-Id: Icc3bf056860e35def13e03e77ffc6782acc4196a
2014-11-25 19:01:02 -08:00
jenkins-bot a7dc4af551 Merge "Catch pagedeleted errors and give the ability to re-create the page" 2014-11-25 19:42:58 +00:00
Ed Sanders f79aed7572 Update VE core submodule to master (8ca8c41)
Local changes:
* Rename paste rules to import rules (also used by drag and drop)

New changes:
f5d83f8 Remove data-parsoid removal hack
99f938f Create 'preserveGenerated' mode for cloneElements and use in copy
938b44d [BREAKING CHANGE] Rename paste rules to import rules
c51288c ve.ce.Surface: Move insert HTML path to DM
10ce4cf Provide a FileDropHandler for HTML files
701bb9c Provide a FileDropHandler for CSV and TSV files
ca6b444 build: Update update-oojs.sh and update-oojs-ui.sh scripts

Change-Id: I5cfa15ab3efd03e2c64c2f9f725cb3098f53b32a
2014-11-24 18:55:32 -08:00
jenkins-bot 5861db05b0 Merge "Filter out comments from external paste" 2014-11-25 02:07:24 +00:00
jenkins-bot 330a1732cb Merge "Change command list from whitelist to blacklist" 2014-11-25 00:42:48 +00:00
jenkins-bot 35cbae3d76 Merge "Fix the "you are now logged in/out" warning" 2014-11-25 00:19:14 +00:00
Ed Sanders c56a921585 Change command list from whitelist to blacklist
Also remove toolbar definitions as they can now be derived from
command availability.

Depends on If32d514a in core.

Change-Id: I2313f3cc2531686b27f96dc1110b28bb4b295f89
2014-11-24 18:28:37 +00:00
Ed Sanders 325bd0994e Filter out comments from external paste
Bug: T71821
Change-Id: I165efd75adf3d4092860c6d2bc408469dba31388
2014-11-24 11:20:18 +00:00
Roan Kattouw 9b3316a360 Fix the "you are now logged in/out" warning
It would tell you you were logged out when you were actually
logged in, and when I looked into it, I found lots of broken
things, including lots of confusion between the current
anon-ness and username and the new anon-ness and username.

ve.init.mw.Target:
* Check the new isAnon value, not the old one
* Pass the username to the event, rather than just anon-ness

ve.init.mw.ViewPageTarget:
* Use the passed username (new username) rather than the
  username from mw.config (which is updated, but confusing)

Change-Id: Icf406d49100d81e87c677fd6b57ff93cc29f601f
2014-11-21 18:23:11 -08:00
Alex Monk 9bb766c5bb Catch pagedeleted errors and give the ability to re-create the page
Bug: 52073
Change-Id: I86a6e1510ccb5e59e94a5262dd3ccd91fdf05a70
2014-11-21 21:44:15 +00:00
Roan Kattouw 6d21d83244 Add instrumentation for edit schema
Move ve.track() subscriber to its own file, and have it
route mwtiming.* events (for TimingData) and mwedit.* events
(for Edit schema) differently. Most of the data population
lives in the subscriber, so actual ve.track() calls are
pretty lightweight.

Existing ve.track() calls with timing data were kept with
their names intact for backwards compatibility, but
we may eventually want to throw them out and start from scratch.

ve.init.mw.ViewPageTarget.init.js:
* Remove old track subscriber
* Track init and ready events
* Remove old ve.track( 'Edit', ... ) crap that didn't work

ve.init.mw.ViewPageTarget.js:
* Fire the saveWorkflowBegin event before the save dialog
  loads rather than after
* Remove unnecessary this.events.trackSaveError() calls:
  TargetEvents already listens to these events itself
* Remove badtoken handler because all it was was an
  unnecessary trackSaveError() call
* Add abort tracking
** Pass trackMechanism through deactivate() and cancel()

ve.init.mw.Target.js:
* Add static.integrationType to populate the 'integration'
  field in the schema

ve.init.mw.TargetEvents.js:
* Simplify onSaveError* methods away into connect bindings
* Map track topics to mwtiming.* so they can be routed separately
* Track save-related mwedit.* events

Depends on I978eda96c in WikimediaEvents

Change-Id: Iae677d9b15c71d2b18e795bd5179d11876c06abd
2014-11-21 11:59:15 -08:00
Ed Sanders 2997cee444 Fix lots of spelling mistakes and typos
Change-Id: Icf78d3d599326d3f12d09edcd2b8491ed35ade04
2014-11-21 13:00:50 +00:00
Alex Monk 581d1350e6 When saving, return the full contentSub to the client
And introduce code to make FlaggedRevs add its notices to contentSub.

Bug: 60718
Change-Id: Ibb91dc563ccf73d3b4bd1994134ccf02634fccb5
2014-11-12 17:36:59 +00:00
Roan Kattouw e144e55972 Followup 31bafa1: forgot to rename 'data' to 'args' for citation commands
Bug: 73001
Change-Id: I8cc436cbe16955130d25b2385e3f561fd2ffb4d5
2014-11-05 13:46:54 -08:00
James D. Forrester 31bafa183d Update VE core submodule to master (a942301)
New changes:
2cc219a Update OOjs UI to v0.1.0-pre (571f26d0ab)
3543cb7 Protect against offset=-1 in insertContent()
7a3d456 [BREAKING CHANGE] Move selection restrictions from tools to commands
3d847bb Disable desktop context on table selections
41282dd Missed function rename from RangeFix change
dd6c8b8 Support toDomElements returning an empty array
9be6464 Placholder -> placeholder
9bdd0a8 Restore basic styling to toolbar in core target (only)

Local changes:
Move selection restrictions from tools to commands

Change-Id: I88f3d04946bd1d03ed001d747475a8b495a0f64c
2014-11-04 14:11:04 -08:00
Alex Monk b2af92870a Update "page was last modified on date, at time" footer line when saving
Bug: 52403
Change-Id: I11e00066000e927f0551691d05fe11fe2ae125b0
2014-10-31 01:00:04 +00:00
James D. Forrester 6626450419 Toolbar: Make styling and insert menus collapsible
Also re-synchronise toolbar in MWMediaDialog and MWReferenceDialog.

Change-Id: I8cd5f0d9f7e188fa1a7ab8d34a2796340f5e99b7
2014-10-30 12:22:20 -07:00
James D. Forrester cc8f6970a5 Update VE core submodule to master (f4ff1d6)
New changes:
d845991 Data model implementation for tables
a27c148 ContentEditable implementation for tables
3c47428 Actions and context menus for manipulating tables
543ca54 Support annotation tool on table selections
149cf3d Supporting copy paste of single table cells
25c9eee Table header/data format tools
e557e46 Merge cells tool
afcf2d9 Allow custom type and attributes when creating a table

Local changes:
Add the files and messages for table editing

Change-Id: I6e6c33b96d3089049a0fd5385191caa83df5756b
2014-10-29 11:52:09 -07:00
Ed Sanders 1af18c3c12 Update VE core submodule to master (984b57a)
New changes:
6bbcd6a Localisation updates from https://translatewiki.net.
b8d8a5b [BREAKING CHANGE] The Great Selection Rewrite of 2014

Local changes:
Update to use new selection/range API

Change-Id: I5480d5c77d599c93c2d374fac88bb2fdb68b0024
2014-10-07 21:39:33 +02:00
Roan Kattouw 005c6fef27 Fix syntax error in mittoHidden selector
Bug: 71521
Change-Id: Id34987e992a7c13cdfcfec85a7c33f7538606fe0
2014-10-01 11:04:31 -07:00