Commit graph

295 commits

Author SHA1 Message Date
jenkins-bot 0c094837fb Merge "Place cursor at start of paragraph, not heading, when section-editing" 2013-06-24 21:30:18 +00:00
jenkins-bot 488664e3d2 Merge "Scroll to correct offset after using a section edit link" 2013-06-24 21:29:31 +00:00
Ed Sanders 138b9365c2 Place cursor at start of paragraph, not heading, when section-editing
Also checks for subheadings, i.e. we keep moving forward one sibling
as long as the next sibling is a heading of higher order than the
previous one. If the heading is of the same or lower order then we
assume there is an empty section, so we just stop.

Bug: 49563
Change-Id: I6fcc463aeeae40278f5caf04ae251c8ecfe65472
2013-06-24 22:27:01 +01:00
Ed Sanders 983847bfbc Setup section edit links again after page save
Bug: 49620
Change-Id: Idf938c0dc8535c30ce63a05d56abeee210a67380
2013-06-24 22:22:54 +01:00
Ed Sanders 1889495aa2 Scroll to correct offset after using a section edit link
Needs to wait 200ms so it account for toolbar height.

Bug: 49563
Change-Id: I3a57e64f54289a3263814b4fbfe00c63de4a490b
2013-06-24 19:52:24 +01:00
Ed Sanders 2352613b66 Code style fix: (X) -> ( X )
Change-Id: I7f3ac95621f70d9a89e70e9a51905673240cb51f
2013-06-24 18:51:59 +01:00
jenkins-bot 2502f2e3ac Merge "mw.ViewPageTarget: Blacklist IE9/IE10 until blocking issues are resolved" 2013-06-24 01:31:43 +00:00
Timo Tijhof 947da63502 mw.ViewPageTarget: Clear slide history when closing the save dialog
Bug: 49481
Change-Id: I297a7d1458e5a1c33b9dcb85272fe5f40893dd88
2013-06-23 17:35:04 -07:00
Timo Tijhof ef6fae606f mw.ViewPageTarget: Blacklist IE9/IE10 until blocking issues are resolved
Bug: 49187
Change-Id: I2ee2e33c89cac58863c9911fc3ad250c72a46206
2013-06-23 17:04:44 -07:00
Timo Tijhof 8a2c9431e6 Create ref list insertion tool
Fixes (follows-up I1b48ef5240, I6daff5c596):
* Invalid html passed to jQuery constructor.
* Use prop() instead of attr() for boolean values.
* Use append() instead of html() when appending nodes instead
  of parsing html.
* Rename shadowed variable name clash 'mw' to 'mwData'.
* Fix odd construction where we parse '{}' to create an empty
  object.
* Have ve.ce.MWReferenceListNode#update perform changes off-document
  in a detached tree.
* Fix deep property access that can fail. mwData is set to
  either JSON parse of data-mw attr or empty object.
  Accessing mwData.attrs.group needs to be guarded by whether
  mw.attrs is indeed set.
* Have `mw` and `about` attribtue in references list roundtrip
  (especially mw which can data we aren't editing/re-creating).
* Add missing 'refGroup' property to MWReferenceListNode's
  data element (similar to what MWReferenceNode already has).

Change-Id: I67e4f378ccd04e97361d8e58ae57db5353075756
2013-06-22 20:23:22 -07:00
jenkins-bot e10ba45a81 Merge "mw.ViewPageTarget: Use native .focus() rather than jQuery's .focus()" 2013-06-21 21:28:03 +00:00
Roan Kattouw 3a5ec39ab5 mw.ViewPageTarget: Use native .focus() rather than jQuery's .focus()
jQuery's implementation does some sort of traversal, so on large pages
it took 300-400ms just to focus the document node.

Change-Id: I0de95d8800a1aedeb19b27d204dfd8fd08cec533
2013-06-21 21:25:44 +00:00
Timo Tijhof 03dbf56f76 mw.ViewPageTarget: Move non-annotation buttons to a new tool group
Change-Id: I04784357d3590c43af90c60da4b5a67bbf10ac70
2013-06-20 19:55:55 -07:00
Timo Tijhof 85c4ebf373 mw.ViewPageTarget: Move save dialog out of toolbar tree
Bug: 49275
Bug: 49361
Change-Id: I2fbc4c8af943f1b096b8912191924961405d5c47
2013-06-20 14:16:50 -07:00
Trevor Parscal 4a7503ac10 Add templates from toolbar
Change-Id: I0aa21bed13d1dbc693c1db03eab903af55a1517a
2013-06-19 00:23:23 +00:00
Timo Tijhof 01f9e560b4 mw.ViewPageTarget: Use ES5 methods instead of strict mode as test
In aaa5ad2 we introduced a feature test. However though we do require
ES5, we don't (yet) use strict mode. It is an easy and solid one to
feature test, but it the unfortunate reality is that IE9 does not fully
support ES5. Strict mode is among the features it didn't (correctly)
implement. As a result commit aaa5ad2 locked out IE9 completely.

Replacing it with a more explicit (and harder to maintain) test that
does pass in IE9. We now need to be very careful about using ES5
features in our code. It has to be in this list here to avoid breaking
in a browser that doesn't support it.

Change-Id: I77b623e15a0791bfaa2cd835e43107cefb3c25f5
2013-06-18 14:22:29 -07:00
Ori Livneh f11b9e8c79 Address Krinkle's review comments from I51c441d61
See <https://gerrit.wikimedia.org/r/#/c/69161/1/modules/ve/init/mw/ve.init.mw.splitTest.js>.

Change-Id: I14442070c0998d724d67ec41cca813ef5bce2c19
2013-06-17 19:04:27 -07:00
Ori Livneh ccfb14b99d Split test: instrument edit events for standard editor interface
This change adds 'page-edit-impression', 'page-save-(attempt/success)',
and '(section-)edit-link-click' events to the standard (non-VE) editor
interface, mirroring the events we added to VE. This makes the event data
usable for split-test analysis.

Change-Id: I51c441d61daa18d58ca7f62a9e5f07902a099050
2013-06-17 14:14:57 -07:00
Ed Sanders dcbea2328c Code style fix: @return -> @returns
Change-Id: I26daca6313bf09055af8f980ba0065782257fd54
2013-06-17 11:50:24 +01:00
MatmaRex 704440eb56 Remove handling of old 'editsection' class
It's been replaced with 'mw-editsection' and all cached renders on
Wikimedia wikis have expired by now. All backwards-compatibility
occurences have been removed from MediaWiki core already.

Change-Id: Id3731222445b588de8aec0e86892879ac4472636
2013-06-15 20:02:48 +02:00
Ori Livneh fe54db5141 Log user ID; 'pageViewSessionId' to alphanum string
By default, EventLogging uses INT columns for integers, which pageViewSessionId
overflows. I changed it to a STRING type in the schema and am now generating it
using 'mw.user.generateRandomSessionId()'. I also introduced a 'userId'
property, per bug 49585.

Bug: 49585
Bug: 49586
Change-Id: Iddb9eb9c64b55b25445ddf9e474d312b685978a6
2013-06-14 11:19:24 -07:00
jenkins-bot f814842108 Merge "Update 'wgCurRevisionId' after successful save" 2013-06-13 22:12:06 +00:00
Roan Kattouw 3674c8937b Send section edit links to VE by default
Add a preference to disable this behavior. Requires rewording by James.

Bug: 49260
Change-Id: I5ce7ea8c1e47e8243b619fc61aa957f767d22b48
2013-06-13 15:04:02 -07:00
Ori Livneh 1780b4e39c Update 'wgCurRevisionId' after successful save
Also updates the EventLogging code to use a computed property for
'wgCurRevisionId'.

Change-Id: Ida648c77f56c0e455d6fb49a779a831734f6776b
2013-06-13 13:30:14 -07:00
jenkins-bot dc4ceb9f56 Merge "Add ability to log analytic events using EventLogging" 2013-06-13 17:20:21 +00:00
Ori Livneh efba2cf8da Add ability to log analytic events using EventLogging
This change adds a '$wgVisualEditorEnableEventLogging' configuration
variable, accessible client-side as
'wgVisualEditorConfig.enableEventLogging'.

When true, the 'schema.Edit' ResourceLoader module will be loaded on the
page, and calls to ViewPageTarget.logEvent will forward to
mw.eventLog#logEvent.

When false, the module is not loaded, and ViewPageTarget.logEvent is a
no-op.

The change also adds a few calls to ViewPageTarget.logEvent to log certain
editor actions, documented in https://meta.wikimedia.org/wiki/Schema:Edit.

Change-Id: Iccd171d7cde15b0302d1b4c292bcbcc2a4b337ef
2013-06-13 10:14:53 -07:00
jenkins-bot 2bccb3da85 Merge "Replace alpha notice with beta label hiding the feedback link" 2013-06-12 17:16:42 +00:00
jenkins-bot 06bf3b7864 Merge "mw.ViewPageTarget: Implement veaction=edit history state" 2013-06-12 11:16:31 +00:00
James D. Forrester 198caeb603 Replace alpha notice with beta label hiding the feedback link
Bug: 48428
Change-Id: I725beec4e76dadfb1ccca873758f8f37b7f58a73
2013-06-11 18:17:10 -07:00
Trevor Parscal 8039b1c2f8 Insert Reference
Objective:

* Allow opening reference dialog with arbitrary selection
* Auto-insert reference when selection is not a reference node

Changes:

ve.init.mw.ViewPageTarget.js
* Added reference button to toolbar

ve.init.Target.js
* Add getToolbarSubset so we can exclude the reference button from
  the toolbar in the reference dialog (nested references are not
  allowed).

ve.ui.MWReferenceDialog.js
* Stop storing referenceNode (not needed)
* Only store internalItem on open if there's a focused node that's a
  reference
* Use wrapper paragraph when creating a new reference
* Create new reference on dialog close if required

ve.dm.InternalList.js
* Major rewrite to support key less references.
* Add new method for creating a transaction to insert a new iternal
  item. Also returns the index of the new item to be passed to the
  reference node.

Change-Id: I839ae165c299248484ce93d4ab087318a95fbb94
2013-06-10 20:14:08 +01:00
Christian Williams babaa4118d FocusedNode Selection
Introduction of fake selection for single focused nodes. This
change specifically makes the selection much nicer in appearance
for Chrome users selecting floated FocusableNodes (block images)
for example.

Added ve-ce-surface-highlights DOM element to contain styled
highlight elements.

Made adjustments to getSelectionRect to return fake selection
bounds if necessary.

Replaced old uses of showSelection with model.change().

Change-Id: I96e66567cdce6455ef3eb77568e72f23140448ff
2013-06-07 17:49:35 -07:00
Timo Tijhof a0d764b8ee mw: Remove 'Report problem' feature
Removed the "report" slide from the mw.ViewPageTarget save
dialog and everything that becomes obsolete as a result of it:

* JS saveDialogReviewWrongButton, which pointed to the report
     slide (was already hidden as of I90de95f6337ee).
* JS ve.init.mw.Target#reportProblem.
* JS ve.init.mw.ViewPageTarget#diffHtml.
* JS ve.dm.ElementLinearData#getUsedStoreValues.
* PHP mw.config wgVisualEditorConfig.reportProblemURL.
* PHP $wgVisualEditorParsoidProblemReportURL.
* I18N visualeditor-savedialog-title-report.
* I18N visualeditor-savedialog-label-review-wrong

Change-Id: I8a5e0ab2060d7c14086bba413d4c7d73b29c9b97
2013-06-08 01:11:27 +02:00
Timo Tijhof d5868a0f13 mw.ViewPageTarget: Make 'review' step optional in save flow
Summary:

Instead of having a button "Review and save" that opens with a
diff and leads the user to the "Report a bug" and "Save page"
slides respectively, make it more like the default EditPage.

There is now a "Save page" button that opens with the save
form with a button to "Review changes" (diff) or "Save page".

The "Report a bug" slide has been unlinked from the UI and is
no longer accessible for now.

As a result of the UI no longer requesting a diff upfront this
also means we will no longer detect "nochanges" event (when it
turns out the submittted revision matches the latest version).

This is unfortunate as it was a nice feature to detect it
before the user spends time writing the edit summary) but it
is the same as how the default EditPage works.

Changes:

Improved interface messages.

Adapted "nochanges" caption to the new context (it is no
longer shown when clicking "Save page", it is now shown as a
result of clicking "Show changes").

Now that the "save" slide is accessible from multiple paths
it is needed to keep track of slide changes in a history
array. Previously the slide tree was 1 level deep with
everything descending from "review". Now it starts at "save"
and can go in multiple directions including a loop from
save>review>save. We also need to toggle the "Prev" button
based on history instead of based on whether or not we are
on the "first" slide.

Hid the "saveDialogReviewWrongButton" from the review slide.
We're approaching wider launches and this will not scale to
a wider audience.

Bug: 49258
Change-Id: I90de95f6337eeddd794b75d56543d8d152421a6f
2013-06-08 01:05:05 +02:00
Trevor Parscal 1fd7e85846 Image insertion
Objective:

* Allow inserting images from local wiki and commons

Changes:

ve.init.mw.ViewPageTarget.js
* Add media insert button to toolbar

ve.init.mw.Platform.js
* Add getMediaSources method - defaults to local wiki and commons

ve.ui.MWMediaInsertDialog.js
* New dialog for inserting media
* Uses a media select widget and inserts block images

ve.ui.Dialog.css
* Added styling for media select widget in media insert dialog

ve.ui.Widget.css
* Added styles for media select widget and media select item widget

ve.ui.MWMediaInsertButtonTool.js
* New tool for inserting media

ve.ui.MediaSelectItemWidget.js
* New item widget for media select widgets

ve.ui.MediaSelectWidget.js
* New widget for searching for and selecting media items

ve.ui.TextInputWidget.js
* Added isPending method

VisualEditor.i18n.php
* New messages for media insert dialog

VisualEditor.php
* Added links to new files and messages

PhantomJS--

Change-Id: Ia803ff3ef518782ce76802d2dab7559686a1bb0a
2013-06-06 17:36:55 -07:00
jenkins-bot 3557083eb0 Merge "mw.ViewPageTarget: Clean up transform/restore logic" 2013-06-07 00:05:25 +00:00
Ed Sanders c86ff7529b Fix vewhitelist override.
This is mainly used for testing blacklisted browsers, so we just need
one parameter ('vewhitelist') which sets whitelist to true and
blacklist to false.

Change-Id: I38771ba7a49657d67c4d94ace1f30b5e41904df6
2013-06-06 23:39:43 +01:00
Timo Tijhof 2732e09396 mw.ViewPageTarget: Implement veaction=edit history state
Browser history state:
* Listen for popstate, if veaction is different, act on it
  (by calling activate or deactivate).
* When switching to edit mode, push veaction=edit.
  When switching to view mode, push non-veaction.
  Except if the switch was made by the popstate listener in
  which case we don't want to push again.

Clean up:
* Use document.location.href instead of odd location.toString
  Don't pass it to mw.Uri from the original one since it
  takes the current url by default.

Bug: 43844
Change-Id: I5c345c1526852a84b04436955845bf1b56d94402
2013-06-06 15:31:14 +00:00
Timo Tijhof baba5b0323 mw.ViewPageTarget: Clean up transform/restore logic
Merge methods:
* transformPage: transformSkinTabs + hideSiteNotice
* restorePage: restoreSkinTabs + restoreSiteNotice

Callers now consistently do both (e.g. #tearDownSurface only
called #restoreSkinTabs). This is also in preparation for
bug 43844.

Removed call from #tearDownSurface as that method is only
called from #deactivate which already calls #restorePage.

Clean up support check:
* Rename supportsStrictMode to supportsES5. Though the feature
  test asserts strict mode, we use it to check support for
  ES5. VisualEditor doesn't particularily care about strict
  mode itself.
* Reverse support if-statemement to return early instead of
  wrapping everything that follows. This makes it easier to
  see that we intent to abort if the current environment is
  known to be problematic. Also easier for code later on
  by not accidentally falling outside this block
* Follows-up aaa5ad254b.

Change-Id: Ia4b949d9c066a3f7b07217aa3d51de9908734e85
2013-06-06 16:52:26 +02:00
Trevor Parscal 4d65b6610b Fix deactivate
'detach'.split( '' ).join( 't' ) + 't';

Change-Id: Ic5ba376e2fa0afbbcdb3e8989433ce9dad973dd1
2013-06-05 16:53:38 -07:00
Trevor Parscal c0cd258045 Really fix notices sometimes not being an array
The previous fix didn't really work, because the notices are expected to
be an array elsewhere too. Better to just convert it to an array on the
spot. getObjectValues works with any kind of object (including an array)
so it's safe to use with either data type.

Change-Id: I03237b8624a0b980e5f70d54d55c662ffa460373
2013-06-05 23:39:57 +00:00
jenkins-bot 86cd5c6f57 Merge "Tolerate JSON stringify screwing up" 2013-06-05 23:25:38 +00:00
Trevor Parscal 9a4028c61f Tolerate JSON stringify screwing up
Sometimes the notices come through as an object with numeric keys. Go figure.

Change-Id: I3246006afe74a9c34a0cdd5294de61691bc37a43
2013-06-05 23:23:47 +00:00
Timo Tijhof 52025855ae mw.ViewPageTarget: Make tabLayout configurable server-side
Bug: 46871
Change-Id: I3fcb0c2903ae62d61ff789b5504e0ea23932121b
2013-06-05 15:58:27 -07:00
jenkins-bot ebbcc86ecf Merge "Make the mwMeta dialog trigger a toolbar action, not a button" 2013-06-05 22:08:58 +00:00
James D. Forrester 96b007eb7b Make the mwMeta dialog trigger a toolbar action, not a button
This has the secondary impact of moving mwMeta dialog out of experimental mode.

Change-Id: I3bb61d536826c6ba139661861092cd63423d99a4
2013-06-05 15:02:19 -07:00
Trevor Parscal d2e64c5905 Consistency
Quote JSON keys.

Change-Id: Id6cab25e0c755a8e505c384c8ce02094bd68652f
2013-06-05 12:50:47 -07:00
Ed Sanders 0b14b0da66 Fixes to permaturely merged browser compatibility checks
See comments on Idc5f4a23a2709264d869a9

Bug: 38128
Change-Id: Ic38992e04b5f3932cf18f2dfc217cd733196efb8
2013-06-05 18:11:59 +02:00
jenkins-bot b67019e0c2 Merge "Implement new browser compatibility checks" 2013-06-05 12:32:56 +00:00
Ed Sanders aaa5ad254b Implement new browser compatibility checks
We now have three stages:
1. Browser feature tests. Dies silently if any fail.
2. Browser blacklist. Dies silently if match found.
3. Browser whitelist. Shows warning if no match found.

Previously we were treating the remotely generated
edit notices as if they were in an object when
in fact they were in an array - the code has been
fixed to reflect that fact.

As locally generated notices will typically require
parsed messages, we've also moved the notice rendering
to after onReady is fired.

Updated jquery.client to latest master from MediaWiki core
(needed for proper detection of Iceweasel, Android and Safari)

Bug: 38128
Change-Id: Idc5f4a23a2709264d869a91d00873c4e187bc470
2013-06-05 14:29:36 +02:00
Trevor Parscal 8511f8ab3e Treat acronyms like words in camel case names
No matter what the W3C says, getDomFromHtmlString is more legible than
getDOMFromHTMLString.

Change-Id: Ic843b6671871024cce8acd82b6be435599ed168b
2013-05-28 12:51:41 +00:00