Commit graph

3242 commits

Author SHA1 Message Date
Inez Korczyński bf6df1ff37 Get rid of try..catch by using ve.dm.nodeFactory.lookup.
Change-Id: I017ed60f7d7ce8af34c94fe237cc4101192518f1
2013-05-22 12:51:51 -07:00
jenkins-bot df1e82bcf9 Merge "ve.ui.MWTemplateDialog: Implement templatedata API fetch" 2013-05-22 18:03:35 +00:00
Timo Tijhof 70694b2bbf MWLinkTargetInputWidget: Normalise value before matching
Don't suggest a "new page" (redlink) for values that are
strictly different but the same as a suggestion according
to mw.Title (e.g. input "foo" with an existing "Foo" page
should not suggest a redlink to inexistant page "foo").

Bug: 48476
Change-Id: I66f5fc56554984af58d6223dc6cd76b3ab9940bd
2013-05-22 00:20:41 +02:00
Timo Tijhof e7af635e88 ve.ui.MWTemplateDialog: Implement templatedata API fetch
Fetch
* Added basic name expansion logic since bug 48663 is not yet
  resolved in Parsoid.
* Fetch info from template data API.

Clean up (follows-up 97157a1c, de203cb8, 718db58)
* Remove redundant initialize method.
* Pass the entire target object to #getTemplateData
  because `target.wt` is *not* the template name.
* Reorganise #createPage to be more logical and rename
  to #createParamPage.
* Add todo comments for things currently missing.
* Implement error handling of promise to prevent UI from
  going stale if the promise is not resolved.
* Fix documentation in ve.ui.MWCategoryInputWidget.

Change-Id: Ie0114a81eead86d7a3b3e3a7a5b10d25c457b524
2013-05-20 23:50:19 -07: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
jenkins-bot 3b85e30f6a Merge "Icons for underline, strike & super/subscript buttons" 2013-05-20 23:58:23 +00:00
Ed Sanders 40e45d176a Icons for underline, strike & super/subscript buttons
Bug: 47780
Change-Id: I2f317e1dda2c2e2fceac401768c732dae02e83ce
2013-05-20 16:53:04 -07:00
jenkins-bot c1477bc1da Merge "Move selection to end of insertion after paste" 2013-05-20 23:19:55 +00:00
jenkins-bot d783cb15cf Merge "mw.ViewPageTarget: Get feedback url from content language" 2013-05-20 22:24:56 +00: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
Inez Korczyński cea627b6d4 mw.ViewPageTarge: Add mw-content-ltr/mw-content-rtl to surface
Add class to surface in order to correctly match MediaWiki styling.

Change-Id: If9f39dabc723d37a51065e410415fc76ca044d2e
2013-05-20 22:18:39 +00:00
Inez Korczyński 7c8bc08470 Added very basic support (rendering) for captions of thumb and frame images.
Change-Id: I4a59d4601c9bf44b241bb1432c9f1abc3f961743
2013-05-20 13:15:35 -07:00
jenkins-bot 6c367b9998 Merge "Add a transaction builder for replacing the contents of a node" 2013-05-20 20:12:10 +00:00
Catrope 7aefae885a Add a transaction builder for replacing the contents of a node
Change-Id: I69d362c4694104313dd2634434eddfbaf9435b22
2013-05-20 13:09:54 -07:00
jenkins-bot 8ba06a89b8 Merge "Refetch the token when we get a badtoken error" 2013-05-20 20:04:36 +00:00
jenkins-bot 791fdfb6d4 Merge "Refactor HTML attribute preservation" 2013-05-20 17:29:09 +00:00
jenkins-bot fb9f6df6b5 Merge "Wrap <img> in <a> inside image thumb in order to match MediaWiki parser output." 2013-05-18 16:54:24 +00:00
jenkins-bot cd91f4108f Merge "Fix call to getWindow" 2013-05-18 16:50:34 +00:00
jenkins-bot 17642a3f14 Merge "UnicodeJS treating start/end tags as letters" 2013-05-18 16:49:53 +00:00
jenkins-bot f31e8d19d9 Merge changes Icbab46af,Ied54d2b7
* changes:
  Move toolbar cancel message to VE specific message
  Remove parsedMessages from messages array
2013-05-18 16:48:36 +00:00
Ed Sanders acbf5f8210 UnicodeJS treating start/end tags as letters
Because /[a-z]/.test(null) treats null as the string 'null' and
so returns true.

Bug: 48487
Change-Id: I2408229cddd876ff8fe55a9eddf9bac87a61457e
2013-05-18 16:48:17 +00:00
Ed Sanders 95f41c176b Move selection to end of insertion after paste
Assuming this was broken by changes to translateRange.

Bug: 48603
Change-Id: Ia2a2120cb75aa86374b594ae3f484c5161028919
2013-05-18 16:41:58 +01:00
Ed Sanders 57b9167bb5 Fix call to getWindow
Using the wrong namespace.

Bug: 48602
Change-Id: I31dc071328123b57b778aa1b21f0e1daf6405e5c
2013-05-18 16:29:03 +01:00
Ed Sanders 706b64e82c Change document title on surface setup/teardown
Now reads "Creating/Editing Title - Sitename".

Bug: 48272
Change-Id: I9dcc8ec2c37a7ff9cff6cedb7bdb1fed1bdc4deb
2013-05-18 12:29:47 +01:00
jenkins-bot 0a8e596ffc Merge "Fix old copy/paste documentation errors" 2013-05-18 10:23:37 +00:00
jenkins-bot 44aac53bbe Merge "Fix various issues with prematurely aborting VE load" 2013-05-18 10:21:54 +00:00
jenkins-bot 9a3d7c288e Merge "Fix bytelimit status update" 2013-05-18 10:20:27 +00:00
jenkins-bot bbfdb30f87 Merge "Change 'Edit source' to 'Create source' for new pages" 2013-05-18 10:19:01 +00:00
Ed Sanders d8658a9fb0 Fix bytelimit status update
We need to listen to the same events as bytelimit. Specifically
we were missing keyup, which meant the counter could get stuck on
-1.

Bug: 47718
Change-Id: I3d4f3f8cd451bfb6acea19ee9baae7be60adcf15
2013-05-18 10:18:59 +00:00
Catrope 9ff6737f4c Refactor HTML attribute preservation
Rather than using namespaced linmod attributes, store the preserved
HTML attributes in the .htmlAttributes property of the linear model
element, in a nested structure to allow for easier treatment of child
nodes. Also added attribute order preservation by storing attributes
as an object plus an array of keys.

ve.ce.Node.js:
* Remove html/* attribute synchronization. Doesn't make sense any more
  because these things aren't in the attributes object any more. I don't
  think it ever made sense because these attributes were never supposed
  to be changed anyway.

ve.ce.View.js:
* Replace renderAttributes() with a simple wrapper around
  renderHtmlAttributeList()

ve.dm.Converter.js:
* Add buildHtmlAttributeList() and renderHtmlAttributes() for building
  and rendering HTML attribute lists

ve.dm.Model.js:
* Add getter for .htmlAttributes

ve.dm.Node.js:
* Drop .htmlAttributes on clone, and remove logic dropping html/*

ve.ui.MWCategoryWidget.js:
* Remove html/0/about hack, was already unnecessary and now doesn't
  work any more

tests/:
* UPDATE ALL THE TESTS

Change-Id: I620573afd70d36ade6b80413075b6e1f4a435abe
2013-05-17 20:57:33 -07:00
Catrope 6f0c739d42 Refetch the token when we get a badtoken error
Intercept badtoken errors, refetch the edit token from the
action=tokens API, and retry the request again. If this fails too,
show the error to the user.

Right now this just shows the good old confirm() dialog if the token
refetch fails; we should probaby give the user a clearer error message
telling them to refresh the page or something.

Bug: 42984
Change-Id: Ib43d1938ffa24bc8d1dc76a300e16e486dabd928
2013-05-17 19:15:21 -07:00
Ed Sanders 356c279046 Always enable save button on oldid pages
Was previously enabled on creation but could be disabled
by state changes.

Bug: 48584
Change-Id: I67c011ac655d4e553f9467cab10a875aaac61d03
2013-05-17 21:00:26 +01:00
Inez Korczyński e196c2f247 Wrap <img> in <a> inside image thumb in order to match MediaWiki parser output.
Change-Id: I91cfcd9ea319b4429abbbe9ddbb07d1cd8a65b62
2013-05-17 11:42:27 -07:00
Ed Sanders e968fc717f Change 'Edit source' to 'Create source' for new pages
Bug: 47421
Change-Id: Iafba040cb8eb53017f38f2099a473e0e43e2ec46
2013-05-17 18:43:41 +01:00
Ed Sanders 1db0ced8cc Fix various issues with prematurely aborting VE load
Add checks to make sure parts of the target are acutally
active before trying to tear them down or use them.

This fixes a couple of issues which appeared when the VE was
closed before it had a chance to finish loading.

Bug: 48520
Bug: 47813
Change-Id: Ide5def0e983bab49108b40008fc170957c7fc2a2
2013-05-17 17:48:27 +01:00
Ed Sanders 5d41f902ee Fix old copy/paste documentation errors
Three methods in ve.init.mw.ViewPageTarget have incorrect descriptions.

Change-Id: Ie2e7835a7c6fa7387d48936dbe65649a150eec79
2013-05-17 16:38:48 +01:00
Ed Sanders f56bdf70fd Move toolbar cancel message to VE specific message
Be consistent with all other button messages.

Change-Id: Icbab46aff210b79db59de688d539b8e69a13ec0d
2013-05-17 15:21:46 +01:00
jenkins-bot 4f14fddd2b Merge "ve.ui.PopupWidget visibility fixes" 2013-05-17 05:52:35 +00:00
jenkins-bot dd2d6e900d Merge "Use promise pattern inside MWTemplateDialog in order to download TemplateData (currently just mocked) asynchronously." 2013-05-17 05:49:29 +00:00
Trevor Parscal 3a99b99876 ve.ui.PopupWidget visibility fixes
Objective:

* Context popup would stop opening sometimes "mysteriously" which ended
  up having to do with the automatic closing on blur functionality
  added to popups for use in the category popup widget
* Mousedown event canceling was being applied a little too widely, and
  was causing popup widgets to not allow child elements to be focused
  (unless they contained an iframe, like an inspector)

Changes:

ve.ui.Context.js
* Make use of the popup's show and hide methods within the inspector

ve.ui.MWCategoryPopupWidget.js
* Override autoClose option for category popup widgets

ve.ui.PopupWidget.js
* Add autoClose option to popup widgets
* Move event handler to the top of the methods (convention)
* Only bind blur event if autoClose is enabled
* Inline the getFocusedChild method

Change-Id: I22aedb5fbd51b327ea7ce2ecdd6123e79cbebb9c
2013-05-17 05:49:16 +00:00
jenkins-bot 28d33df097 Merge "Support for nodes that handles their own children in ve.dm.Converter.prototype.getDomSubtreeFromData" 2013-05-17 05:48:35 +00:00
Inez Korczyński 97157a1c1c Use promise pattern inside MWTemplateDialog in order to download TemplateData (currently just mocked) asynchronously.
Change-Id: Ib23521cf40a80cc82872de82d3935414ef385d21
2013-05-16 20:37:15 -07:00
jenkins-bot 6033608ba1 Merge "Keep veaction=edit in the url when VE runs in debug mode so it keeps user just refresh the page in order to get into the edit mode." 2013-05-16 23:06:44 +00:00
Inez Korczyński 531c049679 Support for nodes that handles their own children in ve.dm.Converter.prototype.getDomSubtreeFromData
Change-Id: I784dec71d3f0b23001075234e324a8e06a6cfc6b
2013-05-16 16:01:46 -07:00
Inez Korczyński 9f16ff5150 Keep veaction=edit in the url when VE runs in debug mode so it keeps user just refresh the page in order to get into the edit mode.
Change-Id: I32c7135c3b989348d2d5722977cec2f81f08c162
2013-05-16 15:02:14 -07:00
jenkins-bot 0eb2581b64 Merge "ve.ui.Context: Add embedding feature" 2013-05-16 18:26:39 +00:00
Trevor Parscal 55b5f30edb ve.ui.Context: Add embedding feature
Objectives:

* Make the context menu display in the top right corner of the currently
  focused inspectable node (if there is one)
* Prevent clicking on anything to do with the toolbar or popup from doing
  anything at all, ever

Bonus:

* While we are using the clever feature in jQuery's on method which allows
  passing boolean false to cancel the event - may as well do that in
  ve.ui.Dialog as well

Changes:

ve.ui.FocusableNode
* Add ability to specify the focusable element so that dimensions can be
  derived from it

ve.ce.Surface
* Add quotes to object keys

ve.ui.MediaDialog
* Change association from being MW specific to handling images in general

ve.ui.Context
* Add embedded styles for context
* Add embedded mode, which is triggered when the context is a single
  focusable node, and the node is large enough to fit the context
  reasonably

ve.ui.Dialog
* Inline mousedown handler

ve.ui.Toolbar, ve.ui.PopupWidget
* Cancel stray mousedown events

Change-Id: I4b25d33f64b4bcb8a3ecfd7e9728f54a2d4886f3
2013-05-16 11:23:59 -07:00
jenkins-bot 57a2de90aa Merge "Emit teardown event before replacing generated content node content and emit setup event after." 2013-05-16 01:23:34 +00:00
Inez Korczyński a191073d72 Create and commit transaction after attributes of the template are changed and applied.
Change-Id: I4a1acdadcd1486ddd5dafcfc794c9b3b93e92592
2013-05-15 17:49:27 -07:00
Inez Korczyński 995a20219a Emit teardown event before replacing generated content node content and emit setup event after.
Change-Id: I397d4dfb5fd0177255a0b4389ba5380807969ef4
2013-05-15 17:35:49 -07:00