Commit graph

192 commits

Author SHA1 Message Date
Ed Sanders f4de32e56c Fix terrible Hiero CSS
Makes calculating shields much easier.

Change-Id: Icf61b4bf6df7f7cc4a9650e8da972eca369cadf2
2014-06-11 20:20:21 +01:00
Roan Kattouw 10cda9359a Update VE core submodule to master (fc52878)
Remove RelocatableNode mixins for new FocusableNode.

New changes:
fc52878 [BREAKING CHANGE] Merge RelocatableNode into FocusableNode

Change-Id: Id8ce497b0fd1ff7732f68aa1ae8af4f4f8f9db0f
2014-06-11 11:14:46 -07:00
Ed Sanders ab2af54ff9 Set traditional galleries to inline-block to get correct width
Prevents over-sized shields.

Functionally (but not logically) dependent on I8a532b20 in core.

Change-Id: I12a1a76a6dbef9b365035ad8c577243a3420b967
2014-06-11 14:31:27 +01:00
Roan Kattouw 310601ef47 Update VE core submodule to master (e1b0e33)
Remove ProtectedNode mixins for new FocusableNode.

New changes:
e1b0e33 [BREAKING CHANGE] Merge ProtectedNode into FocusableNode

Change-Id: Ie515704163c24317739fd34d35094b9ada6bfa66
2014-06-10 16:52:49 -07:00
James D. Forrester 9c4e874e1b Remove now-inherited auto-numbered link CSS styling
Transferred to MW core in Id765da7b.

Change-Id: I83b490bd3265429c97969c92249efc65aea31d01
2014-06-10 10:41:31 -07: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
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
Roan Kattouw 172ebb839e Remove link node inspector from insert menu
This inspector isn't designed for insertion mode yet; attempting to use
it in insertion mode causes nasty JS errors.

Bonus:
* Make its tool title "Simple link" rather than "Link", for when
  we do reintroduce it.
* Make double-clicking / pressing enter while selecting a link node
  open the link node inspector rather than the link annotation inspector.
* Make link nodes render with MW's external link arrow icon
* Move the link node inspector's messages to the right RL module

Bug: 66047
Change-Id: Ib94da7ed3a2a88297dbdd1529f20cd8dab7c8421
2014-06-02 21:05:07 +00:00
Roan Kattouw 9e9a671fc1 Make images look better, account for e82629895b38 in MW core
Prevent images from getting double borders due to slugs,
and prevent extraneous margins from piling up in captions.

Also add the ve-ce-mwBlockImageNode class which shockingly
wasn't being set (only ve-ce-mwBlockImageNode-TYPE was set).

Change-Id: I86b95aa0c0def92a9790b7cdb4b05837fb8f65e2
2014-05-28 18:35:07 -07:00
jenkins-bot c0f0f276af Merge "Decode URL encoding in resource attriute for images" 2014-05-28 21:04:41 +00: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 186238e90d Make sure <figure> has proper dimensions
This commit brings back the sizing of the <figure> in MWBlockImageNode.
The figure must have proper size in CE otherwise 'center' and 'none'
alignments don't work, and the <figure> stretches across the entire
width of the screen.

Bug: 65836
Change-Id: Iefed466fce87f265fbd08908f1171867f9d1e1fe
2014-05-27 21:44:58 -04:00
Moriel Schottlender 963e133851 Remove media item styling moved to MW-core in I400336c12d.
Change-Id: I348e55ddea94f3b67f647c66ba53f7384d683584
2014-05-22 12:34:00 -07:00
jenkins-bot 5798569c73 Merge "Image model and the media edit dialog" 2014-05-20 01:15:31 +00: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
Timo Tijhof 25d00cc777 build: Update jscs and jshint
jshint:
* Update to grunt-contrib-jshint v0.10.0 (jshint v2.5.0).
* Remove coding style options covered by jscs.
* Enable new option "freeze" (prohibits changing native prototypes).
  http://www.jshint.com/blog/new-in-jshint-oct-2013/#option-freeze
* Re-order to match http://www.jshint.com/docs/options/

jscs:
* Update to grunt-jscs-checker v0.4.4 (jscs v1.4.5).
* Format .jscsrc file in a more spacious way and order the
  properties less arbitrarily (using the jscs's readme order).
* Enforce more details of our coding style
* Get rid of the unsable "sticky" operator rules which have been
  deprecated in favour of using other rules instead that are able
  to enforce this more accurately.
  - disallowLeftStickedOperators: Remove deprecated rule.
    * Ternary covered by requireSpacesInConditionalExpression.
    * Rest covered by requireSpace{Before,After}BinaryOperators.

  - requireLeftStickedOperators: Remove deprecated rule.
     * Comma covered by disallowSpaceBeforeBinaryOperators.

  - requireRightStickedOperators: Remove deprecated rule.
    * Logical not (!) covered by disallowSpaceAfterPrefixUnaryOperators.

See also If46b94ce1, Ib731f11b1 and I0b0cadbc5 in oojs/core.

Also:
* Update grunt-contrib-watch to latest upstream version.
  Change log at https://github.com/gruntjs/grunt-contrib-watch/blob/v0.6.1/CHANGELOG#L1-L17

Change-Id: I6c5a34afea8b05a3dca617897c192594df06ca90
2014-05-15 16:52:34 +00:00
Trevor Parscal 74b4573caa Style external links and their suggestions with the right color
Bug: 38726
Change-Id: I0f017bda9e5d4f8358db6656751fe1f13a7b845c
2014-04-30 16:49:46 -07:00
James D. Forrester 0a37cfb915 Pull in Parsoid's new styling module
Also remove CSS hack from MWTransclusionNode now that
we have properly styled Parsoid references.

Bug: 63983
Change-Id: I5e8dc4c618809f6dd923fe4676d57acd1094f93d
2014-04-28 12:17:27 -07:00
Roan Kattouw 654d641c5f Update VE core submodule to master (33ca43b)
Reorganize stylesheets in VE-MW to match JS directory structures,
and update VisualEditor.php for similar reorganization in VE core.

New changes:
c6ed962 Reorganize stylesheets

Change-Id: I4f1070643744fb2ee6726cb03e012e31a9a05c64
2014-04-18 13:28:31 -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
Roan Kattouw cedca2490c Actually actually fix double-clicking on hieroglyphics nodes
Bug: 63651
Change-Id: Ib97d202b43e6910a3e223d14031c33a95ca7a251
2014-04-07 14:45:18 -07:00
jenkins-bot fc5b995ee9 Merge "Hack around Parsoid's href prefixing in rendering new links" 2014-03-26 22:56:02 +00: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
Roan Kattouw 7c8b0ef10b Hack around Parsoid's href prefixing in rendering new links
If we render new links with a plain target, then if you're on a
subpage like Foo/Bar, [[Baz]] will point to Foo/Baz. In order to
avoid this, we fake the link target to be ../Baz and resolve that,
which produces the correct result.

This hack is only needed until Parsoid stops producing ../-prefixed
links. This hack is only applied in view mode, because applying
it to our DOM output back to Parsoid would confuse Parsoid and
cause bugs.

Bug: 58314
Change-Id: Ifb4b63a26235a04e6362fc3e3e57d8773831eb38
2014-03-24 11:24:22 -07:00
James D. Forrester f8720326b0 Split out omnibus CSS files
Change-Id: I195a0e4091cf2d003c325e9c653dd634e7096779
2014-03-21 20:14:52 +00:00
jenkins-bot 0c8cb151fb Merge "Remove the math inspector code" 2014-03-20 05:34:31 +00:00
jenkins-bot 24c0082093 Merge "Display links to nonexistent pages as red" 2014-03-20 02:44:22 +00:00
Roan Kattouw 78a52f1f80 Display links to nonexistent pages as red
* Add ve.init.mw.LinkCache to track page existence and
  transparently query it
* Populate it with initial data from the parser cache
  if available, obtained in the VE API module
* Use linkCache data in link annotation rendering

This doesn't yet integrate the LinkCache with other
components like the link inspector. That should be
done so we can deduplicate the existence checks.

Additionally, we should generalize LinkCache and use
it for the category existence/status checks as well.

Bug: 37901
Change-Id: I9fd43e8c3864dd375cf6dadfdeedd05e4fe9cf3b
2014-03-20 02:42:33 +00: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
Rob Moen ec40953722 Mixin ClickableNode and add primary command names
Created ve.ui.MWCommandRegistery, added inspector and dialog commands

Change-Id: I6b45018bdb719e36a85a785d4e08d32ee4b9b0a3
2014-03-20 00:33:38 +00:00
jenkins-bot fbdc55dc78 Merge "Table of contents widget" 2014-03-14 22:31:10 +00:00
Rob Moen eba7d58dd1 Table of contents widget
TOC Widget is created in the mw target view class.
Adding and removing a heading rebuilds the TOC Widget based
on the the order of the page heading nodes.

TOC Widget considers TOC page settings and displays in the default manor
unless forced or disabled.

TOC Widget still needs to be finalized by being placed in the surface.
This could be a problem until we have a CE node for it to live in or
have some DM work added.  Roan and I have discussed how to go forward.

To enable the widget you must add the following to LocalSettings.php:
$wgVisualEditorEnableTocWidget = true;

Change-Id: I488cfbbdb060e50d81f51e0f757e67d0114b8936
2014-03-14 15:20:19 -07:00
Moriel Schottlender 2af27877bc Show/hide the magnify button on type change
Make sure the magnify button in the caption is properly shown or
hidden when image type changes. The magnify icon will always be
built, but will be shown and hidden using CSS rules.

Bug: 62139
Change-Id: Ib9a4569239ed70d16a153fb0823e283203fba1d4
2014-03-10 21:06:18 +00:00
Ed Sanders c15372f4e0 Use en-us spelling 'focused'
Per Ia3d37a4840b in core (not a dependency).

Change-Id: Ic19b3799c9b3af60f2de7a99f672a8aa389d1550
2014-03-06 16:30:05 +00: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
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
James D. Forrester c6bcc10d6c Split VE-MW's ve.ce.Node.css file into per-node files
Bug: 61075
Change-Id: I9bfa43e23c95a916ae082c33693f33492670445e
2014-02-20 13:44:03 -08:00
Roan Kattouw a7d5751c80 Move some non-skin-specific styles back into ve.ce.Node.css
Rules like "right-aligned images get float: right;" should
be in the generic image CSS, they're not skin-specific.

I haven't exactly teased apart what is and it's skin-specific,
this is just a first stab.

Change-Id: Ie374685d2c66e2275f7a98a590e563bf36da7f87
2014-02-20 00:12:48 +00:00
Trevor Parscal d52c15b48a Prevent clicks on top-most shield for centered image nodes
Even with the fix in VisualEditor core (I2c2c592) that prevents non-sheild
elements from being interacted with on generated content nodes, in the
case of a centered image, there is a shield placed on the wrapper which
causes the same problem. By hiding that particular shield, we can get the
desired effect, of only the actual figure being clickable.

Bug: 61001
Change-Id: I7fcf1a34c5ac67c3861cf0b8f3b2447d0d7dc1c1
2014-02-20 00:06:51 +00:00
kaldari 9f1179938c Move some skin styling from ve.ce.Node.css to a shared skin css file
The styling of the image thumbnails should be controlled at the
skin level, not by the generic VE styles. Moving the thumb/figure
styles from ve.ce.Node.css to ViewPageTarget-shared.css. Otherwise
no changes to the styles themselves.

Also adding minerva (the mobile skin) to the list of supported skins.

Bug: 60542
Change-Id: I67ab6d5b91cee7e587f61df26e7dae74c1068788
2014-02-19 13:30:30 -08:00
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
Ed Sanders 79f4755850 Resizable node live preview
Resizes the $resizable element as you drag.
Can be disabled by setting the 'outline' config option.

FocusableNode
* Redraw on resize

ProtectedNode
* Destroy and prevent creation of phantoms on resize

MWInlineImageNode
* Correctly pass this.$image to ResizableNode

Bug: 54298
Change-Id: I7d6d345af8bb4712bbf154072b4704943a5a620d
2013-10-16 14:25:00 +02:00
Roan Kattouw 1d7d19ff33 Remove ve.ce.Node.prototype.onAttributeChange
There was code in there once, but it's now empty. Removed it in favor
of adding explicit listeners in the handful of subclasses that
override it.

Change-Id: I160e55ad3c7d85c9f830a4bd7d42ec5dc18ad04f
2013-10-11 15:02:19 +00:00
Roan Kattouw 0c6dadb605 Remove .tagName from ce.MWInlineImageNode
Was unused, because this.$ is always overwritten in the constructor

Change-Id: I4d403f1b89351fb7d23131f944406d5a088fdeef
2013-10-11 15:09:21 +02:00
Ed Sanders a2b667c8f7 Make MWInlineImages resizable
Because they are.

Change-Id: Ib2ff3ac6e9c5ed896486c93c48697d232b892493
2013-10-10 13:35:59 +01:00
Ed Sanders 912e0b1aef Add specific message for empty ref group list
Currently we just say 'group ""' which is a bit weird, so
instead have a specific message which talks about the
'default group'.

Bug: 51873
Change-Id: I4a17f15ee18175fac11b36b102a06cc9714426ee
2013-10-02 14:01:37 -07:00
Roan Kattouw b8a0512237 Implement live preview in MWMathInspector
250ms after the user stops typing, we rerender the node with what they've
typed so far.

Bonus:
* When using MathJax, tell it which node to rerender
* Avoid crash when trying to unwrap wrapper paragraph

Change-Id: I623eef48e40d480cc98766cf7daf75dacd0bde19
2013-09-26 14:59:16 -07:00
Ed Sanders 515ad01713 Fix timing of rerender event in GC nodes
Move the triggering of the rerender event into an overridable method
'afterRender'. Some nodes don't have the correct dimensions
immediately after rendering their DOM elements as they may need
to wait for images to load, or for a script to run (e.g. MathJax)

Change-Id: If204f665dcb2fd69d00a183279056d11188ddd74
2013-09-26 21:39:39 +01:00
jenkins-bot 23dd5f9fb9 Merge "'Config' -> 'Configuration' in all comments" 2013-09-26 19:02:30 +00:00
jenkins-bot d01cd4cb0e Merge "Allow MWExtensionNode to render with arbitrary text/attributes" 2013-09-26 13:12:19 +00:00
Ed Sanders e6f48c5c93 'Config' -> 'Configuration' in all comments
Because the former isn't a real word.

Change-Id: Ie6ed15f9e390b357bbaa768b57f3c3fd7cf21181
2013-09-25 11:23:16 +01:00