Commit graph

133 commits

Author SHA1 Message Date
Catrope 892990ef17 (bug 43040) All edits were being marked as minor
&minor=false doesn't work, but &minor=0 does

Change-Id: I73e18e7b58a151d78d56aa199cdfadb6d7150f1d
2012-12-12 17:51:47 -08:00
jenkins-bot 8b50543b6d Merge "Save dialog: Fix too-wide diff box." 2012-12-13 00:51:25 +00:00
jenkins-bot 74b874c1fa Merge "(bug 43013) Exclude edit notices with no visible text." 2012-12-13 00:39:10 +00:00
jenkins-bot 9ad0328b56 Merge "Phase out $.toJSON, use JSON.stringify directly." 2012-12-13 00:36:54 +00:00
Timo Tijhof 4fa57b469a Phase out $.toJSON, use JSON.stringify directly.
Although $.toJSON optimises heavily for modern browsers (it
becomes a direct reference to JSON.stringify), we still load the
extra plugin.

JSON is specified as part of ECMAScript 5, but most browsers
supported this one before they supported the rest of ES5.

http://caniuse.com/#search=JSON

Cut off for native JSON is IE7, Firefox 3.0 (3.6 supports it) and
Safari 3. Not any of our concern as VE will most likely never
support those (certainly not at this point in time, and less
likely as time goes on).

Change-Id: I4e8f26ac94763fa38d29e41264de0247f53a21e5
2012-12-13 01:33:46 +01:00
Timo Tijhof 18ab361a43 (bug 43013) Exclude edit notices with no visible text.
en.wikipedia.org has a template gala for edit notices with a whole
bunch of html framework outputted by default from
MediaWiki:Editnotice-0 (even if their underlying system has no
matches for the current page).

In the core editor from EditPage.php this isn't a problem as the
element is just idling hidden above the editor.

In the case of VisualEditor (where we have a custom delivery for
the edit notices) we don't want to say "1 notice available" on
every page, so we need to be smart and quickly walk the dom of the
notice, filter out invisible nodes, and if the resulting nodes
have no contents, ignore the notice all together.

Change-Id: I65447da8b88a9bae9c24ff155544ff66b3fe9100
2012-12-13 01:26:11 +01:00
Trevor Parscal 718e72d534 Disabled VisualEditor section edit link overrides by default
Server config: $wgVisualEditorEnableSectionEditLinks
Client config: mw.config.get( 'wgVisualEditor' ).enableSectionEditLinks

Change-Id: I859546475a32a686e318aa7108396606b5a0a78d
2012-12-12 15:35:33 -08:00
Timo Tijhof 0cec349074 Save dialog: Fix too-wide diff box.
The rules have changed, these constraints are no longer needed
and actually causing the table.diff to ignore the restrictions
and bump out of the container beyond the width of the window.

This restores the condition under which table.diff is displayed
by core EditPage.php.

Follows-up I5f59482f4db.

Change-Id: I456644bf14efab7dac351818d5c3bb69b9b3c993
2012-12-12 04:32:55 +01:00
jenkins-bot 20dd91423a Merge "Save dialog: Implement new "Review and Save" model." 2012-12-12 01:57:36 +00:00
Timo Tijhof cdee18dae8 Save dialog: Implement new "Review and Save" model.
Basically saveDialog-body now has three slides:
* review
* report
* save

There is a viewPage.swapSaveDialog method that is called like this
 viewPage.swapSaveDialog( 'review' );
initially called from showSaveDialog.

Misc:
 * Replaced more reused core message with a ve ones:
   savearticle => visualeditor-savedialog-label-save
   showdiff => (removed)

 * Removed min-height from saveDialog. When slide-review is
   load, it is very short and there shouldn't be 10em's of
   whitespace below the loader + buttons.

To avoid problems with diff cache being cleared while looking
at the save dialog, we lock and unlock the surface.
We could later remove this as and optimise it as feature, but for
now this fixes a bug.

Change-Id: I5f59482f4db16264014720b199d7652843c36108
2012-12-11 17:52:48 -08:00
Catrope 541aa0d3d6 Store HTML before the converter messes with it
Change-Id: I51f0a97a266522e46f415fd7618c3ef26a8924cd
2012-12-11 17:20:18 -08:00
Timo Tijhof 95742d65f6 Save dialog: Various clean up.
Drop "-down" class in favour of :active CSS pseudo-class.
* http://kimblim.dk/css-tests/selectors/
* http://www.quirksmode.org/css/contents.html
* http://caniuse.com/#search=css%202.1

Rename methods consistently to enableFoo and disableFoo.

Use mw.notify instead of mw.util.jsMessage (the latter takes a
string of html and parses it, instead of taking text).
Also, jsMessage is obsolete (legacy wrapper around mw.notify).

Rename slide-main to slide-save in preparation of other slides
and introduction of multi-step save dialog.

Re-introduce "disabled" state (not css, but actual state) so that
pressing "Show changes" multiple times will not spawn multiple
async operations. The save function guards against this by keeping
a static property in the internal helper method, but there are
still some operations happening between the button and that method
this should be guarded in the UI instead. Follows-up I67819168.

Change-Id: Idf0331377e6be814ccae853228d6159b4ad5a159
2012-12-11 23:13:54 +01:00
jenkins-bot ffc8ec5e50 Merge "Re-apply fixes made in a patch set that were accidentally reverted on rebase" 2012-12-11 21:35:31 +00:00
Catrope 3f903adb09 Add .reportProblem() to submit reports
Change-Id: I55ffd8bfc7664ead3827ef6be178a0b6f3b991a1
2012-12-11 13:19:51 -08:00
Trevor Parscal baa5754b2f Re-apply fixes made in a patch set that were accidentally reverted on rebase
In the change: I6781916822b4173ba906b9bc4c341219fbf10d82

71b97ec45b was reversed when I submitted 1789545284

Change-Id: I6cc59a27817bfbe55c7cbf45bba746a4bd6c375f
2012-12-11 13:06:40 -08:00
Timo Tijhof 3a2453b1b2 mw.ViewPageTarget: Move diff button logic, min-height for dialog.
Follows-up Ic77c5ce4 and I9d05ef6e.

Change-Id: I077172d590e53737691020c1265203134eea3c9c
2012-12-11 18:33:16 +01:00
jenkins-bot 64abfff53c Merge "Enable change makers by default" 2012-12-11 07:05:48 +00:00
Catrope 0d5db4eb4e Enable change makers by default
Change-Id: I7b5af42abe81cc5f41dd80692ac5d5ff007f99ed
2012-12-10 22:55:00 -08:00
Catrope 1a195b33e1 And also use a 100s timeout for show changes
Change-Id: I437d125cd1944299991d80f22fdaedd490bcb45f
2012-12-10 21:16:21 -08:00
Catrope 2e6425a16b Set the save timeout to 100s as well
Change-Id: Ic01ffaae2a0c4bbe91bee7705c60f26b7b34d0f9
2012-12-10 20:33:34 -08:00
jenkins-bot a90f79178a Merge "Hide the show changes button when we are creating a page" 2012-12-11 03:25:50 +00:00
Trevor Parscal 1edd9ad504 Hide the show changes button when we are creating a page
Change-Id: Ic77c5ce4757fd0cf6d7cdd9a991206b649fc2e5a
2012-12-10 19:24:26 -08:00
jenkins-bot dff8570850 Merge "Check if there's a document before we try and set focus on it" 2012-12-11 03:24:05 +00:00
Trevor Parscal c59e6b1638 Check if there's a document before we try and set focus on it
Change-Id: Ia7776c70c2593e4524adab3a347230ee3cccad29
2012-12-10 19:14:43 -08:00
Trevor Parscal c91ef9306c Add left margin to save dialog, visible with show changes
Change-Id: Iaadbfd30f7270fa90dc4adefc9855a55d087ce0c
2012-12-10 19:04:01 -08:00
jenkins-bot 6bb6f6b790 Merge "Throw edit warning on cancel." 2012-12-11 02:55:32 +00:00
Trevor Parscal 99ccfab9f0 (bug 42920) Add the feedback tool
icons, comment.*, ve.ui.Icons-*
* Added comment icon

ve.init.mw.ViewPageTarget
* Refactored editNoticeButton into being just a tool
* Added feedback tool, which shares the editNoticeButton code
* Added feedback object construction in init constructor
* Added launching code to feedback tool

VisualEditor.i18n
* Renamed editnotices-button message to editnotices-tool to match changes in code
* Added feedback tool message

VisualEditor
* Added dependency on mediawiki.feedback
* Updated changed message key
* Added reference to new message

Change-Id: I813c89a505386a9b3206bfbcb176016e28a592cb
2012-12-10 18:47:53 -08:00
Trevor Parscal 1789545284 Adjustments and fixes for styles
* Made buttons use shared CSS code
* Stopped using <button> elements and got all browsers looking the same
* Fixed focus on text area issue - had to let the stack clear first

Change-Id: I6781916822b4173ba906b9bc4c341219fbf10d82
2012-12-10 18:34:58 -08:00
Rob Moen f4cbfa5d87 Throw edit warning on cancel.
-Added reset and hide calls to deactivate to prevent problems
with the save dialog if the user exits to the view.
-Remove unneeded teardown routines from cancel.
-Calling deactivate without override.

Change-Id: I888019146186fb7cbc1ee2b8efee9a0c45286c23
2012-12-11 00:50:05 +00:00
jenkins-bot b6d0cebe59 Merge "(bug 42654) Implement Show changes in Save dialog." 2012-12-10 21:49:38 +00:00
jenkins-bot 3618e9846b Merge "Focus on document when notices are clicked" 2012-12-10 19:12:28 +00:00
Timo Tijhof f79f6055e3 (bug 42848) Notifications should not use db-variant of page titles
Change-Id: Ie84168cd2509a17c180c6143a87a18ae8bbb3d0a
2012-12-08 02:38:05 +01:00
Timo Tijhof 97fa232c8f (bug 42654) Implement Show changes in Save dialog.
Turned saveDialog-body into slide-based swapper.

Moved footer into saveDiaog-body so that the license text doesn't
stay under the diff-slide (and move body bottom padding to foot
top)

Wrapped buttons and title in a saveDialog-header and converted
closeButton from absolutely positioned to a floated layout.
This way the title doesn't need to be repositioned but will scooch
over if the prevButton gets shown/hidden.

Update API "diff" action to include table wrapper and table
header. Without it the mediawiki CSS for diff doesn't work
properly (needs colgroups for proper width of the "-" and "+" column etc)

Renamed -saving class to -disabled for consistency.

Set prop.disabled to really lock/unlock buttons, not just visual
(otherwise the click handlers are still triggered on click, can
potentially cause actions to be triggered when not expected)

Using a ve message for "Show your changes" title instead of
re-using core tooltip-savepage in a different context.

Diff slide triggers "auto width" on dialog (inline undo of width: 29em), keeping min-width, to allow it to expand as wide as needed.

Functions that I copied as base for onShowChanges and
onShowChangeError had some incorrect argument descriptions. Fixed
in both.

Note:
* Pass function to .off(), so that only that one is unbound
  instead of any "resize" handler on the page (by other extensions
  or gadgets or core)
* NB: ve.bind ($.proxy) preserves internal guid, so that $.Event
  can find the bound function by the original reference.
* keydown has an anonymous function, should either moved to
  prototype or namespaced, did latter for now, save enough and
  better than destructive .off('keydown')

Change-Id: I9d05ef6e3e2461bdcf363232f7b0fbad5e24f506
2012-12-08 02:26:24 +01:00
Trevor Parscal 6bfb42639f Focus on document when notices are clicked
Change-Id: I55e4eb74e12ded79d998d155d4688ce6a1b6ce66
2012-12-07 16:42:47 -08:00
Timo Tijhof a016dc2fe3 Fix CSS syntax errors from If1e08bbf.
Change-Id: I38f33a065afbe37f931934017c11d5ceedb34176
2012-12-07 17:23:51 +01:00
jenkins-bot aac3954384 Merge "(bug 42136) Use user prefs to set initial state of "Watch this"." 2012-12-06 23:05:00 +00:00
Timo Tijhof a600310e4d (bug 42136) Use user prefs to set initial state of "Watch this".
* Don't show at all if user isn't logged in
* Use "watch pages I create" and "watch pages I create" prefs
* If the user is already watching it, use that

Also updated relevant onMakeGlobalVariablesScript hook,
it was using old globals still, the hook has context as
of MediaWiki 1.19.

Change-Id: Ic3daf32505a745b3cccd0663a03bbf7f3885be84
2012-12-06 15:04:13 -08:00
Trevor Parscal 4737727f34 (bug 37837) Spinner of death on error
* Reusing deactivate method to recover from load error
* Made deactivate resilient to some properties not being set yet (so we can call it on load error)
* Restoring save dialog state after save error

Change-Id: I6a697dc6bddeebecf4e2ab26805bee9f3754c714
2012-12-06 14:18:56 -08:00
Timo Tijhof 4e407bd59e (bug 38034) Implement MediaWiki's copyright warning
Logic taken from EditPage::getCopyrightWarning, but couldn't use
it directly because it doesn't give the message keys and wraps
the html.

Using the same logic and running the same hook, we'll get the same
message keys (and message parameters therefore) as EditPage would.

Also fixed these bugs (as they were more prominent now):
* Use Message::parse() instead of Message::plain()
* Set inLanguage properly instead of using the default
  (EditPage is user-localised, including this message, just like
  the rest of VE).
  Fixes bug 42764: minoredit/watchthis should be in user-language.

Change-Id: I84fee641162cdeed290092e56fb0e1d2562d833d
2012-12-06 06:29:13 +01:00
jenkins-bot 2ba2b3d428 Merge "(Bug 40773) Clicking on minor edit now opens in a new tab." 2012-12-06 01:47:25 +00:00
Rob Moen bf06930663 (Bug 40773) Clicking on minor edit now opens in a new tab.
Since the link is generated by a MediaWiki message and as far as
I know, the target attribute cannot be added in wikitext.

Solution is to add the target attribute via jQuery in the
save dialog.

Change-Id: I4b6cdee64e7f8e3acb28b21c32c58254d63a8daf
2012-12-05 16:05:16 -08:00
Trevor Parscal 571c2e2ff4 (bug 42750) Save button says "Create page" when creating a new page
Change-Id: I25e07f531b911eef3cf55412862b163393d03d33
2012-12-05 15:38:48 -08:00
Rob Moen 459d0428ec Add cancel button to VisualEditor MediaWiki integration.
Attempt to address (Bug 37845)

Change-Id: If1e08bbfbe4920e74f1c006e4fb18c8296ff6043
2012-12-05 15:00:46 -08:00
Trevor Parscal 78eb16035c (bug 41865) Save page behavior for oldid
ApiVisualEditor
* Reverted some of I223235a6ea8b4178c50beeaaedb709b2de7cf0b5 turned out to be full of problems - the race condition is only relevant to getting the HTML
* Fixed check for $content to be false before it was defined

ve.init.mw.ViewPageTarget
* Reverted some more of I223235a6ea8b4178c50beeaaedb709b2de7cf0b5 - wgCurRevisionId is not equal to oldid, it's equal to $title->getLatestRevId() - this was causing lots of oldid problems
* Added use of restored message
* Made save button not locked when using oldid
* Customized save buttons depending on oldid

ve.init.mw.Target
* Reverted even more of I223235a6ea8b4178c50beeaaedb709b2de7cf0b5 - we don't want to keep a copy of the wgCurRevisionId at all, we just want the oldid if it was given

VisualEditor.i18n, VisualEditor
* Added restored notification and restore save button label messages

Change-Id: I8b30c2a153911f44643e369b7c6a9b89c0fb2c5b
2012-12-05 06:44:41 +00:00
Timo Tijhof 381472ac99 init.Platform: Refactor parsed messages.
Rewrite VisualEditorMessagesModule:
* Replace copy-paste dump of user-css module with stuff for
  VisualEditor (class commend and module::$origin).
* Remove duplication between getMessages and getScript.
* Actually implement getModifiedTime so that the comment in
  getMessages() about cache invalidation is actually true
  Fixes bug 42670: ext.visualEditor.specialMessages cache broken

ve.init:
* Implement addParsedMessages and getParsedMessage so that we
  don't mix up plain messages with raw html messages (minoredit
  was previously overloaded in mw.msg storage with a parsed html
  message and retrieved though ve.msg, which is documented as
  retuning plain text, not raw html). This is now separated into
  a different method.
* Improved documentation of the other msg methods to emphasise
  their differences
* Removed redundant code in attachSaveDialog() that was
  (partially) already done in setupSaveDialog() and moved the
  remaining bits into it as well. Checked all callers of these and
  they are both only called from ViewPageTarget.prototype.onLoad
* Also implement them in the standalone platform implementation,
  with the html escaper based on mw.html.escape
* Update init.platform.getMessage to use undefined instead of
  discouraged 'if-in' statement.
* Add test suite.

demos/test:
* Re-run makeStaticLoader.php on test to add ve.init.Platform.test
* Re-run makeStaticLoader.php on demos and update i18n caller
  to use ve.init.platform.addParsedMessages (also moved out of the
  auto-generated block for easier updating)

Change-Id: I7f26b47e9467e850c08b9c217c4f1098590de109
2012-12-04 07:56:41 +01:00
Catrope bbf7100041 Merge "(bug 42661) Initially hide context, then update after animation" 2012-12-04 02:49:09 +00:00
Catrope b6dd2340ad Merge "Added destroy methods and called them on deactivate" 2012-12-04 02:45:40 +00:00
Trevor Parscal c051107b39 Removed all browser-specific box-shadow rules
These aren't needed for any of our target browsers anymore.

Change-Id: Idae4acb5f0f6387cad52f2ea7594dbad1929af59
2012-12-03 23:08:33 +01:00
Trevor Parscal 98ef0da3ee (bug 42661) Initially hide context, then update after animation
Change-Id: I35a0c3359ffc1a62ee3c0456c33475e32189f4b4
2012-12-03 14:06:24 -08:00
Krinkle 3b3dab11c7 Merge "Removed all browser-specific border-radius rules" 2012-12-03 22:05:59 +00:00