Commit graph

352 commits

Author SHA1 Message Date
Roan Kattouw 2ba844a372 Followup c232083: use getRelativeTitle for template titles
Otherwise we output stuff like {{Template:Echo|hello}}

Change-Id: Ib6c3996ab40e01a5ddce84b7daffa27a74020ee5
2014-11-10 15:03:10 -05:00
Ed Sanders 5238d06dc7 Support pre's in tables
Bug: 73100
Change-Id: I971420047026c91ed92a19a52d2fd3b6fbeac24a
2014-11-07 15:44:13 +00:00
jenkins-bot 209dbe2449 Merge "Allow headings in table cells" 2014-11-05 23:52:23 +00:00
Ed Sanders 26f567d84f Allow headings in table cells
We possibly want to discourage this somehow but our current
functionality achieves this by doing an isolateAndUnwrap
which for a table is catastrophic.

Bug: 72990
Change-Id: I79f1348da20385dfec014afcac0fb5464580cf2f
2014-11-05 22:34:13 +00:00
Roan Kattouw c23208371a Followup 0165a53: don't store an mw.Title object instead of a string in TemplateModel
0165a53 overlooked the fact that 'name' is also passed to
the MWTemplateModel constructor, and there it really does
always need to be a string, not magically either a string
or an mw.Title object. Oops :(

Bug: 72961
Change-Id: I0b20f0768aae4d9cc9f7af268abd0a704b6adc3a
2014-11-04 10:58:53 -08:00
Roan Kattouw 362d0ebcdf Followup 0165a53: fix typo causing undefined to be passed to mw.Title
Bug: 72948
Change-Id: I1942f153f18c5a182de38a0e067ec5a92abeefd3
2014-11-04 10:53:58 -08:00
jenkins-bot bb96a9083f Merge "Replacing MWTitleInputWidget.getValue() with MWTitleInputWidget.getTitle()" 2014-11-04 01:18:38 +00:00
suchetag 0165a53044 Replacing MWTitleInputWidget.getValue() with MWTitleInputWidget.getTitle()
Now that we have .getTitle() as a method in MWTitleInputWidget, replacing the callers
of MWTitleInputWidget.getValue() with .getTitle(). This fixes a bug in the .getTitle()
method in MWTitleInputWidget which was not taking the namespaces into account before.

Also fixes: the error when entering "Talk:" as a template title. The button to add template
remains disabled when "Talk:" is given as an input to the title here.

Bug: 71998
Change-Id: I1e629a61ec8b035d93a4b7acfecab81934019166
2014-11-03 17:05:51 -08:00
Alex Monk b71bb51171 Remove more references to ve.bind
Seems some of them have crept back in since I1a7fc7f2 (and we missed one somehow)

Bug: 72156
Change-Id: I5631fb7d5963d06aeb238c1daa44344b2060ef1a
2014-10-30 20:55:44 +00:00
jenkins-bot c83961842c Merge "Preserve original data inside parameter objects too" 2014-10-30 20:47:32 +00:00
Roan Kattouw a054a753be Preserve original data inside parameter objects too
Parsoid has added a "key" property to parameter objects,
so now we have to preserve that rather than regenerating
all parameter objects.

Do this by changing the existing use of this.originalData
to a deep extend.

Change-Id: Ib4d31c2e0f7b567da1a148b51c42e688a2590b8e
Bonus: avoid modifying this.originalData
2014-10-30 11:59:42 -07:00
Roan Kattouw 190ba17b74 Also add tableCaption to mwTable parentNodeTypes hack
Change-Id: Ic7e387bdb774699746e6bafb62daf9c843af77b5
2014-10-30 11:38:26 -07:00
jenkins-bot 48e40fe3c2 Merge "MWTransclusionModel: Exclude parts serialising to '' from the plain object" 2014-10-29 23:20:48 +00:00
Roan Kattouw f35d577acb Followup e0981a3: don't pass undefined to getClassAttrFromAttributes()
Change-Id: I987345cd923d1b128573f5669d4d0dd4e82db1c9
2014-10-29 14:50:50 -07:00
Ed Sanders e0981a327f Create mwTables with wikitable attribute by default
Change-Id: I094b1823248e16dd3b9a0a10ba13104f14798621
2014-10-29 12:52:24 -07:00
Ed Sanders cfee8047e4 Use ClassAttributeNode mixin in MWBlockImageNode
This functionality was factored out into core for this purpose.

Depends on I2db6563 in core.

Change-Id: I4fc42e1468a9f0860c7c13e73967204bdf5ad78d
2014-10-29 18:28:33 +00:00
Alex Monk a982d2d3fe MWTransclusionModel: Exclude parts serialising to '' from the plain object
So we get rid of empty content nodes

Bug: 63341
Change-Id: I1d49cc709bf92cc53ba064d148a76650c5143935
2014-10-29 01:08:41 +00:00
jenkins-bot 20b20bc97c Merge "Move autoValue logic from ui.MWParameterPage to dm.MWParameterModel" 2014-10-27 18:15:08 +00:00
Alex Monk 8120dac27b Move autoValue logic from ui.MWParameterPage to dm.MWParameterModel
Also add missing MWParameterModel#getDefaultValue

Bug: 72404
Change-Id: I4bb117d419f3845f44e321f848e95bb246a24e24
2014-10-27 03:31:36 +00:00
Moriel Schottlender b8f96bb512 Make sure initialHash exists before checking its value
(Followup on If17b50cc4a39993)
Make sure initialHash is set before checking and changing its value
in the MWImageModel method. If a user chooses a brand new image to
insert into the document (an insertion rather than update) then the
initial hash is empty, and changing its values will fail with an
error message.

Bug: 72492
Change-Id: I3f9ea74891cc0ab77a07fa5d4e9cbc591f5b93e6
2014-10-24 16:18:06 -04:00
Marielle Volz 2ac7959849 Methods for new "maps" property in TD Root
Methods for new "maps" property in
Template Data JSON root added to
the Template Specification Model

* Added maps property to MWTemplateSpecModel
* Maps filled in extend function
* Added getter function for maps

Depends on I3bf5e002

Change-Id: Ic555093625358d8fc4cb1ca8c68793b5912e8ced
2014-10-24 14:23:46 +01:00
Moriel Schottlender 14e1de1009 Update initialHash after getting defaultDimensions in image model
On initialization, the image model has an initial scalable that has
the given currentDimensions from Parsoid; these are usually correct.
However, in cases where the wiki settings do not fit the user settings
and the images appear smaller or bigger in practice than the values
of the wiki-defaults, the initial hash will store the wrong values.

We will only know what the real values for the comparison will be
after we get them from the API and the calculation; only at that
point we can update the image model initial hash.

This is important so that later the dialog can properly understand
whether to enable the "apply" button if a user changed an image
to custom size and then back to default.

Change-Id: If17b50cc4a39993f98a20a3fec3ddf5d8cb400b3
2014-10-22 00:11:43 +00:00
suchetag e3d185dd90 Replacing push.apply in VE-MW with ve.batchPush from VE core
Bug: 66206
Change-Id: Ifabfd0f28b8133e40ce822ed768442ab6a4d39ad
2014-10-16 23:12:22 +05:30
jenkins-bot 8005868566 Merge "Make MWTransclusionModel and MWTemplateDialog extensible" 2014-10-10 20:40:19 +00:00
Christian Williams 1fc13cce68 Make MWTransclusionModel and MWTemplateDialog extensible
Wikia has done some work on the template user experience, including
automatically showing all available parameters without the use of
TemplateData. In order to make our changes, we had to make some changes
to VE-MW.

ve.dm.MWTransclusionModel.js
* this.specCache is created so subclasses can reference it.
* Promise handlers in the fetch() method have been broken out as class
  methods so they can be overridden in subclasses.

ve.ui.MWTemplateDialog.js
* addPromptedParameters() has been moved to the
  initializeNewTemplateParameters() class method so subclasses can
  overwrite. In Wikia's implementation, we have a method of getting
  all parameters and a dialog that shows all of the parameters, so the
  request to addPromptedParameters is overwritten.
* Added a done() handler to the transclusionModel promise for Wikia
  extensibility.

Change-Id: I073c5850420e7719e82957f879423c2717af674a
2014-10-10 20:38:18 +00:00
jenkins-bot 1d3f875dc4 Merge "Apply link styling logic to transclusion nodes" 2014-10-08 14:30:01 +00:00
Alex Monk 8f7713e796 Apply link styling logic to transclusion nodes
Only template nodes for now. Not sure what we can do about generated content nodes in general...

Bug: 65353
Change-Id: I848f36764b446ed30c74c0e641d0973008f6880b
2014-10-08 15:03:40 +01:00
Ed Sanders 1af18c3c12 Update VE core submodule to master (984b57a)
New changes:
6bbcd6a Localisation updates from https://translatewiki.net.
b8d8a5b [BREAKING CHANGE] The Great Selection Rewrite of 2014

Local changes:
Update to use new selection/range API

Change-Id: I5480d5c77d599c93c2d374fac88bb2fdb68b0024
2014-10-07 21:39:33 +02:00
jenkins-bot 64b2568465 Merge "Use mw.Title#getRelativeText to deal with titles relative to specific namespaces" 2014-09-26 02:50:43 +00:00
Alex Monk ef1cebd111 Use mw.Title#getRelativeText to deal with titles relative to specific namespaces
Added in MW core in Ie554adef, was backported to 1.24.

Change-Id: Iedc0319042529d41d29846d1734b5481850e9552
2014-09-26 02:47:18 +00:00
Ed Sanders 26751dc4a1 Prevent exception throwing in getFilename of MWImageNode
This doesn't happen in real life (as resource is always set) but
it allows us to contruct these nodes from the factory with no data.

Change-Id: Iea146f5dc128ad9d0f36a79b6fe67d622767d46c
2014-09-24 20:43:57 +01:00
Timo Tijhof 66de06b0fa Replace use of ve.isArray with native Array.isArray
Change-Id: Ibc45e0fd80db7da872f6ef934cef915be9366e06
2014-09-23 17:58:09 -07:00
Moriel Schottlender f4dc6fd240 Add 'autovalue' to TemplateData
Allow for an auto-value for parameters in TemplateData, and make sure
this autovalue is inserted as text when parameter is loaded. This is
mostly useful for referencing date or other dynamic templates inside
parameters.

Bug: 52029
Change-Id: I6203530798ffaa62cb26190c70f7ce391bddf123
2014-09-20 00:52:23 +00:00
Roan Kattouw cf1a889ac8 Update VE core submodule to master (5f4b740)
New changes:
a047e72 [BREAKING CHANGE] Create ve.dm.Focusable and store focusable flag there

Local changes:
* Add new ve.dm.FocusableNode mixin where required

Change-Id: Ie9ee2de05acfe3c4c62c4864e65bd20397d6a069
2014-09-16 18:45:22 -07:00
jenkins-bot 71875de0c6 Merge "Check for changes in the model" 2014-09-04 21:07:12 +00:00
Moriel Schottlender cb86c4f030 Check for changes in the model
Create an image model hash and check for changes to the image every
time the dialog is changed, so we can activate and deactivate the
apply button properly.

Bug: 68058
Change-Id: I94b7e4879c6e752432c6f937a8cf1b9f15d1b56d
2014-09-04 14:05:01 -07:00
Moriel Schottlender a83086c007 Set default dimensions based on original dimensions
Make sure default dimensions are only set if we have the original
dimensions. Also fix a bug where image default dimensions were
calculated according to current width/height rather than those
of the original dimensions.

Bug: 68000
Change-Id: I8c3acc18b317f82c6b88966950e74b956936dda4
2014-09-04 11:29:51 -04:00
Moriel Schottlender e34fdae776 Make the image model persistent
Make sure the image model can switch parameters when the image
source is switched, rather than having to instantiate a new
image model.

Also, when the image is changed, retain aspect ratio but make sure
to preserve the width of the previous image (unless the new image
is smaller)

Added 'resizeToBoundingBox' and 'scaleToThumbnailSize' static methods
in MWImageNode that return scaled dimensions based on the image
dimensions and the bounding box detals.

Depends on core change Idbb8b29db8e

Bug: 69450
Bug: 68000
Change-Id: I4327c86a9127f46da5522dc1197411fda757d5a4
2014-08-28 12:04:49 -04:00
James D. Forrester a232147b11 Switch 'disallowQuotedKeysInObjects' jscs rule on and fix up
Change-Id: I75ac4b378ef485feead9d0eff34ed7877b94b5d0
2014-08-22 13:50:48 -07:00
Ed Sanders 4af79bf3d5 Re-order methods in MWImageNode
So static methods are actally in the section marked 'Static methods',
before non-static methods, per our coding standards.

Change-Id: I17bea17a1409b02f263375c6434be872e4d239ba
2014-08-22 13:33:08 -07:00
jenkins-bot 0af7c2d634 Merge "Correct MWImage* resource regex to find literal .s rather than characters" 2014-08-21 02:07:50 +00:00
jenkins-bot df85006b03 Merge "Refactoring ImageModel constructor" 2014-08-21 01:54:46 +00:00
James D. Forrester 5148a0836a Rename "reference list" to "references list" internally
That's what we call them in human-speak, and it makes sense to have them align.

Bug: 49923
Change-Id: I8dcfba249fb9ea13c2b4052e98a4d253c302b1ba
2014-08-20 18:26:54 -07:00
James D. Forrester 7d3f9797c0 Correct MWImage* resource regex to find literal .s rather than characters
Change-Id: Ie5db0b4b6cdb607985b53228c4ceb26c57af9dfc
2014-08-20 18:16:13 -07:00
Moriel Schottlender 88a0790aab Refactoring ImageModel constructor
This change creates the scalable object that's attached to the image
model through its constructor. Also adds a 'resourceName' variable
to store attributes.resource, which is mostly used for API calls.

Change-Id: I713c59d1cec5f87387a87c98a59e75b3d5c1050e
2014-08-20 18:13:12 -07:00
Bartosz Dziewoński 694c454dcd Blacklist annotating link node with more links
Previously one could select over a link node and linkify the
selection, with tremendously funny results.

Change-Id: Ic5a2132b2d18280099a6024bc4ec2b1333eca98f
2014-08-02 12:34:30 +02:00
jenkins-bot 06f29e6895 Merge "Remove redundant setting of title in link nodes" 2014-07-30 17:22:49 +00:00
Ed Sanders c451656d6d Remove redundant setting of title in link nodes
Also cleanup redundant overrides, documentation and
unused messages.

Depends on If22a5197 in core.

Change-Id: I533235f4eb5d703783a8fb45dff5e7be465f4ebb
2014-07-30 10:32:49 +01:00
James D. Forrester 1fcc9fa035 Update VE core submodule to master (61dea59)
New changes:
76bbf3b [BREAKING CHANGE] Fix camel-casing of countNonInternalElements

Local changes:
Use renamed countNonInternalElements function

Change-Id: Ib5f86ea5cfeb5e577f61349ed4bbb231ea155638
2014-07-29 17:15:35 -07:00
Roan Kattouw c7fce9b2be Fix corruption bug in sortkeys containing underscores
We normalize underscores to spaces in sortkeys in toDataElement,
but when toDomElements recomputes the normalization to decide
if the sortkey really changed, it doesn't normalize underscores.
This is broken, both code paths need to use the same normalization;
we do this correctly for the category name.

This bug appears to date back to the introduction of category
support in March 2013 :(

Spotted in https://it.wikipedia.org/?diff=67220927

Change-Id: Ie3257fa335f3bd24a36c8654f3f5a24e89d7a9b9
2014-07-26 00:24:01 +00:00
jenkins-bot 3771aa92c1 Merge "Make the image model work without a node" 2014-07-24 00:32:54 +00:00
Moriel Schottlender 1bc7d074fe Make the image model work without a node
The image model should go by image attributes (whether it comes from
an existing node or a new one) and not a node.

Bug: 68242
Bug: 68000
Change-Id: I4cabd678157619331b3c47d3b44bc16a28fd7bd7
2014-07-23 17:27:30 -07:00
jenkins-bot 960922cdb0 Merge "MWReferenceSearchWidget buildIndex optimisations" 2014-07-23 02:23:43 +00:00
jenkins-bot f7c7efbad7 Merge "test: Move mw into the global list of globals for VE-MW" 2014-07-23 00:02:22 +00:00
Alex Monk 42db347213 Auto-open "Add parameter" part of template dialog when tabbed to or opening with no required/suggested params
Bug: 55925
Change-Id: I8475074e25de3969717a6d4dbb88bbb0000ebb4e
2014-07-21 22:38:05 +01:00
Ed Sanders d4cd816b6f MWReferenceSearchWidget buildIndex optimisations
* Each item builds an MWReferenceModel which creates a document
  slice clone. This is very expensive and we only use the model
  for getting basic attributes, so defer the evaluation of the
  document.
* $.show is expensive and, in this case, unnecessary.

Change-Id: I99abc4c1b17f05559a9cae68b15121a8be6d23fb
2014-07-21 14:44:58 +01:00
James D. Forrester c2f37a0450 test: Move mw into the global list of globals for VE-MW
Silly to have 38 MW-specific files needing to declare that they're using mw.

Change-Id: I97891ed922fe0c37d8c96425a4d23bd15098438b
2014-07-19 17:42:45 +00:00
Moriel Schottlender e94a185fda Update VE core submodule to master (ad18102)
New changes:
65042de Fix alien test data
83dccbe Add toolbar menu labels to each group for consistency
2e40ef9 Move 'language' tool from the insert to the styling menu, like in VE-MW
6fb21b2 Add toolbar action section to SA demo with keyboard shortcuts tool
f3eb000 ve.ui.Toolbar: Optimise onSurfaceViewKeyUp performance
eb4e9eb Make sure the document is focused when setting a selection
48584d3 Fixes to getRelativeOffset and getRelativeRange		
fcc427f [BREAKING CHANGE] Remove generatedContents argument from afterRender
825e4be Documentation fixes in test utils		
dbbbe0b Unit tests for showSelection		
1ba9234 Don't handle up/down on focusableNodes even if backwards
a667b87 Remove label from 'insert' menu, and instead use a large plus icon
88885b1 Localisation updates from https://translatewiki.net.		
1f3b79f Initialize data first		
18369b1 Add 'clone' and make 'getDimensionsFromValue' static in ve.dm.Scalable		
92e6b7b Switch to 'custom' when MediaSizeWidget updates		
d0cd87e Localisation updates from https://translatewiki.net.		
1ee21ff Remove lies from documentation		
164f07f Safely ignore requests to open unrecognized windows

Local changes:
Work on a cloned scalable when editing images

Make sure the image model handles a cloned copy of the node's
scalable object, which is then shared with the media size widget.

Bug: 67687
Change-Id: Ie3676b715f5bae3d83da03d667cef3a6a847e212
2014-07-16 22:38:09 +00:00
Moriel Schottlender 537e751abe MWImageModel unit tests
Change-Id: I87d1383b383e2a7cd6cb38ed51710cc36a59f63e
2014-07-15 12:47:32 +01:00
Alex Monk 51142e8b11 Replace ve.bind( fn, ... ) calls with fn.bind( ... )
Bug: 62762
Change-Id: I1a7fc7f27fa737d17f5c6b3d084ef4a35e4bebc0
2014-07-10 13:54:07 +00:00
jenkins-bot 410f36d2d9 Merge "Try some more to handle template namespace properly" 2014-07-03 01:23:47 +00:00
Alex Monk c6396e019e Try some more to handle template namespace properly
Looks like I messed up in Ia67f9054 and got a setting backwards

Also prefix titles in a couple more places

Bug: 67384
Bug: 66893
Change-Id: Id6d5841ee1645be62a024308da48ddc6769c78b6
2014-07-03 01:20:02 +00:00
Moriel Schottlender 6bd9fde5c5 Merge Media Edit and Media Insert dialogs
Merge the media edit and media insert dialogs. Allow editing
of media properties when inserting a new image, and also
allow the user to replace the image on edit.

Bug: 67170
Change-Id: I35bd95503565dbf95090ee8110284db5a8fbba83
2014-07-01 17:30:51 -07:00
Alex Monk a103f4078d Handle transcluding templates outside of the template namespace properly
Stop prefixing all requested titles with 'Template:', and don't try to use
colon prefixes when transcluding except when deliberately transcluding from the
main namespace.
(A title prefixed with a colon on MediaWiki is used to create a link to
something that would normally be included as a File/Category)

Bug: 52609
Change-Id: Ia67f9054a56e71153339f961bbbcadb565115748
2014-06-28 18:07:45 +00:00
jenkins-bot b7375cfdaa Merge "Don't remove 'extension' from template names" 2014-06-26 23:47:04 +00:00
Moriel Schottlender 01596205fb Unimplement wgSVGMaxSize
Because it doesn't work in MW.

Bug: 66865
Change-Id: Idad2352bee32cbf10c80a757c59e518abaa342de
2014-06-26 19:56:03 +00:00
Alex Monk 1dd64f80b6 Don't remove 'extension' from template names
Use getMainText instead of getNameText in a couple of places

Bug: 66939
Change-Id: Ie81ab98465909b65787ddf589353aaad6fb47dc2
2014-06-26 20:37:06 +01:00
Timo Tijhof 19afd65a08 build: Update jscs and use new "wikimedia" preset
Our coding style has been upstreamed and first released
in node-jscs v1.5.0 (grunt-jscs-checker v0.6.0).

Change-Id: Ifc0cfc7177946b9d11407f60e38b0177883724c5
2014-06-26 17:00:15 +00:00
Ed Sanders 840264e85d Remove Hiero extension code from VisualEditor extension
It doesn't belong here.

To be added in the wikihiero extension in If55af2ad.

Change-Id: Id8b026ac07cfb31e4c25f81fb67f531448454ee0
2014-06-23 09:18:42 +02:00
Ed Sanders 4b9c91f164 Fix fragment after inserting an image node
* Return the fragment as it may have been cloned in the process
* Do away with DM node tree traversal, we can do everything
  with offsets.

Bug: 65706
Bug: 65716
Change-Id: I9a44d562d9365d72adac199725b52555cf0a8009
2014-06-19 17:45:21 +01:00
Ed Sanders c0bd7487f5 Fix selection after inserting nodes
Some surface fragment methods return a clone, so make sure
that is written back to this.fragment in dialogs, as this.fragment.select()
is called on teardown.

Functionally depends on If26cc0a2d in core.

Bug: 65706
Bug: 65716
Change-Id: Ia552b2a4c4c59ffc308a4acdecac78a7803a1c1f
2014-06-18 22:45:52 +00:00
jenkins-bot f2c7788522 Merge "Use registered target, instead of ve.init.Target" 2014-06-18 01:45:01 +00:00
Ed Sanders c70d32c017 Use registered target, instead of ve.init.Target
Depends on I468d4eb4 in core.

Uses various hacks to trick the test runner into thinking
an MW target is in use, when in fact we still use SA targets.

Change-Id: If4611307d5d7aaee4af84f86ef82faf9078043b6
2014-06-17 20:41:01 +01:00
Moriel Schottlender e2105be50b Insert inline image inside list to the existing paragraph
When converting from block to inline image inside a list, insert
the image into the existing paragraph instead of wrapping it in
a new paragraph.

Bug: 65924
Change-Id: Iefbb2a9ae536f51987bdd1aa8b7269bf6245d2b0
2014-06-13 18:07:24 -04:00
Krenair 0abbc2b02b Allow VE users to change displaytitle in advanced settings dialog
Some parts of this are heavily based on how the existing defaultsort stuff works.

Relies on I9bb80b01 and Iba2fff95

Bug: 56868
Change-Id: I5f0ce2ec36e82b04d9e1357b14046867c1dd3b60
2014-06-12 01:27:57 +00:00
Moriel Schottlender 9f2d31cfa0 Disable the size widget for 'frame' images
Frame images are not resizable; disable the media size widget when
the frame type is selected.

Depends on the change in ve-core:
Id1010798d30e2928358acb5694c429b9ab68ad57

Bug: 66353
Change-Id: I8c8da8933c51ba709a834731425d19445009673f
2014-06-10 18:43:25 +00:00
jenkins-bot 5f063f4e5d Merge "Initialize 'default' size properly in media edit dialog" 2014-06-10 18:41:46 +00:00
James D. Forrester 4be0218bbb Update VE core submodule to master (5f10e73)
New changes:
a53f101 Update OOjs UI to v0.1.0
1fa518b Update OOjs UI to v0.1.0-pre (15f4156bac)
257af53 Use ContextWidget instead of toolbar inside context menu
5f10e73 Follow-up Ia2076a42: Mark getDescription() as @inheritable for Annotation, Node

Local changes to adjust for the ContextWidget changes.

Change-Id: I47f68f5cf1b9583dab9bd0109fa6504481bdfc67
2014-06-09 18:35:08 -07:00
Roan Kattouw cc90e3c832 Followup bd49f97: prevent MWExtensionNodes from having children
MWBlockExtensionNodes would duplicate their children in the output DOM:
they would appear once as restored from originalDomElements, and again
because the contents then got converted to linear model data and
that got converted back to DOM as well.

Bug: 66396
Change-Id: I4513ffc1cf3eb8726ac94252fe1526fac6d8bdf3
2014-06-09 18:01:42 -07:00
Moriel Schottlender cd3cbf1f9b Initialize 'default' size properly in media edit dialog
Make sure that image model and media edit dialog initialize the
default size properties according to the scalable correctly.
Also make sure that on creation of a new node or edit of existing
node's properties follow on whether the image is set to default
size or custom size.

Depends on the ve-core change:
Ia6bb041bfc050a48d8c40bbff4b73ed2893085e2

Bug: 66149
Change-Id: I6f60fba28e11a111bb40a100148ed1f12d518890
2014-06-09 19:39:15 -04:00
Ed Sanders bd49f97553 [BREAKING CHANGE] Separate ExtensionNode in Block/Inline
Previously they were always inline.

MWExtensionNode is now a mixin and classes which inherit it should
now inherit MWBlockExtensionNode or MWInlineExtensionNode.

Change-Id: I0ddcabeb63acdf852e252c41add5233c00723f4c
2014-06-06 20:40:19 -07:00
James D. Forrester 2c00c39393 Update VE core submodule to master (2587549)
Update DM node constructors for I81c60d4a in VE core.

New changes:
2587549 [BREAKING CHANGE] Fix Node construction arguments

Change-Id: I8d4f37b631fe85a78c72407937477963ac49f87a
2014-06-06 20:28:03 -07:00
Moriel Schottlender 8bca6add25 Fixing issues in the alignment select in Media Edit dialog
Fixing the behavior of alignment select and checkbox in the edit
dialog. Adding a check on all UI events to make sure they update
the model only if the model value is different than the UI value.

Also adding the ability to check the default direction of a
specific node type, to predict default alignment values.

Bug: 65916
Change-Id: I82f624fa788383dec0a12afb473aef01593e670e
2014-06-05 21:20:44 -04:00
jenkins-bot 27abd137fc Merge "Update image size after changing type" 2014-06-04 23:50:54 +00:00
Moriel Schottlender 8ca025be5e Update image size after changing type
Make sure that if the image has default dimensions set up in the
media edit dialog, the scalable (and image CE rendering) receives
the correct dimensions.

Bug: 65886
Change-Id: I6bd2d1681a3d780554767fe77b2640795170184f
2014-06-04 16:48:43 -07:00
jenkins-bot cc14f33be9 Merge "Followup to small SVG default size" 2014-06-04 23:44:24 +00:00
Moriel Schottlender 4355ea4f10 Followup to small SVG default size
Make sure svg drawings on block images have the default size as
the wiki default, no matter their original set size.

Also took the opportunity to clarify the synchronization method
for scalable and image type in ve.dm.MWImageNode and call it when
the image model is loaded to make sure the details are always
synchronized before edit.

Followup to I682d832e456a501836f33ed1dfc7dbd78a4edf53

Bug: 62893
Change-Id: Ic47016d171634c532092067957cc2c3d431e9746
2014-06-04 19:38:15 -04:00
Moriel Schottlender 74a20b8ec9 Adjust default alignment when switching from inline to block
Once more with feeling; default alignment when switching between
inline to block and vise versa. This time, the problem was mainly
that the checkbox for position cannot be updated without triggering
its update event. It was triggered, however, before setting up the
positioning, which caused the model to run positioning twice and
get things wrong.

Another smaller fix in this commit was done to make sure that
the image model remembers the previous alignment, so when image
type changes from inline to block and vise versa, and the alignment
was default, it can recalculate default value for the new node.

Bug: 65564
Change-Id: I6c16a7855ad7e3ce302fa3d042d0a402251b31f0
2014-06-03 00:20:57 -04:00
jenkins-bot c9a56f17a0 Merge "Another default alignment fix to MWImageModel" 2014-05-28 22:12:01 +00:00
Moriel Schottlender f9df17c052 Another default alignment fix to MWImageModel
This time in the installment: Allow the model to predict the type
and default alignment based on parameters rather than just the
current status. This is important for initializing images, especially
inline images whose 'align' attribute is null or undefined, but must
be examined for default alignment.

Also changed:
* Make sure that model operations change each other, rather than
  let the editor change 'unrelated' model parameters.
* Use selectItem rather than chooseItem to avoid emiting the 'choose'
  event on edit dialog initialization.

Bug: 65564
Change-Id: I8c23fc53e7738d59565294d8b98fe7351bebbc67
2014-05-28 18:05:00 -04:00
Roan Kattouw 7d86729858 Decode URL encoding in resource attriute for images
In getFilename(), decode URL encoding and replace the search
for 'File:' with a more standard ./ stripping regex.

The ./ regex came from generateContents) in the CE class;
made that code use getFilename() instead.

Also apply decodeURIComponent() to the result; but protect against
exceptions because it's a useless piece of garbage.

Bug: 65611
Change-Id: I7e81a8dc26d1c636c6571d96f43a394a53490587
2014-05-28 12:21:06 -07:00
Moriel Schottlender 7a6f59920d Fix default alignment in MWImageModel
Make default alignment a computed value, and make sure the GUI listens
to 'choose' instead of 'select' events for SelectWidgets so to prevent
recursive calls and make sure the GUI is updated properly.

Also added a default alignment check on type change so the user can
visually have an indication that the new image will have a different
alignment. The user can then change the value manually.

Bug: 65564
Bug: 65596
Bug: 62852
Bug: 65617

Change-Id: I55e16775d18e0a4bf7f1fa73bbb3aa5e0aa51a79
2014-05-24 03:22:52 +00:00
Alex Monk 9182fc1958 Follow redirects when looking up template data
Relies on If6fb5856 to do anything useful, but degrades gracefully to current
behaviour.

Bug: 50964
Change-Id: Ia35c2f433a1a604d7794f367fd10dbccac102b89
2014-05-23 19:57:22 +01:00
Roan Kattouw c6fa82f0fb Don't add |link= when converting block images to inline
Change-Id: I71d996df4839bb507b970c55f97d5543665f4f81
2014-05-21 16:05:27 -07:00
Moriel Schottlender fad534ee4b Adjust newNode range and fallback in MWImageModel
When inserting a new node, get the proper fragment range and ask
for the node from within the search loop. Also added a fallback
for the case that the node wasn't found, and a caption cannot
be added.

Change-Id: Ic19d9b1cd2739435137f633de09a13b25a11a0cb
2014-05-21 05:56:37 +00:00
Moriel Schottlender 7d228673bb Fix MWImageModel's getImageNodeType()
* Fixing a typo in the getImageNodeType() method ('frame' was supposed
  to be 'frameless').
* Adding a check for type 'mwBlockImage' before editing/adding captions
* Using the node's getType() method instead of the model's where possible.
* Adjusting default alignment, so that when we check if it is set, it gives
  us the actual answer, which is always useful.

Bug: 65568
Change-Id: I1687d8c7430c723b52448a9e24641e2c30d85d6a
2014-05-21 00:01:02 -04:00
Moriel Schottlender 37b3c07b26 Image model and the media edit dialog
Creating an MWImageModel that handles all image edit operations.
If the new attributes mean a change of image types from inline
to block or vice versa, the model will handle the creation and
insertion of the new node.

Change-Id: Ibe71bc8bd74e4ba5a024ac722432ccf0b8f65e71
2014-05-19 21:11:06 -04:00
jenkins-bot 424c4e4764 Merge "Revert "Cache image scalable promises by filename"" 2014-05-14 22:56:39 +00:00
Catrope 582daaeb70 Revert "Cache image scalable promises by filename"
Caused bug 65314.

This reverts commit 97bc12a421.

Bug: 65314
Change-Id: Iaca46e5458fbc44446cc92e7241dd24d7de883d8
2014-05-14 22:54:48 +00:00
Roan Kattouw a15fa5a17c Make citation tools' compatibility check use normalized titles
Greatly enhance the functionality of ve.dm.MWTransclusionNode#isSingleTemplate
and actually use it places.

Use mw.Title to normalize titles, accounting for case differences and
spaces vs underscores. Also allow an array of template names to
be specified.

Use isSingleTemplate() in the transclusion and citation dialog tools,
which were duplicating this logic. Also document the .static.template
properties.

Without this, the citation tool will appear for a reference using
{{Cite news}}, but not for one using {{cite news}} or {{Cite_news}}.

Change-Id: I18d2bb1b22a5ab269694ad0818b1bb326ef8d1fd
2014-05-10 21:10:09 +02:00
Moriel Schottlender 97bc12a421 Cache image scalable promises by filename
Make sure that each API request per file is delivered once. If the
file appears more than once on the page, the API request for
scalable details will be sent once and cached so there aren't
multiple API requests per image.

Change-Id: I68507a8ceb31b77dbf33d1074939ce6219cf076e
2014-05-09 11:17:06 +02:00
Trevor Parscal 853e4872b4 Restyle parameter pages
* Move description to a popup behind a little info icon button
* Make required indicator generic status indicator (required/deprecated)
  and move to left of the field
* Move param name and actions to above the field
* Show deprecated status and description

Bonus:

* Use auto-focus on CitationDialog (whoops!)
* Make pages that aren't meant to scroll not scroll (whoops again!?)

Depends on I59211b2 in OOUI

Bug: 53612
Change-Id: I3b968ad14aa6c43b6484e2565a9367d2ebc72fc5
2014-04-30 16:27:19 -07:00
James D. Forrester 3569efba3b Use TemplateData's suggested status for parameters
Change-Id: I8c8522d1fcc7e7b26984d72a8f8aaaedbddb9cb4
2014-04-28 12:10:31 -07:00
Krenair 021152586b Add checkboxes to set some metadata on page metadata panel
Also fixes some errors in I752705f6
And while we're there, clean up some mostly duplicate functions

Bug: 57169
Bug: 57170
Bug: 57171
Bug: 57172
Change-Id: I1e3dca3868a267e91bccb0ae277012c26ca82174
2014-04-21 16:29:31 -07:00
Ed Sanders 340a939c97 Remove remaining uses of surfaceModel#getSelection in dialogs
These were being used indirectly in the MW*Model's. Use surface
fragments instead.

Fixes I0fae3e5ff2bd.

Change-Id: I1d6aa5e00a9315cf7088f87f9e9d828833feec64
2014-04-11 11:14:43 -07:00
Roan Kattouw f2422d916c Update VE core submodule to master (c150259) for scalable changes
ve.dm.Scalable is now a computational model for image scaling and
size manipulation. This commit adjusts the nodes and the edit and
insertion dialog to handle the new scalable model, and by that
use a centralized computational engine for all scaling and size
changes.

New changes:
3ec19fb8 Refactor Scalable functionality

Change-Id: I017a017924f544cc8bc9b7d8245335759ae0e890
2014-04-09 17:29:49 -07:00
Trevor Parscal 793fbb0e24 Correctly insert or update citations based on template option
When using a tool that opens a citation or citation transclusion dialog,
the dialog shouldn't use edit mode unless the template in the node and the
template the tool would insert match.

Bug: 63452
Change-Id: I34a5a2da576247f4046da45f742bccc3cec22c5a
2014-04-02 16:38:34 -07:00
jenkins-bot 50f9f2b983 Merge "Fix copyright year range for fourteen files not updated to 2011-2014" 2014-03-26 22:55:08 +00:00
Roan Kattouw 04f3296234 Rename stray this.refGroup usage to this.group in MWReferenceModel
this.refGroup is only ever read and never written, so obviously it's
always undefined. And it turns out that creating references with
listGroup='mwReference/undefined' crashes when you try to remove
them again.

Bug: 63085
Change-Id: Id326208bd6b3fe3b602ed6e3b57b7ea06d8ceb2c
2014-03-25 13:47:24 -07:00
James D. Forrester 95dee3ceee Fix copyright year range for fourteen files not updated to 2011-2014
Change-Id: Ibef2bf965dbd970b235a57058bcb3922a8777aa2
2014-03-24 18:36:51 -07:00
Trevor Parscal be199c0bf2 Ultra-mega-hyper-citation editing on crack
Objectives:
* Allow users on-wiki to create tools and dialogs for citation templates
of their choosing
* Allow editing of citation templates directly, without having to go
through the reference dialog
* Provide citation template tools within reference editing that use the
same titles and icons as the citation tools do, but don't wrap the
inserted content in a ref tag

Changes:

* Reference list was cloning the DOM element it was inserting into its
view before the generated content node could finish rendering, so it
never ended up showing the finished rendering in the reference list
* Documenting hack about use of reference list node's destroy method,
and how we are depending on destroy not canceling generated content
rendering
* Introduced reference model
* Added saving/updating method to transclusion model
* Added getPartsList method to dm transclusion node, which caches the
result and invalidates the cache on update
* Added citation dialog, which extends transclusion dialog
* Added cite group to toolbars, cite-template in reference dialog toolbar
* Factored out getting the node to edit and saving changes procedures in
transclusion dialog so they could be extended in citation dialog
* Updated uses of autoAdd as per changes in oojs-ui (Ic353f91)
* Renamed MWDialogTool file since there was only one tool in it
* Expanded TransclusionDialogTool file out since there is now more logic
to it
* Switched to using ve.dm.MWReferenceModel instead of plain objects in
reference search widget

Configuration:

If you add to MediaWiki:Visualeditor-cite-tool-definition.json the
following code you will magically be presented with a delightful array
of citation options:

[
    { "name": "web", "icon": "ref-cite-web", "template": "Cite web" },
    { "name": "book", "icon": "ref-cite-book", "template": "Cite book" },
    { "name": "news", "icon": "ref-cite-news", "template": "Cite news" },
    { "name": "journal", "icon": "ref-cite-journal", "template": "Cite journal" }
]

...or...

[
    {
         "name": "any-name",
         "icon": "any-ooui-icon",
         "template": "Any template",
         "title": "Any title text"
     }
]

The title text is derived either from the title property or from the name
property by pre-pending the string 'visualeditor-cite-tool-name-' to
generate a message key. Titles for 'web', 'book', 'news' and 'journal' are
provided. The icon is a normal oo-ui-icon name, and more icons can be
added, as usual, by adding a class called .oo-ui-icon-{icon name} to
MediaWiki:Common.css. 'ref-cite-web', 'ref-cite-book', 'ref-cite-news'
and 'ref-cite-journal' are provided. The template name is simply the name
of the template without its namespace prefix.

Depends on Ic353f91 in oojs-ui

Bug: 50110
Bug: 50768
Change-Id: Id401d973b8d5fe2faec481cc777c17a24fd19dd4
2014-03-24 19:24:38 +00:00
jenkins-bot 0c8cb151fb Merge "Remove the math inspector code" 2014-03-20 05:34:31 +00:00
jenkins-bot d60a375500 Merge "Ignore placeholder parameters in serialization" 2014-03-20 05:32:44 +00:00
Roan Kattouw 4bf24633e0 Ignore placeholder parameters in serialization
Apparently adding a parameter whose name is an empty string causes Parsoid
to output |undefined= . And I can't say I blame them.

Bug: 62621
Change-Id: I01bc401ae60935dcce309b743057641e2e503528
2014-03-19 22:27:59 -07:00
Roan Kattouw 0304b89db9 Add lookupTitle attribute
This is the normalized title without the fragment, which is what
should be used for existence check purposes. Also add a test for
an internal link to a page's section.

Change-Id: I0e04f64c1bebeff84a0c17ef9b6c8dc06876f769
2014-03-19 19:34:19 -07:00
James D. Forrester aea64bf2df Remove the math inspector code
Moved to the Math extension in I8e582ee6deadc2750

Change-Id: Iab0c56246626de1e0f6ab770e777c0a28756fa75
2014-03-19 19:27:25 -07:00
James D. Forrester e85d840d64 Create remaining meta items in DM
Add meta items for the four remaining mwPageProp behavioural flags from Parsoid
that are added by MediaWiki core. These are each waiting for UX implementation,
based on the lack of context information in MWMetaDialog about the page, or
about the wiki:

* __NOGALLERY__
* __HIDDENCAT__

  — These only make sense in a Category: page.

* __NOTITLECONVERT__ // __NOTC__
* __NOCONTENTCONVERT__ // __NOCC__

  — These only make sense on wikis that have content or title conversion.

Change-Id: I752705f65cfbd79c7f3f71270659793996868aff
2014-03-13 01:57:48 +00:00
Moriel Schottlender 5f2ce173a0 Enforce width-only default size only on larger images
While the documentation is unclear, it seems that the 'thumbsize' in
$wgDefaultUserOptions is setting up width limit rather than a general
bounding box.

Things that are adapted in this fix:

* Only resize the image if the image is bigger than default and marked
  as default size.
* Only limit width, even if the image is tall.
* Add rounding to calculated height value.
* Make sure new images follow these rules as well on insertion.

Bug: 62293
Bug: 62279
Change-Id: I37525bf3480bb1da8b0538f9b38576616aabbfa6
2014-03-10 19:05:14 +00:00
Trevor Parscal 37f4996392 Merge TransclusionDialogs into one
* Automatically select single mode when possible
* Allow dynamic switching when possible
* Hide most of the controls and information when in single mode
* Allow parameter model to be instantiated without name and value args
* Place add param buttons at the bottom of template and param pages
  which are only visible when in single mode and on the last page

Change-Id: Iaffbf1863b808c8089dfcf09a976d165f28c8b74
2014-03-05 18:15:17 -08:00
Roan Kattouw c0380f16a4 Work around DOM corruption for default-sized images
This doesn't really fix the underlying issue that the
width and height are overridden to be the default size
in the DM even if that's wrong (in the case the image's
original size is smaller than the default thumbnail size),
but it fixes the DOM corruption by storing the original
width&height and restoring them if the image still has
defaultSize=true on the way out.

Bug: 62172
Change-Id: Iaee798c5bb501310e52d0ac832b2e7cd833fc438
2014-03-05 17:44:01 -08:00
Moriel Schottlender 89aecd54ba Deal with 'none'/'border' and default size in media edit
There are several conditions to defaultSize behavior of thumbnails and
frameless images and other images when it comes to default size. In the
same principle is 'border' which is not quite a type despite the fact
it 'behaves' as such in wikitext (and has a unique identifier that comes
instead of the other types.

This commit aims to organize this behavior for the user in an
understandable manner.

* Add 'basic' image type for images that have no specified type ('none')
* Handle the difference in 'default' size behavior between basic images
  and thumbnails/frameless. The thumb/frameless images have the default
  wiki size. Other images' default size is their original dimensions.
* Force wiki-configured default size for thumbnails and frameless images
  in the DM. This is done because at the moment Parsoid's output is of
  Wikipedia's default size rather than the local wiki's. The size is
  adapted if needed, directly in the DM.
* Added 'border' as a pseudo-type checkbox flag that sets css class
  'mw-image-border' is for parsoid rendering on save.
* Add 'make full size' to the size widget select and treat it as a faux
  default button for basic and frame images.

Bug: 62013
Bug: 62024
Bug: 61155
Bug: 61059
Bug: 61282
Change-Id: I6778705306f0dd6bb96afeb91383089a4ddab7ed
2014-03-05 03:53:46 +00:00
Roan Kattouw 810fc7df16 Update VE core submodule to master (74be717)
Also add MW configuration for ModelRegistry back, was removed in core.

New changes:
564c459 Localisation updates from https://translatewiki.net.
f30e061 Consistency in test header comments
74be717 Remove MW-specific config and genericise tests in ModelRegistry

Bug: 53148
Change-Id: I67e77bd41bbff52f88632ff9e4cf5e4c48251174
2014-03-03 11:24:56 -08:00
Trevor Parscal 3edad8d0da Fix off-by-one error in TransclusionModel when moving items
The error occurs when moving an item down (increasing index) which
removes the item, adjusts the index and then inserts the item. The index
shouldn't be adjusted when moving one down, however, because once
removed everything shifts and the +1 index set initially to move it is
still good.

Change-Id: I44bd2b3eb4bbbef58a6ac181e75969ec7c2cab6f
2014-03-01 01:24:11 +00:00
Trevor Parscal ec004d16be Move parameter adding to a placeholder page
Parameter placeholder pages are generated for parameter with empty
string as their name.

Change-Id: I56c3df1ada6c4f41ebf6466ca280a2333da60071
2014-02-28 17:20:24 -08:00
Trevor Parscal cbd3419dfb Update VE core submodule to master (ac4b49a)
Also update template/transclusion code for OOJS UI
OutlineControlWidget changes, and uses some of the new
functionality.

New changes:
ac4b49a Update OOjs UI to v0.1.0-pre (51f922ba17)

Change-Id: Id7a1f60cd6ce3bdaba7ccb8774563b9e81c75cad
2014-02-28 16:41:42 -08:00
jenkins-bot 84fb866ed7 Merge "Set up wiki-default image size" 2014-02-26 20:31:49 +00:00
Trevor Parscal e2f6d798b8 Rename MWTemplateParameter* classes to MWParameter*
* The name was getting super long, and the Template prefix doesn't
  appear to be important.
* Soon we will add a placeholder class, which would have been
  MWTemplateParameterPlaceholder, but now just MWParameterPlaceholder
  which seems a little less ridiculous.

Change-Id: Ie2dfe0d4c7b960cd554f89fa6340173e8786c88a
2014-02-26 10:54:45 +00:00
Moriel Schottlender b54575a797 Set up wiki-default image size
This commit makes several adjustments to make sure default size is being
handled correctly:

* Add wiki's default size configuration parameter to the
  VisualEditor.hooks.php file so it can be called from VE.
* Make sure new images are inserted with default size and are
  marked 'defaultSize = true' for the DM to handle.
* Force default size if 'defaultSize=true' in the DM
* Add a 'default|custom' switch to the media edit dialog for size
  inputs. When 'default' is chosen, the media size widget will be
  emptied, displaying its placeholders (default size)
* When the size widget's values are 0 it will automatically turn to
  default size values. If the value started default and the user
  typed in a size, it will automatically override default and use
  custom size.

Bug: 47804
Change-Id: Ib973ea2afa96090a4ba61b2b55ee63457f1329c1
2014-02-25 16:26:15 -05:00
Timo Tijhof 58c647e3ac Ensure we use our references to certain native or upstream methods
Checked:
 ve.cloneObject       (oo|OO).cloneObject
 ve.getObjectValues   (oo|OO).getObjectValues
 ve.getObjectKeys     Object.keys
 ve.compare           (oo|OO).compare
 ve.copy              (oo|OO).copy
 ve.isPlainObject     ($|jQuery).isPlainObject
 ve.isEmptyObject     ($|jQuery).isEmptyObject
 ve.isArray           Array.isArray
 ve.bind              ($|jQuery).proxy
 ve.indexOf           ($|jQuery).inArray
 ve.extendObject      ($|jQuery).extend

Fixed:
* ve.dm.MWBlockImageNode.js (added in Iebb2081de)
* ve.dm.MWInlineImageNode.js (aded in I62ec12a6b)
* ve.dm.MWConverter.test.js (added in I90273786a)
* ve.ui.MWMediaInsertDialog.js (added in Ia5ad9a8c0)
* ve.dm.MWTemplateSpecModel.js (added in Ic3eb66538)
* ve.init.mw.MobileViewTarget.js
* ve.init.mw.ViewPageTarget.js
* ve.init.mw.Target.js

Skipped:
* ve.init.mw.ViewPageTarget.init.js
  - Feature test (which is for the very references from ve.js
    being ensured in this commit).
  - Misc code using $.inArray (can't use ve.js yet since that
    isn't loaded yet there).

Change-Id: I73ae005d3692e871fdcaea938641558c0b98ec69
2014-02-20 22:30:29 +01:00
jenkins-bot 327380c501 Merge "Let users set __NEWEDITSECTION__ & __NONEWEDITSECTION__ status" 2014-02-20 03:23:33 +00:00
James D. Forrester ffbe2565bb Let users set __NEWEDITSECTION__ & __NONEWEDITSECTION__ status
Add a trinary option to the page settings pane of the meta dialog that
lets users set the page to have __NEWEDITSECTION__, __NONEWEDITSECTION__,
or neither (and so have default behaviour).

Bug: 57168
Change-Id: I3198409c6aaa4cbce7e26fd56d390ffc91e91eef
2014-02-19 19:21:49 -08:00
jenkins-bot 78bdbb4c43 Merge "Let users set __NOINDEX__ & __INDEX__ status" 2014-02-20 01:50:29 +00:00
James D. Forrester 051c3498ae Let users set __NOINDEX__ & __INDEX__ status
Add a trinary option to the page settings pane of the meta dialog that
lets users set the page to have __INDEX__, __NOINDEX__ or neither (and so
have the default behaviour).

Bug: 57167
Change-Id: I30d483b5b6c3df7ee56a52c744bbdc610a01873d
2014-02-19 17:48:03 -08:00
Roan Kattouw caa03f1a50 Deal with ./ prefixes etc. in MWRedirectMetaItem
Done as a hack by just calling into the MWInternalLinkAnnotation code
which understands all of this stuff already.

Bug: 61570
Change-Id: If5962e1616087064f319a50a2c466724f6925d52
2014-02-19 17:33:37 -08:00
James D. Forrester 5af9f61520 Let users set #REDIRECT and __STATICREDIRECT__ status
Adds setting and unsetting the #REDIRECT status of the page from the page
settings pane of the meta dialog, and toggle whether this is a static
redirect (i.e., it is not automatically changed when its target is moved).

If the page has a redirect set, the meta dialog will be shown on opening
the page so that users can adjust the redirect more swiftly.

Bug: 47328
Bug: 50878
Bug: 57173
Change-Id: Ibd89cf04486799f292b9fd045dae5bc23fcf6fd4
2014-02-12 15:24:12 -08:00
Ed Sanders fb1e746832 Include fragments in normalizedTitle
Otherwise they will compare as identical to non-fragmented links, and
the link inspector won't bother creating a replace transaction.

Bug: 53219
Change-Id: Ifb7c9ffc1e952817df524fcf2418e07299a7bda5
2014-02-12 10:29:45 -08:00
jenkins-bot 01e8dac42b Merge "Fix-up offset when transplanting transclusion parts" 2014-02-07 23:23:54 +00:00
Trevor Parscal ace27b159b Fix-up offset when transplanting transclusion parts
Symptoms:
* When adding a transclusion part that already exists, if the item is
  being moved to the right it will inserted at a position one place too
  far

Diagnoses:
* When an index is provided with an item in a queue given to
  TransclusionModel's process method, the part is automatically removed,
  but the index, if given, is never adjusted accordingly

Prognosis:
* Cautiously optimistic

Treatment:
* Decrement the insertion index, if given and after the existing index

Change-Id: If321df8f63dae07c76663e76e14864e2f4518920
2014-02-07 15:21:35 -08:00
jenkins-bot fd6fb32db2 Merge "Auto-select first auto-added required param and fix param order" 2014-02-07 23:21:00 +00:00
Roan Kattouw 2598fe8088 Use apiRequest() function in MWMediaEditDialog
Change-Id: I4fbc3f2080660b217beb502c6cf3007197627a14
2014-02-06 22:37:04 +00:00
Trevor Parscal d487b44dd0 Auto-select first auto-added required param and fix param order
Symptoms:
* When adding a template with required parameters, the last parameter
  is initially focused
* Parameters and parts appear out of order, and adding/remove/moving
  them shows them in almost random placement

Diagnoses:
* Parameters are auto-focused when added, and parameters are auto-added
  in forward order
* TransclusionModel's process method had a bug in which the code to
  derive an offset from the item being removed would not be reachable
  due to an inverted logic statement

Prognosis:
* Fatal, with a 10% chance of survival

Treatment:
* Set focus on the first parameter after auto-adding required
  parameters to a template
* Invert the logic in TransclusionModel's process method, so that if
  the index IS undefined we will proceed to define it

Change-Id: I299053b63045ec933747831f1b4aa63493760f8b
2014-02-06 13:21:14 -08:00
jenkins-bot 78680bb527 Merge "Adding alternate text to media edit dialog" 2014-02-06 02:59:21 +00:00
jenkins-bot 20d6df9a65 Merge "Only generate transclusion contents for clipboard" 2014-02-05 23:02:28 +00:00
Moriel Schottlender e8205a7133 Adding alternate text to media edit dialog
Adding an option to add or edit alt text to images in the media edit
dialog.

Bug: 38129
Change-Id: I6d339781822175c40c66a4689ec6e1a873cb081d
2014-02-05 20:56:30 +00:00
Ed Sanders 61d010df2f Move image info API call to media node
As other widgets may be interested in the image info, this should
be part of the DM node, which the media edit dialog then fetches
and uses to populate the MediaSizeWidget.

Other fixes:
* Remove spinner, not really necessary as the orignal size button is
  disabled if the orignal dimensions aren't set.
* Don't wait until image info call to resolve to initialise size
  widget values. These should always be available instantly from the
  attributes.

Depends on I9530ed4257e88b in core.

Change-Id: I394f49941b621059bc08c8a8f79471b2fe16c7d8
2014-02-05 12:48:31 -08:00
Ed Sanders 13eb918087 Only generate transclusion contents for clipboard
Parsoid doesn't care about the transclusion contents and it can
cause bugs if not removed properly. Remove the about group attribute
as that was for Parsoid's benefit.

Depends on Ib29972472d in core.

Bug: 60897
Change-Id: I907b2113c257baff5c022ff0749dca9dbb1fba5f
2014-02-05 12:45:55 -08:00
Ed Sanders bdb4a8a149 Simplify toDataElement in MW
As per I54943588c5cc2 in core.

Change-Id: Ia40e7327c4ce07a79d64a6d5b1ff0d7acec55171
2014-01-27 18:43:36 -08:00
Roan Kattouw 4aeb773404 Add tagName to ve.dm.MWGalleryNode
I told James this wasn't needed, but I was wrong. It is null in
the parent class, and DOM throws on document.createElement(null).

Bug: 60307
Change-Id: Iff8fda9acf9f37e537d7d6cf6106a801d6b71338
2014-01-27 14:28:16 -08:00
jenkins-bot 319fa24061 Merge "ve.dm.MWTransclusionModel: Clean up and fix logic error" 2014-01-23 03:00:55 +00:00
Timo Tijhof 7316c6ba3b ve.dm.MWTransclusionModel: Clean up and fix logic error
* Reduce duplication by calling #removePart (equal, line by line)
* Reset `remove` at the start of each iteration, it was leaking
  through to future iterations.
* Minor simplification in property access.

Change-Id: Ie0a83d582804bc50131ca5a8da36b0605dd4a6c3
2014-01-23 02:58:23 +00:00