As part of this, put the 'help' icon next to the beta icon, make the
text not greyed-out (now that it's an actual action) and provide the
link.
On hover, all three items get underlined, which is irritating, however.
Bug: 50476
Change-Id: Id65968072b7134f5864bbd96acf34fd0c23fe17c
* 'captcha' property from ConfirmEdit API is already exposed
in ApiEdit and ApiVisualEditor through the 'edit' property
in our response data.
* Add parameters 'captchaid' and 'captchaword' to ApiVisualEditor
and mw.ViewPageTarget#getSaveOptions. ApiVisualEditor will
forward these to ApiEdit which forwards them to FancyCaptcha.
* We display the captcha through a saveDialog warning.
Bug: 50356
Change-Id: Ia7d2102cba89d00ec8508e846061023b330ece4f
We need this for captcha's. They'll be added and displayed as
a warning, and cleared like all others. But they shouldn't be
wrapped in a paragraph and aren't delivered as html text but
as a jQuery object (can't serialise to static html since we'll
have to keep a reference to the TextInputWidget and what not).
Change-Id: I3734fbd3c6f0270094db014bbc76d065a73ab918
The sanity check converts the linear model back to DOM, then
compares this DOM to the original DOM and rejects the deferred
if they are not equal.
The DOM creation has to be done synchronously (before we unlock
the surface), but the actual comparsion can be (and is) done
asynchronously.
To make the UI flow of the save dialog easier we just keep the
save button on the toolbar itself disabled until the sanity
check is done. Though this should finish before the user starts
editing the document (let alone start saving), we do add a class
to the button to indicate a progress cursor.
To simulate a slow sanity check, set the setTimeout in
startSanityCheck to 5000, load VE, make a change, hover the
button, and see it change from disabled + progress-cursor to
enabled after 5 seconds.
To simulate the sanity check failing, change !== to === in
the first "if" in startSanityCheck.
Bug: 47521
Bug: 50067
Change-Id: I04f71fe8e00c6257fbc953cc9de3323e24709b0f
Objectives:
* Split reference dialog (at least for now) an edit and an insert dialog
* Add reference search widget for selecting an existing source, or
choosing to add a new one
* Abstract reference names, don't allow editing them and generate them
when needed
* When editing groups, move the internal item and update all references
to it
* Resolve name conflicts when moving a reference to a new group by
generating a new list key
Bonus:
* Add getNodeGroups method to internal list
* Add getUniqueListKey method to internal list
* Add destroy functionality to ce.node to release events and references
Bug: 49733
Change-Id: Ib244ff6ad9b4cee1decfd9b9e1d3d4e9cdcfb78c
When you selected the "edit" link by tabbing, the links would expand.
In Chrome, you could then tab to the "edit source" link, but in Firefox,
the links would just contract back and you couldn't reach "edit source".
This happened because in Chrome, the "edit source" link is already
considered to be focused when the blur event happens on the "edit" link.
But in Firefox, this is not the case: the blur fires first, and only
after that does Firefox determine what to focus next.
Fixed by waiting 100ms to contract after blur, just like we do on
mouseleave.
Change-Id: I9a38b629ca5e580003d82a3dca8dbf7564486fa0
Objective:
* Make the escape key close dialogs, like pressing the X button
* Auto-focus the iframe on window open
Bonus:
* Add ESCAPE and SHIFT to ve.Keys and use instead of hardcoding numbers
* Use ve.Keys in some other places too
Bug: 49809
Change-Id: Ibf1fce5e24efcd83d9e1465c3cdaac24ff3fb45d
The save dialog has z-index: 3;, which succeeds in overlaying it on the
toolbar in its normal position, but fails once the toolbar starts
floating, because the floating toolbar has z-index: 100;
In practice this meant that if you were scrolled down and the toolbar
was floating, you could open the save dialog just fine, but you
couldn't close it because its controls were below rather than on top of
the toolbar.
Hacked around this by detecting the floating-ness in the toolbarPosition
handler and setting a class on the toolbar tracker accordingly.
There may be a more elegant way to fix this; an actual UI engineer
should figure that out, not me :)
Bug: 50324
Change-Id: I8c6ab1026705d00baa20f115255d0d7e74ee72bf
Follows-up I4b9c47fd65a700a:
* Remove unused closingBracketSymbol.
* Moving veSectionEditUri and sectionEditUri inline as it is
only used once. This will allow it to be easily dereferenced
(instead of likely staying in memory due to being claimed by
remaining closures "expand" and "expandSoon" which will
continue to claim and enjoy access to this scope.
Also changed it to use the attr() callback so that we
don't access `$editLink.attr( 'href' )` twice.
* Add various comments explaining this non-obvious approach.
Though it makes sense (eventually) and more elaborate details
are in the original commitmsg, that is no excuse for a 100 line
function without a single comment, especially with all these
things going on.
* Use "shrink" instead of "contract" (seems more common in
context of web UI elements and less ambgiuous in English).
* Remove redundant toString in `new mw.Uri( veEditUri )`.
Aside from redundant, it also had more overhead (serialising
uri object to string and re-parsing). It revoked its ability
to make an efficient clone by taking the mw.Uri object as input
as opposed to having to parse it again. mw.Uri#clone does the
same internally.
* Avoid variable names like $this, that or self. Using a more
descriptive name instead.
* Re-use $closingBracket instead of using last() 3 times which
makes 3 clones of the jQuery object with the same last element
in it.
* Refactor odd swapping of closingBracket-hide and
middleBracket-clone-show.
It now keeps the original opening/edit/closing in tact and adds
devider/hidden/edit-source/outerClosing at the end.
Change-Id: I5f093f2927b769fed0c6d1a40f99e73f9b653b9a
Objective:
* Provide quick access to section edit links for both source and visual
editing
Story:
After using this prototype of my mockup, I realized how bad my mockup
was. Hooray for prototyping!
The issues were twofold:
1. Adding down-arrows to the edit links made the page look worse, and
was sure to incite rage and panic throughout the community.
2. The menu was just too heavy. Matmarex made an observation early on
after seeing it, that it wasn't very "Vector", and while I agreed, at
the time I didn't have any better ideas.
Thank you to Matma Rex for prototyping this feature. Aparently there was
also a previous attempt (I13bbb9549). We appreciate your help.
The new design is simple.
* Section edit links look normal
* On hover or focus, the edit source link also appears next to it
To make the two links look separate, we needed a divider. To make the
divider look good we needed to add space around it. To balance the
space, we needed to add space to the brackets. To avoid changing the
view, we needed to only add space to the brackets on hover. To avoid
the text moving around, we needed to make the brackets move away from
the text, rather than the text move away from the brackets. To make
this change smooth, we needed to use transitions. To make the links not
force the heading to wrap in one state but not the other, we needed to
reserve the space, using visibility rather than display. To reserve the
space we had to use closing brackets as spacers, hiding/showing one of
them on mouse enter/leave and leaving the other always hidden. To avoid
the right bracket from getting clipped by the edge of the screen when in
expanded mode, we needed to add a bit of padding to the right side of the
section edit link top level span. To prevent the extra links from
flashing as you move your mouse down the page, we needed to wait 100ms
before showing or hiding them due to mouse enter/leave.
We use negative margins to move the brackets. Animation implemented
using CSS transitions. We bring the pipe divider in from the core
'pipe-separator' message.
To style the brackets independently we needed to wrap them in spans and
add classes to them. Change Id27555c6 in core will make the wrapping
unnecessary, but the two should still get along just fine.
Interestingly, we needed to @noflip the bracket styles because CSS
Janus flipping is triggered on UI language, but the brackets need to be
styled according to the content language.
Changes:
ve.init.mw.ViewPageTarget.css
* Add styles for extra section edit link components
ve.init.mw.ViewPageTarget.js
* Add edit source link, and make it visible when the mouse is over the
heading or either section edit link is focused
*.php
* Links to new messages
Bug: 48429
Change-Id: I4b9c47fd65a700a81c880144247fec524edff7e5
Also checks for subheadings, i.e. we keep moving forward one sibling
as long as the next sibling is a heading of higher order than the
previous one. If the heading is of the same or lower order then we
assume there is an empty section, so we just stop.
Bug: 49563
Change-Id: I6fcc463aeeae40278f5caf04ae251c8ecfe65472
Fixes (follows-up I1b48ef5240, I6daff5c596):
* Invalid html passed to jQuery constructor.
* Use prop() instead of attr() for boolean values.
* Use append() instead of html() when appending nodes instead
of parsing html.
* Rename shadowed variable name clash 'mw' to 'mwData'.
* Fix odd construction where we parse '{}' to create an empty
object.
* Have ve.ce.MWReferenceListNode#update perform changes off-document
in a detached tree.
* Fix deep property access that can fail. mwData is set to
either JSON parse of data-mw attr or empty object.
Accessing mwData.attrs.group needs to be guarded by whether
mw.attrs is indeed set.
* Have `mw` and `about` attribtue in references list roundtrip
(especially mw which can data we aren't editing/re-creating).
* Add missing 'refGroup' property to MWReferenceListNode's
data element (similar to what MWReferenceNode already has).
Change-Id: I67e4f378ccd04e97361d8e58ae57db5353075756
jQuery's implementation does some sort of traversal, so on large pages
it took 300-400ms just to focus the document node.
Change-Id: I0de95d8800a1aedeb19b27d204dfd8fd08cec533
In aaa5ad2 we introduced a feature test. However though we do require
ES5, we don't (yet) use strict mode. It is an easy and solid one to
feature test, but it the unfortunate reality is that IE9 does not fully
support ES5. Strict mode is among the features it didn't (correctly)
implement. As a result commit aaa5ad2 locked out IE9 completely.
Replacing it with a more explicit (and harder to maintain) test that
does pass in IE9. We now need to be very careful about using ES5
features in our code. It has to be in this list here to avoid breaking
in a browser that doesn't support it.
Change-Id: I77b623e15a0791bfaa2cd835e43107cefb3c25f5
It's been replaced with 'mw-editsection' and all cached renders on
Wikimedia wikis have expired by now. All backwards-compatibility
occurences have been removed from MediaWiki core already.
Change-Id: Id3731222445b588de8aec0e86892879ac4472636
By default, EventLogging uses INT columns for integers, which pageViewSessionId
overflows. I changed it to a STRING type in the schema and am now generating it
using 'mw.user.generateRandomSessionId()'. I also introduced a 'userId'
property, per bug 49585.
Bug: 49585
Bug: 49586
Change-Id: Iddb9eb9c64b55b25445ddf9e474d312b685978a6
This change adds a '$wgVisualEditorEnableEventLogging' configuration
variable, accessible client-side as
'wgVisualEditorConfig.enableEventLogging'.
When true, the 'schema.Edit' ResourceLoader module will be loaded on the
page, and calls to ViewPageTarget.logEvent will forward to
mw.eventLog#logEvent.
When false, the module is not loaded, and ViewPageTarget.logEvent is a
no-op.
The change also adds a few calls to ViewPageTarget.logEvent to log certain
editor actions, documented in https://meta.wikimedia.org/wiki/Schema:Edit.
Change-Id: Iccd171d7cde15b0302d1b4c292bcbcc2a4b337ef
Objective:
* Allow opening reference dialog with arbitrary selection
* Auto-insert reference when selection is not a reference node
Changes:
ve.init.mw.ViewPageTarget.js
* Added reference button to toolbar
ve.init.Target.js
* Add getToolbarSubset so we can exclude the reference button from
the toolbar in the reference dialog (nested references are not
allowed).
ve.ui.MWReferenceDialog.js
* Stop storing referenceNode (not needed)
* Only store internalItem on open if there's a focused node that's a
reference
* Use wrapper paragraph when creating a new reference
* Create new reference on dialog close if required
ve.dm.InternalList.js
* Major rewrite to support key less references.
* Add new method for creating a transaction to insert a new iternal
item. Also returns the index of the new item to be passed to the
reference node.
Change-Id: I839ae165c299248484ce93d4ab087318a95fbb94
Introduction of fake selection for single focused nodes. This
change specifically makes the selection much nicer in appearance
for Chrome users selecting floated FocusableNodes (block images)
for example.
Added ve-ce-surface-highlights DOM element to contain styled
highlight elements.
Made adjustments to getSelectionRect to return fake selection
bounds if necessary.
Replaced old uses of showSelection with model.change().
Change-Id: I96e66567cdce6455ef3eb77568e72f23140448ff
Removed the "report" slide from the mw.ViewPageTarget save
dialog and everything that becomes obsolete as a result of it:
* JS saveDialogReviewWrongButton, which pointed to the report
slide (was already hidden as of I90de95f6337ee).
* JS ve.init.mw.Target#reportProblem.
* JS ve.init.mw.ViewPageTarget#diffHtml.
* JS ve.dm.ElementLinearData#getUsedStoreValues.
* PHP mw.config wgVisualEditorConfig.reportProblemURL.
* PHP $wgVisualEditorParsoidProblemReportURL.
* I18N visualeditor-savedialog-title-report.
* I18N visualeditor-savedialog-label-review-wrong
Change-Id: I8a5e0ab2060d7c14086bba413d4c7d73b29c9b97
Summary:
Instead of having a button "Review and save" that opens with a
diff and leads the user to the "Report a bug" and "Save page"
slides respectively, make it more like the default EditPage.
There is now a "Save page" button that opens with the save
form with a button to "Review changes" (diff) or "Save page".
The "Report a bug" slide has been unlinked from the UI and is
no longer accessible for now.
As a result of the UI no longer requesting a diff upfront this
also means we will no longer detect "nochanges" event (when it
turns out the submittted revision matches the latest version).
This is unfortunate as it was a nice feature to detect it
before the user spends time writing the edit summary) but it
is the same as how the default EditPage works.
Changes:
Improved interface messages.
Adapted "nochanges" caption to the new context (it is no
longer shown when clicking "Save page", it is now shown as a
result of clicking "Show changes").
Now that the "save" slide is accessible from multiple paths
it is needed to keep track of slide changes in a history
array. Previously the slide tree was 1 level deep with
everything descending from "review". Now it starts at "save"
and can go in multiple directions including a loop from
save>review>save. We also need to toggle the "Prev" button
based on history instead of based on whether or not we are
on the "first" slide.
Hid the "saveDialogReviewWrongButton" from the review slide.
We're approaching wider launches and this will not scale to
a wider audience.
Bug: 49258
Change-Id: I90de95f6337eeddd794b75d56543d8d152421a6f
Objective:
* Allow inserting images from local wiki and commons
Changes:
ve.init.mw.ViewPageTarget.js
* Add media insert button to toolbar
ve.init.mw.Platform.js
* Add getMediaSources method - defaults to local wiki and commons
ve.ui.MWMediaInsertDialog.js
* New dialog for inserting media
* Uses a media select widget and inserts block images
ve.ui.Dialog.css
* Added styling for media select widget in media insert dialog
ve.ui.Widget.css
* Added styles for media select widget and media select item widget
ve.ui.MWMediaInsertButtonTool.js
* New tool for inserting media
ve.ui.MediaSelectItemWidget.js
* New item widget for media select widgets
ve.ui.MediaSelectWidget.js
* New widget for searching for and selecting media items
ve.ui.TextInputWidget.js
* Added isPending method
VisualEditor.i18n.php
* New messages for media insert dialog
VisualEditor.php
* Added links to new files and messages
PhantomJS--
Change-Id: Ia803ff3ef518782ce76802d2dab7559686a1bb0a
This is mainly used for testing blacklisted browsers, so we just need
one parameter ('vewhitelist') which sets whitelist to true and
blacklist to false.
Change-Id: I38771ba7a49657d67c4d94ace1f30b5e41904df6