Commit graph

18 commits

Author SHA1 Message Date
Timo Tijhof 1f1a1970be mw.ViewPageTarget: Show save errors in save dialog instead of alert
To trigger a save rejection from the api, set:
 $wgSpamRegex = '/spam/i';
and making an edit adding the word "spam" to a page.

Class changes:
* Rename message system in the save dialog from "warning" to
  "message" as it will now contain both warnings and errors.
  (css class, class property, method names, ..)

Localisation:
* Remove ugly hardcoded and wikitext-requiring "'''Warning:'''"
  prefix from the warning message, instead have a message for the
  word "Warning" and re-use this in #showMessage for each message
  of type "warning" (bolding applied in code instead of in i18n).
* Rename visualeditor-savedialog-dirtywarning to
  visualeditor-savedialog-warning-dirty and remove from
  VisualEditorMessagesModule.php as it no longer requires pre-
  processing from the server.

Clean up:
* Re-alphabetise the order of some messages.
* Clean up duplication and redundant logic in mw.Target#onSaveError
  and mw.ViewPageTarget#onSaveError.

Bug: 50350
Change-Id: I3daf631fb0d62ba88e05aa50c77c9940d61395a0
2013-07-01 16:41:12 +02:00
Roan Kattouw f538fcf6be mw.ViewPageTarget: Add sanity check for DOM roundtrip
The sanity check converts the linear model back to DOM, then
compares this DOM to the original DOM and rejects the deferred
if they are not equal.

The DOM creation has to be done synchronously (before we unlock
the surface), but the actual comparsion can be (and is) done
asynchronously.

To make the UI flow of the save dialog easier we just keep the
save button on the toolbar itself disabled until the sanity
check is done. Though this should finish before the user starts
editing the document (let alone start saving), we do add a class
to the button to indicate a progress cursor.

To simulate a slow sanity check, set the setTimeout in
startSanityCheck to 5000, load VE, make a change, hover the
button, and see it change from disabled + progress-cursor to
enabled after 5 seconds.

To simulate the sanity check failing, change !== to === in
the first "if" in startSanityCheck.

Bug: 47521
Bug: 50067
Change-Id: I04f71fe8e00c6257fbc953cc9de3323e24709b0f
2013-06-27 19:20:14 -07: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
James D. Forrester 728d24423c Now we've got PHPCS switched on, kill long lines
Lest PHPCS throws wobblies over unrelated changes in PHP files with
underlying issues in their code style.

Change-Id: Ifc4aec328d726e9ca62db34af55ea9592c08d9f3
2013-05-30 11:56:01 +00:00
Ed Sanders 523e981a08 Show warning when commit message is empty and preference is set
If the commit message is empty we show a warning, and if the warning
is already visible we allow the user to proceed.

Bug: 47752
Change-Id: Idba707abaea8b08a94f7fa4d5bc5b1e35261a572
2013-05-21 08:02:16 +02:00
Ed Sanders 6ca8caa0ca mw.ViewPageTarget: Get feedback url from content language
Link is specific to the project language, not the user's preference.

Bug: 47730
Change-Id: I3804e6f91015ef9b8ae5196efb37475d714cd7d5
2013-05-20 22:23:05 +00:00
James D. Forrester 82114467f1 Bump copyright notice year range to -2013 over -2012
199 files touched. Whee!

Change-Id: Id82ce4a32f833406db4a1cc585674f2bdb39ba0d
2013-02-19 15:37:34 -08: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
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
Trevor Parscal 08b008e53c Another fix for I7f26b47e9467e850c08b9c217c4f1098590de109
Feeling like I should have just reverted my merge at this point...

Change-Id: I94075e065ea1f1b80f19c750e25858496da6ed36
2012-12-04 11:27:11 -08:00
Trevor Parscal df12ed58f4 Fix for I7f26b47e9467e850c08b9c217c4f1098590de109
I overlooked this when I did the review.

Change-Id: I942ce92c0c8f847149bb24697fc1aab0e67b8c67
2012-12-04 11:13:59 -08: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
Trevor Parscal f48332d176 Design changes for save dialog
* Summary label is now placeholder text
* Edit summary and options are visually connected
* Added summary length count-down label
* Removed check-mark icons from toolbar and dialog save buttons
* Made toolbar and dialog save buttons the same size
* Reduced line-height and margins of license information
* Changed from X icon for close (which might be confused with cancel) to ^ icon for collapse

Change-Id: Ib1711f49af8929be12796aecdea49467b726856e
2012-08-17 13:48:16 -07:00
Trevor Parscal 53e9258280 Added ve.init.platform with MediaWiki and stand-alone implementations
This should make it much simpler to keep MediaWiki specifics out of VisualEditor, which will in turn make it easier to integrate VisualEditor into another platform.

Change-Id: I073e9737b37c28af889f2457d10b082cefd0d63b
2012-07-27 13:39:19 -07:00
Trevor Parscal c40174b60c Changed to use MIT license per agreement with the VisualEditor team
This license change is aimed at maximizing the reusability of this code
in other projects. VisualEditor is more than just an awesome editor for
MediaWiki, it's the new editor for the entire internet.

Added license and author files, plus mentions of the license to all
VisualEditor PHP, JavaScript and CSS files. Parser files have not been
modified but are effectively re-licensed since there's no overriding
license information. 3rd party libraries are not changed, but are all
already MIT licensed.

Change-Id: I895b256325db7c8689756edab34523de4418b0f2
2012-07-19 13:25:45 -07:00
Catrope 770a8b84ff (bug 37819) Put minoredit, watchthis messages in specialMessages too so wikitext in it is displayed correctly
Change-Id: I5fbb7a6ff0de50744bfd5816ebf7d06f04c315b8
2012-07-17 15:23:43 -07:00
Catrope ae48f152f9 Fix display of edit summary message in save dialog
Fixed by adding the specialMessages module which is only loaded once the
editor loads. Then after it's loaded we use the summary message from
there to update the (possibly broken) summary message in the save
dialog.

Change-Id: I67f5c59501cdf7c66c925cef8d4dd42b0f2cfde3
2012-06-21 13:39:27 -07:00