Commit graph

102 commits

Author SHA1 Message Date
jenkins-bot 6907654de1 Merge "Add image type change to media edit dialog" 2014-02-08 00:45:49 +00:00
Moriel Schottlender 19c584d166 Add image type change to media edit dialog
Adding a type change to the media edit dialog. Also changing SelectWidgets
to ButtonSelectWidgets for consistency.

Bug: 38129
Change-Id: I9c855e6381d970b5f08460822366f6333af24f82
2014-02-07 16:41:50 -08:00
Timo Tijhof df8ab851cf ve.ce.MWResizableNode: Fix broken @extends documentation
* Fix broken @extends (doesn't take value in curly braces, was
  being parsed as literal text part of the class description).

Change-Id: I087df6df5e7b81314c90a79087e669c93032e80f
2014-02-06 23:08:15 +00:00
jenkins-bot 78680bb527 Merge "Adding alternate text to media edit dialog" 2014-02-06 02:59:21 +00:00
Ed Sanders d169108eeb Implement SVGMaxSize
wgSVGMaxSize sets the maximum size for the shortest edge of a
vector image. Pass this through to MWImageNodes.

Change-Id: I6410e7cda137cf4828d12280cb1e5cfc27805859
2014-02-06 00:59:25 +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 fb4f7d3e24 The great image scaling rewrite of 2014 (MW)
Implement new logic in ve.Scalable from I5b4f0f91b.

Also update VE core submodule to master (57ed8d3).

New changes:
59a0afe The great image scaling rewrite of 2014

Change-Id: I24a2976036310d3814cc7d1853a68745e0499bd5
2014-02-05 12:55:11 -08:00
Moriel Schottlender 8130acebfd Changing image size in MWMediaEditDialog
Adding the ability to edit image size in the media edit dialog.
The size is now a separate widget.

The following changes were made:
* The dialog was changed to a booklet with 'general settings' and
  'advanced settings', in preparation for other edit features.
* The original image maximum size is fetched from the API and cached.
* Maximum size is limited to the image's original maximum size.
* Aspect ratio is kept when changing height or width, using original
  image size to preserve a sane ratio through the MediaSizeWidget.
* If an error is found in the size, the image will retain its previously
  set dimensions.

Depends on MediaSizeWidget: I3d0f9348a52

Bug: 38129
Change-Id: I2946fb21c46ce05583b219f665ef68928188899e
2014-01-22 18:43:45 -08:00
Ed Sanders 6f37b4608c Only show non-anchored resize handles for MWBlock/InlineImages
For block images, show the bottom left/right anchor if the image
is right/left aligned, and both if it is centred.

For inline images, show the bottom right anchor unless the page is
RTL.

Change-Id: Icb5b74b954493257c517a5fbac5f0a0a457c544c
2014-01-16 02:41:48 +00:00
jenkins-bot adf8249688 Merge "Ultra-basic gallery editing" 2014-01-15 23:27:06 +00:00
James D. Forrester 842688c51b Ultra-basic gallery editing
'Cos Erik doesn't like things he can't edit.

Change-Id: I1d9fb1215bb16b1245eddd87c977fb5bfdee4da9
2014-01-15 15:13:12 -08:00
jenkins-bot 2284cb9aae Merge "Factor out AJAX defaults into ve.init.mw.Target.static.apiRequest()" 2014-01-15 10:37:43 +00:00
Roan Kattouw 97c4c6c71b Factor out AJAX defaults into ve.init.mw.Target.static.apiRequest()
Change-Id: I90b0858ccd657b7183ae5327903449d17d9f0bef
2014-01-13 11:45:30 -08:00
jenkins-bot cc84209767 Merge "Force CSSJanus to not flip image alignment classes" 2014-01-07 02:45:54 +00:00
jenkins-bot 6edb66229b Merge "Use $.parseHTML() to parse HTML in the transclusion preview" 2014-01-06 15:40:13 +00:00
jenkins-bot 24808c87a6 Merge "Don't send edit token in action=visualeditor requests" 2014-01-06 15:39:09 +00:00
James D. Forrester 0ffd654bed Bump copyright like it's 2014
Change-Id: Ic469ebda2c061dc7da0b4c1625f43a7be55da4fa
2014-01-05 20:06:50 +08:00
Roan Kattouw aede27fbd8 Use $.parseHTML() to parse HTML in the transclusion preview
This fixes the issue where parsing HTML that started with
a text node would cause that first text node to be dropped.

Change-Id: I71dafd69e12cab50e6644b4817f0fd6105657216
2014-01-05 13:52:55 +08:00
Roan Kattouw cec798558a Don't send edit token in action=visualeditor requests
This is not needed any more since action=visualeditoredit
was split out of action=visualeditor.

Change-Id: I3bdb9dff07e232be8f85827fe4276ca8f4956253
2014-01-05 13:52:27 +08:00
Moriel Schottlender f4531e8cd1 Force CSSJanus to not flip image alignment classes
For some reason, the class-wide /*@noflip*/ on mw-halign-left and
mw-halign-right didn't 'catch' and cssjanus ended up flipping the
float directions in RTL. This fix forces noflip condition on each
of the lines separately, which seems to work.

Bug: 50910
Change-Id: I4cddce80397d821dc3cbf40ee4b4c471890d8d35
2013-12-31 09:43:44 -05:00
Ed Sanders ae6f22910f Documentation fix in MWBlockImageNode
Change-Id: I8203474b8816197421ee18c5513b4c7235adb1da
2013-12-19 18:32:40 +00:00
Ed Sanders 76defa7ce2 MWBlockImage new DOM fixes
MWBlockImage
* Remove properties which just cache model properties. We can get
  fresh values from the model whenever needed and this just causes
  problems keeping them in sync.
* Tidy up DOM documentation indentation
* Merge setupCaption and setCaptionVisible into updateCaption. The
  caption's visibility can be calculated inside the method from
  model attributes.
* No need to generate figcaption on init, updateCaption  will do
  this for us
* Storing full view and model in this.caption is unnecessary,
  just store this.$caption (view.$element) and this.captionVisible
* Append the caption directly to the figure now there is no container
* Simplify setCaptionVisible
* Add in fix to account for border to figure width
* updateSize can get values from the model if they are not provided
* Remove unnecessary styles being set on this.$element.

MWImageCaption
* Generate as a figcaption instead of a div for direct attachment

MWImage
* Missing docs

CSS
* Cleanup reset styles, remove redundant add in required
* Fix margins for left/right floats to match .tleft/.tright
* Use more specific selector for inner border (thumbimage) to avoid
  matching shields.
* Remove unnecessary frameless styles, it has no border by default.

Change-Id: I52e0e10b465bb9761c2e4be28c98bec37b0dd2ca
2013-12-18 22:53:13 +00:00
jenkins-bot 46f5f29839 Merge "Move index label generation to the model" 2013-12-16 13:17:26 +00:00
Ed Sanders 8e3f77a9e7 JSCS fixes
Change-Id: I11032f05eaee1e8c895e06ebbc9c329cbc70c8c0
2013-12-14 00:04:12 +00:00
Ed Sanders 8ce7182045 Move index label generation to the model
Also make available as a static method so it can be used by the
converter. We will need this for generated HTML for the external
clipboard.

Change-Id: Ief843ac10cd6c6e4b25e09a007625d363792adff
2013-12-14 00:02:50 +00:00
Ed Sanders 5f78aa22f1 Check InternalList node exists when rendering MWReferenceList
If you've just pasted in a reference and a list the internal list
nodes may not have been rebuilt yet.

Bug: 58242
Change-Id: Ib10b81f4023194791f789f3e7dda393f2e355ea3
2013-12-12 23:02:10 +00:00
Moriel Schottlender e3308b0bd9 Direction adjustment to <figure> styling
Adding @noflip to align-left and align-right in the <figure> css styling
rules and removing the need to resize the Branch Node div element on center.

Change-Id: Iec6e589ba9ecdf32c1a0934b9eb05ee3fd42af66
2013-12-12 19:15:53 +00:00
Moriel Schottlender f1123f87f5 Render CE MWBlockImageNodes as styled <figure>s
This change is meant to transform the current block image node rendering
in ContentEditable from the nested <div> structure to a <figure> tag more
closely matching Parsoid's output, with CSS to style it the same. This is
mostly so we can work with and display attribute changes, like 'type' and
'alignment', without constantly destroying and rebuilding nested <div>
structures.

This change also includes all the attribute changes that will be called
when the media edit dialog changes image type, alignment, size, etc.

Node: The mw-classes 'thumb', 'thumbinner' and 'thumbcaption' are
preserved in the structure of the <figure> but CSS designers should note
these styles are no longer necessarily attached to <div> elements.

Bug: 53436
Change-Id: I40065acd9fd59d30f94b5336736d4986e8de15aa
2013-12-11 15:54:55 -08:00
Timo Tijhof cf7f2b141d Set up node-jscs, pass it, and configure in local Gruntfile
Let's experiment with this via our local Gruntfile. If it works
fine we can install it in Jenkins (similar to node-csslint).

Verify through $ npm install && npm test;

Fixed all outstanding violations.

Also:
* Added syntaxhighight to ignore.
* Added imetests (which contain unformatted JSON) to ignore.
* In ve.dm.ModelRegistry#matchTypeRegExps, removed redundant
  !! cast from the [+!!withFunc] statement which was hitting
  a bug in node-jscs. All callers to this local private function
  pass a literal boolean true/false so no need to cast it.
* Removed "/* key .. , value */" from ve.setProp, though this
  wasn't caught by node-jscs, found it when searching for " , ".
* Made npm.devDependencies fixed instead of using tilde-ranges.
  This too often leads to strange bugs or sudden changes. Fixed
  them at the version they were currently ranging to.

Bug: 54218
Change-Id: Ib2630806f3946874c8b01e58cf171df83a28da29
2013-12-06 10:37:27 -08:00
Timo Tijhof 31e6950af0 Fix csslint warnings
Also:
* Added modules/syntaxhighlight to csslintignore because
  it is broken right now, so it's hard to fix those warnings
  without being able to verify it.
* Fixed a typo in the grunt-watch config that accessed an
  inexistent property.

Change-Id: Ib81572506786b6a1203c454d1b2b91bb6ae2a3de
2013-12-03 23:09:56 +01:00
Ed Sanders 7982ecf2c3 Render MW extension node wikitext with XML
MW extensions are XML not HTML, so we shouldn't build them as XML
to prevent HTML specific rules being applied, such as <source>
always being self closing.

Bug: 54577
Change-Id: I84af4a29cd1c4ae4d1db4f70a4012a8ad0f98bf6
2013-12-01 17:13:39 +00:00
Roan Kattouw f4bb62b9d7 Also apply autonumbering CSS to links in generated content
We had CSS that applied to our rendering of autonumbered links,
but not for raw <a rel="mw:ExtLink"></a> tags appearing in
generated content like templates.

Bug: 57420
Change-Id: Ic1585ecb1a133d16b7393ce0ce38a11b76cc2239
2013-11-26 16:53:31 +00:00
Timo Tijhof 6feef815e2 ce.MWTransclusionNode: Don't pass token to parsefragment API
As of 46f40dc, we've split the VisualEditor API backend and the
part containing the parsefragment method no longer needs
an edit token.

This gets rid of the warning that started appearing after 46f40dc:

{
 "warnings":{"main":{"*":"Unrecognized parameter: 'token'"}},
 "visualeditor":{"result":"success","content":"<p>foo\n</p>"}
}

Change-Id: I36f79fa8ae48cdbec1b3506953418561ef2ff828
2013-11-11 20:33:26 +01:00
Trevor Parscal db9f941fa6 Rename this.$ to this.$element, and this.$$ to this.$
Objectives:
* Rename this.$ to this.$element
* Rename this.$$ to this.$
* Get rid of the need to use this.frame.$$
* Rename OO.ui.Element.get$$ to OO.ui.Element.getJQuery

Changes: (using Sublime Text regex patterns)
* Replace "get$$" with "getJQuery"
* Replace "\.(\$)([^\$a-zA-Z])" with ".$element$2"
* Replace "\.(\$\$)" with ".$"
* Replace "'$$'" with "'$'"
* Set this.$ to null in constructor of OO.ui.Window
* Set this.$ to this.frame.$ in initialize method of OO.ui.Window
* Replace "\.(frame.\$)([^\$a-zA-Z])" with ".\$$2"

Bonus:
* Use this.$() in a bunch of places where $() was erroneously used

Change-Id: If3d870124ab8d10f8223532cda95c2b2b075db94
2013-11-03 23:03:49 -08:00
Trevor Parscal a3295f0939 Allow direct opening of pages in the meta dialog
Objectives:

* Hamburger menu in actions area of toolbar
* Add tools that open specific pages in the meta dialog
* Fix support for using setPage in ve.ui.PagedOutlineLayout
* Allow passing setup config objects through window open calls
* Add dialog action, similar to inspector action
* Fix incorrect or missing documentation

Change-Id: I2d2c9b87554fb2a0c90ed6944a58b38a37efa712
2013-10-29 05:58:06 +00:00
jenkins-bot cc8010e556 Merge changes Ia6ca85bc,I919135eb,Ia18bd8fc,I49dfc81f,Ia234f174,I06425e2c,Ia192331b,I5624ae07
* changes:
  Get rid of dmRendering hack in ve.ce.MWInternalLinkAnnotation
  Render resolved URLs for href and src attributes in CE
  Give ce.Annotations a reference to their ce.ContentBranchNode
  Track the original HTMLDocument in ve.dm.Document
  Create CE nodes and annotations with the correct $$
  Add ve.resolveUrl for URL resolution
  Don't render href as src in MWBlockImageNode
  Rename 'html' to 'body' in converter tests
2013-10-28 18:55:11 +00:00
jenkins-bot 6bfa803fda Merge "Resolve rendered URLs according to the provided <base>" 2013-10-28 18:32:55 +00:00
jenkins-bot 4d688b6db5 Merge "Add a placeholder into an empty transclusion" 2013-10-28 17:42:16 +00:00
Roan Kattouw 5c04118c07 Get rid of dmRendering hack in ve.ce.MWInternalLinkAnnotation
Centralize href computation in getHref(). Because getHref() is provided
by the generic LinkAnnotation class, the subclass implementation is
now simpler.

Bug: 51487
Change-Id: Ia6ca85bc84b4f4453b572285836adb631e8d0683
2013-10-28 15:49:08 +00:00
Roan Kattouw 36061c7f5d Render resolved URLs for href and src attributes in CE
URLs are resolved according to the <base> URL from the Parsoid DOM.
For instance, a link can have its href set to '../Foo' in the DM, and
the target will show up as '../Foo' in the link inspector, but the CE
rendering will be <a href="http://localhost/Foo"> (assuming Parsoid sent
<base href="http://localhost/wiki/Bar">).

Bug: 48915
Change-Id: I919135eb758c82361525078f276ca193dc4c4820
2013-10-28 15:49:04 +00:00
Roan Kattouw 8e6bde2f56 Give ce.Annotations a reference to their ce.ContentBranchNode
This gives them a way to reach the dm.Document, which is needed
for ce.Annotations to do URL resolution.

Change-Id: Ia18bd8fc3510ad1b627644cd2c6ebcf148254e05
2013-10-28 15:48:59 +00:00
Roan Kattouw ec008a6464 Don't render href as src in MWBlockImageNode
<a src="..."> isn't a thing

Change-Id: Ia192331b88f17480f4285697e024bda25078968b
2013-10-28 15:48:39 +00:00
Roan Kattouw 74b8807df5 Resolve rendered URLs according to the provided <base>
This is done by using the computed property value rather than the
literal attribute value when rendering href and src attributes.
Helpfully, this provides perfect URL resolution natively in the browser,
which means the document's <base> is respected and all that good stuff.

For GeneratedContentNodes, we also need to find all DOM elements inside
the rendered DOM that have href or src attributes and resolve those.
This is done in the new getRenderedDomElements() function, which the
existing cleanup steps (remove <link>/<meta>/<style>, clone for
correct document) were moved into.

In order to make sure that the computed values are always computed
correctly, we need to make sure that in cases where HTML strings
in data-mw are parsed, they're parsed in the context of the correct
document so the correct <base> is applied.

We still need to solve this problem for models that actually store and
edit an href or src as an attribute. I'll post more about that on
bug 48915.

Bug: 48915
Change-Id: Iaccb9e3fc05cd151a0f5e632c8d3bd3568735309
2013-10-28 15:16:05 +00:00
Timo Tijhof 7db65f386c Rename @emits to @fires so we're forward compatible with JSDuck 5
Instead of using @emits in both, use our custom @fires in
production (JSDuck 4), and in the future it'll just naturally
use the native one.

This way we can also index oojs without issues, which seems to
have started using @fires already.

Change-Id: I7c3b56dd112626d57fa87ab995d205fb782a0149
2013-10-22 19:11:16 +00:00
Roan Kattouw d3c706ff93 Add a node type for numbered external links
Since I0f0a826c in Parsoid, numbered external links are now empty
<a rel="mw:ExtLink"></a> tags. This means we have to put in a node type
for them to prevent them from being considered empty annotations and
getting converted to alienMeta.

MWNumberedExternalLinkNode is protected and focusable to avoid making
the link text (which isn't editable) clickable. It isn't inspectable
yet, we need to work on that.

Bug: 53505
Change-Id: I83f69695f3974089e51a84e799f31ab6ed879e05
2013-10-18 22:31:45 +02:00
Trevor Parscal efafed3231 Remove ve.{inheritClass,mixinClass} and use OO instead
Change-Id: I8df9226a358a76b661eab6e967ff0d63d361f691
2013-10-18 18:58:08 +02:00
Roan Kattouw d3cd404877 Use .done()/.fail() instead of 'success'/'error'
'success' and 'error' are deprecated.

Also make all generateContents() promises abortable.

Change-Id: I8f95e9386f7749e635ce3715389896a0ccdb7523
2013-10-17 14:03:37 +02:00
Roan Kattouw 7035c8de01 Followup 8a4058584: use a single media source for rerendering images
The code asked all media sources for a rerender and used whichever one
came in first, which meant that it might potentially render the wrong
image, or reject the promise if one source served an error response
before a good response from another source arrived.

Also reject the promise if we can't find an image source in the response.

Change-Id: I6b516ad41b8a9e2abd440625bb76f3e1abb54520
2013-10-17 14:02:51 +02:00
Moriel Schottlender 81ca18ecc8 Add a placeholder into an empty transclusion
If a template was setup without a default output and returns an empty result
to the transclusion, the user could not access the template dialog because
there was nowhere to hover over to get it visible. This commit checks the
output from the template after it was rendered with the given parameters
and if it returns empty, it adds a placeholder to the output so to give
the users way to access that template's transclusion dialog and edit
or remove it.

Bug: 55810
Change-Id: Ib842b401e74d79b6382cada6bb7c6048b713977c
2013-10-16 16:33:08 -07:00
Ed Sanders 8a40585847 Re-render images after resize
Using the MW APIs get a resized version of the image and use
GeneratedContentNode to cache the url.

Bug: 55697
Change-Id: I418f7e1464663f447d46de7ffc29aa5f52d23b12
2013-10-16 16:38:31 +01:00