Commit graph

4219 commits

Author SHA1 Message Date
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
Translation updater bot d8051f4006 Localisation updates from http://translatewiki.net.
Change-Id: I3f4502145e220843975bf2c3b6342a90b6774299
2013-05-17 20:51:58 +00: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
Ed Sanders 81e113b75b Remove parsedMessages from messages array
These messages are only used in their parsed form, we never use
them in their raw wikitext form, so not point sending them to the
client.

Change-Id: Ied54d2b760fe1c15cd03df6d77052f6a5b920391
2013-05-17 14:49:32 +01:00
Ed Sanders a78042accd Disable VE on redirect pages
Will need to be undone once redirect editing support is added.

Bug: 47329
Change-Id: I68836156c35c796aa2156c382992b0c105ae34cf
2013-05-17 12:23:11 +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
Translation updater bot 83bdceb64c Localisation updates from http://translatewiki.net.
Change-Id: I14e7d7bac0117b405066166a6bbd47bd8a3748c6
2013-05-16 20:23:42 +00: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
Ed Sanders b5ead95ee8 Implement roundtrip update of template contents
Currently there is no Parsoid call for this so we're using the PHP
parser API.

Change-Id: I8bc4f96924d88de7bc67203336bf465ba91fc37b
2013-05-16 00:56:44 +01:00
jenkins-bot a47619cd04 Merge "Introduce createPage method in ve.ui.MWTemplateDialog and even use it!" 2013-05-15 23:40:29 +00:00
jenkins-bot 133a501481 Merge "Fixing block template styling" 2013-05-15 23:39:52 +00:00
Christian Williams e669f8faf6 Fixing block template styling
Trailing comma borks everything.

Change-Id: Ic4eb97f84b45297312b45ab64355836ef8a329d1
2013-05-15 16:37:27 -07:00
Trevor Parscal e64d900fc3 Fix image block node error
When loading an image block node in the demo, there are no classes on the figure, which caused the code to crash because it was assuming that jQuery's attr method would always return a string.

Change-Id: Ib13e7bfa3fb2bd76ac71dfef085bed209d880b4a
2013-05-15 16:24:10 -07:00
Inez Korczyński 1b4b6663c3 Introduce createPage method in ve.ui.MWTemplateDialog and even use it!
Change-Id: I7b063a9380742e157a4c7128c1654abcf3ad8c6f
2013-05-15 16:22:12 -07:00
Inez Korczyński ba5c4f104d Build TemplateDialog based on parameters that are passed to template
(instead of TemplateData as before).

Change-Id: I50b0e6ef1936c4b56f40fa73bd42b03587bdf979
2013-05-15 22:47:59 +00:00
jenkins-bot 4875a4ec0b Merge "Content for Template Dialog" 2013-05-15 22:18:38 +00:00
jenkins-bot 30fb94e94f Merge "Implement ve.dm.MWTemplateNode.getWikitext()" 2013-05-15 22:18:01 +00:00
Catrope 54cd04c391 Implement ve.dm.MWTemplateNode.getWikitext()
Escapes }} and | by wrapping them in <nowiki> tags, and steps around
<nowiki> tags so as to not double-wrap things.

Change-Id: Ia50906524c1fcf55c9f390a114856bc7f20b2d3a
2013-05-15 15:16:34 -07:00
Christian Williams f238683341 Content for Template Dialog
Initial commit of page content.

Change-Id: Iffdf4f4179c6f3b04611d4bd9548e7cf23188856
2013-05-15 15:13:38 -07:00
jenkins-bot 943301f2c9 Merge "Multiline option for ve.ui.TextInputWidget.js" 2013-05-15 21:47:25 +00:00
jenkins-bot e21f8edb60 Merge "Process example template data and add pages to PagedDialog based on it." 2013-05-15 21:44:07 +00:00
jenkins-bot e75f63f279 Merge "Added clearPages method to ve.ui.PagedDialog." 2013-05-15 21:41:34 +00:00
Trevor Parscal 96e49858fa Multiline option for ve.ui.TextInputWidget.js
Objective:

* Add multiline option to text input widget which uses a text area instead of a text input

Changes:

ve.ui.Widget.css
* Add text area support for styles otherwise only targeting input elements

ve.ui.InputWidget.js
* Initialize input element using a method, so it can be fully customized (like making a text area or select input
* Use val() to set the initial value, using jQuery's abstraction around inputs of various types

ve.ui.TextInputWidget.js
* Add multiline option which uses a text area instead of an input

Change-Id: I1bf17c8c76b7f1708c57ee5e95160c071ddd00e9
2013-05-15 14:41:22 -07:00
Inez Korczyński de203cb871 Process example template data and add pages to PagedDialog based on it.
Change-Id: I34ee42e66df26000842f9b1540a577b2621f8839
2013-05-15 14:36:44 -07:00
Inez Korczyński 3895a3ea11 Added clearPages method to ve.ui.PagedDialog.
Change-Id: Ie55f727f649b2dcd4189489c7baa9f524aa5d1c7
2013-05-15 14:31:20 -07:00
jenkins-bot 9a19d26d3b Merge "Rewrite API 'paction' switcher as an actual switch" 2013-05-15 21:24:02 +00:00
jenkins-bot 35fae73a45 Merge "Revert "Localisation updates from http://translatewiki.net."" 2013-05-15 21:20:04 +00:00
Ed Sanders e22a5a6d77 Rewrite API 'paction' switcher as an actual switch
Change-Id: I1f10ee890ea5d1d709739b21c23e35a6a6fd4901
2013-05-15 22:17:06 +01:00
Catrope c52c18441c Revert "Localisation updates from http://translatewiki.net."
This reverts commit b91469867d

Change-Id: I2e48e70597f13ffb6b59c3d780442288b5087046
2013-05-15 21:16:12 +00:00
Translation updater bot cf5cb122be Merge "Localisation updates from http://translatewiki.net." 2013-05-15 21:14:17 +00:00
Translation updater bot b91469867d Localisation updates from http://translatewiki.net.
Change-Id: I405c871bce7014222ee24ed1b995ca29408bff82
2013-05-15 21:11:48 +00:00
jenkins-bot bd0d61c143 Merge "Fix for default sort key crash" 2013-05-15 21:10:57 +00:00
Trevor Parscal 79df2232a5 Fix for default sort key crash
The existing default sort key was being cached when the dialog was
constructed, but on the 2nd time launching it the reference was broken.
This change gets rid of the caching and always grabs a fresh copy when
we need one.

Also, the flag indicating the default sort key has changed wasn't being
reset properly.

Change-Id: I8fb3b088f25212b8c542df65bb5a248550ff6f27
2013-05-15 21:04:10 +00:00