Ed & Roan:
Disable editing of references of which we are unable to find the
source (e.g. <ref name="x"> without a target, or when the target is
currently nested in something we don't yet process such as inside a
<references> block or a template).
Timo:
Improve UI to not be a regular focusable node where the inspector just
won't show up but add a not-allowed cursor and explanatory tooltip.
James:
Fix messages to refer to VisualEditor instead of "the" VisualEditor.
Change-Id: Ib2bca092ce13c9187fa8b27ad6a6404cae02aea2
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
Objectives:
* Make protected CE nodes only add shields when attached to a surface
* Remove hack in reference list node used to work around this issue
Change-Id: I48d4478558b49037b80b6131e1b2e01dc4f9ec47
* Port the class preservation logic from BlockImage to InlineImage
* Add preservation for unrecognized classes
* Add the logic for collapsing spaces in the class attribute in more
places
Change-Id: I26faad7e00ab2f0a0f5d076552e56b32c692ae74
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
After a spirited discussion, localOverlay is getting some children.
* localOverlayBlockers - UI elements that are meant to prevent
interaction with the element. This includes Phantoms and
Highlights.
*localOverlayControls - UI elements that are meant to be
interacted with in order to modify the element. This includes
resize handles and drag marker.
*localOverlayMenus - UI elements that should always position
above all other controls. This includes the context menu.
Bug: 50159
Change-Id: Ic69c2ad275389a31c9fbaf47f3665dcdbb7ac2af
Objectives:
* Make options unable to be selected or highlighted when disabled
* Add default styles for selected state
* Fix line-height for option labels
* Use default cursor when field is disabled
Change-Id: I8a535cd6b259b092c2abce27ddb10882cdde6cf5
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
Omitting the offset causes insertMeta() to automatically use the
end offset, so we don't need to compute it in two places. The two
computations were also slightly different.
Change-Id: I55543fdd113a6a986899c093733191df948acb2e
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
This ensures that attributes and properties that are supposed to be
stripped on copypaste are actually stripped.
Bug: 49307
Change-Id: I8c90f4a0b33acba6eea3180cc077f8dc440e6e7b
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
We need to normalise titles so 'user:foo_bar' == 'User:Foo bar', and
we also need to some HTML attribute removal as links from Parsoid
will have href and rel set (again, this should be fixed in by Parsoid
when the do the merging at their end).
Bug: 49985
Change-Id: I5fb5bfc69c344ca4ce4803d7b6116074648a8d7e
They are only run in the MW test runner, where the MW dependencies
are available. Create a ve.test namespace for storing shared
test runners.
Change-Id: I079cb18b1c73614d25a12c5d6afcf0700469e52e
Objectives:
* Associate models with tools, rather than dialogs and inspectors
* Move tool/model association utilities to ve.ui.ToolFactory
* Obliterate the view registry
Notes:
The only special case for leaving modelClasses definitions in place is
for the linkInspector. It uses these for selection expansion.
Because tools can now override the static canEditModel method, we can
dynamically evaluate a model, rather than be restricted to only
comparing classes. This will be useful for disabling editors for models
that are for some reason incomplete or otherwise broken and cannot be
safely edited.
Change-Id: I7adf254990112d90f1f808593a9111afc7a116b5
Because of the z-indexes of major elements of the mono book
skin, and because the overlay containers are appended to the
body, the overlays can't be positioned between the surface and
the toolbar. Before this fix, the overlays are appearing beneath
the surface. This fix will retain proper positioning of the overlays
between the surface and the toolbar for Vector, and will overlay
everything in Monobook.
Later, we will have the overlay container more tightly integrated
with the surface to avoid this stacking problem.
Change-Id: Ibb1553099cc1e35e6a0928a99b584885508ca5b6
Convenient way to check if an object is an instance of one or more classes.
This should probably be moved to oo.js.
Change-Id: I2be55d9501cf62fde006281f1cf4813095b39b41
Re-label the headings in the MWFormatDropdownTool with MW-specific
headings per bug 43334, reduce the size of the dropdown's contents a
little to make the headings less vibrant, and move the H1 option to the
end of the list to further discourage its use.
Note that there are some issues with the underlying structure here and our
ability to split the repos into VE-core and VE-MW will need this to be
refactored.
Bug: 43334
Change-Id: I5a58b4dcebd6ceae0ffcd24f663429f25bdc3db9
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
Use the 'all' mode of SurfaceFragment#getAnnotations to correctly
handle the selections which include linked and non-linked text
in the LinkInspector.
Bug: 50208
Change-Id: I1cab7f3cc4fc9589eced01ad38c59fe5b9622a57
This bug caused all references containing complex content (e.g. links
or templates) to be dirty-DOMed and reformatted by Parsoid.
ve.dm.MWReferenceNode.js:
* Parse the original body.html and check if it's semantically equal to
the new value. If so, don't set it.
ve.dm.Converter.js:
* .normalize() the converter output to remove empty text nodes and
merge adjacent text nodes
ve.dm.example.js:
* Update reused reference test to have body.html absent, not empty
* Add a link to one of the reference tests so this bug is triggered
** The link's attributes are ordered specifically so that toDomElements
will reorder them, at least in Chrome (may behave differently in
other browsers)
** This test fails without this fix in place
Change-Id: Idc091a14422fbb117a3d06fc6bb9497768086fc3
When the toolbar animates, the position of the surface changes.
ProtectedNode now listens for the toolbarPosition event and
repositions the phantoms.
I also tried moving the localOverlay to be a sibling of the surface
(instead of child of body), but the same problems persisted.
Bug: 49853
Change-Id: I8ae1c8f66c6083b4ffee7107a78a298126e1064c
Local overlay z-index is positioning overlay items (phantoms, etc)
above the floated toolbar. The overlay container is a sibling to the
toolbar's parent and is later in the DOM. z-indexing is
unnecessary and has been removed.
Bug: 50096
Change-Id: Ib46f66b1d1bea36d761f793e9966e09db6e675ca
It was discovered that nested iframes inside firefox do not fire load
events: http://osdir.com/ml/dev-apps-firefox/2010-03/msg00134.html
Since we no longer care when the iframe is loaded, changing the frame
onLoad method name to load and manually calling it was sufficient.
Bug: 50115
Change-Id: I65c0c404a2a384566701b1c6b1bb978e0b99c90d
Broke reference insertion because it removed
newFromNodeReplacement(), which is still in use.
This reverts commit 1765e39b40
Change-Id: I043997715474ad4850329ff903eb7a8c61c8b453
HTML like <td><span>Foo<!--bar--></span></td> would lose the comment
when converting to linmod, and so we'd drop the comment when converting
back to HTML.
This happened because we were queueing up meta items to possibly move
them and their whitespace out of the wrapper paragraph even if we were
inside of an annotation and there was no way we could move things out
at all. The fix is simply to detect these case and not queue up meta
items in that case.
[12:11] marktraceur Let the comments hit the floor, let the comments hit the floor
[12:11] marktraceur (to the tune of the Drowning Pool "Let the Bodies Hit the Floor")
Bug: 50071
Change-Id: I5a844e2e0655bc1db152b3805718324ca0bb04df
We calculate an overlap offset for when the popup widget has been moved
to avoid going out of the viewport, but that offset is only applied to the
body and not the callout.
Change-Id: Ib9d08d60ccfa6562378640c526faf1e8363abbba
The UI still needs a simplified version of annotation comparison
so it can clear/set annotations, whereas for serailisation we need
to compare selected HTML attributes (and once Parsoid is fixed,
compare all attributes).
Change-Id: I1a5521a3f51ea373a21cfbc9a007a2381c12f4fe
This was a big gaping DOM diff that's been in there since the beginning,
but which we only found today.
Change-Id: Ie4e791b212ddd3210bc1d5c11308452bb57ae3ce
There is still a problem that those images would get inspector for opening media edit dialog
displayed, and that dialog let's edit caption, which does not make sense in this case, however
that should be a separated bug.
Change-Id: I24491979bc7a27d2380924e48cb677b01e9f8f9b