Restructure SurfaceObserver methods so that the method calls are more precise.
modules/ve/ce/ve.ce.SurfaceObserver.js
* Move timing code into startTimerLoop / stopTimerLoop / timerLoop
* Move poll logic into pollOnce
modules/ve/ce/ve.ce.Surface.js
modules/ve/ui/ve.ui.Surface.js
* Change all surfaceObserver calls to use new API
Change-Id: I0085e4a53c5a776733dce6944b867b8d2228ba4b
Firefox:
* Doesn't fire events without a selection, so when all we have is a
focusable node, create a dummy selection in the paste target so the
browser triggers an event on command+C.
Clipboard keys:
* Instead of just creating a text hash which may or may not match up
with the plain text in the clipboard data, just convert the clipboard
store into an array and use the index as the key. Also prepend a
random number (clipboardId) so on paste we can verify the copy came
from the same CE document.
The text hash is now used for validation if only HTML is written
to the clipboard.
HTML:
* Instead letting the browser grab CE HTML, always get DM HTML from
the converter as it is cleaner (no phantoms, linefeed markers, extra
class names etc.), and will make cross-ve-instance pasting easier
in the future.
Clipboard overriding:
* Always override the clipboard with the above HTML, either using
clipboardData.setData if it is available (webkit) or by throwing
the HTML into the pasteTarget and selecting it during pre-copy.
Bug: 53375
Bug: 49396
Bug: 52096
Change-Id: Id0f39c10818047bb4b8922e97cead153a770757f
Otherwise, changes to deeply nested structures like template blobs or
references will leak from the data model into the clipboard data.
Change-Id: I85d8d311f676d45856f30b3747e7383c70c95460
Also always use strings 'true'/'false' for the value, because
it is a string property (spellcheck, however, is a boolean)
and always use a capital second 'E' in the name.
Change-Id: Ia4e1f9edfd8f236fe81df190e6a68729d7b52243
Bug fix for browsers which don't have an event.clipboardData
property. The check is done correctly in onCopy but not onPaste.
Change-Id: I3cdf4c0358aa145dcb70c2c103d08a0002001fd4
This functionality was (accidentally?) removed by I8f8a240a. It
stops us from over-zealously balancing data when we can get away
with just pasting the original selected range (e.g. it always wraps
collections of text and content nodes in another paragraph).
Bug: 53364
Change-Id: I93fa56c4e43083993c310e0050087e9d1de1e08b
modules/ve/ce/ve.ce.Surface.js
* Schedule the post-keypress async handler in a way that can be cancelled.
* Cancel it and run the handler immediately if another key event happens.
Bug: 53079
Change-Id: If139ff3230c10caa616743f71659c4606d290310
If only a FocusableNode is selected the document doesn't have
real focus, so we must do it manually.
Bug: 53362
Change-Id: I781f59dda7f2884ff02f6688c2c8c037ac7ed1a6
* Assign cut/copy/paste events to the document so that
they are triggered when the CE doesn't have real focus
e.g. only a FocusableNode is selected
* Use clipboardData.setData when available. The key can
be stored and retrieved perfectly in text/xcustom but
this technique doesn't work in FF or IE
* Just use text content for key as this is what is written
to the clipboard, so this can be used directly without
having to get the content from the pasteTarget.
Bug: 48604
Bug: 49396
Change-Id: Ib3702f9441f6ee3fa34ec071f00994dd7e591d99
I trusted you guys when you told me to use DOM .focus() instead of
jQuery's .focus() and didn't test well enough :( The former doesn't
work, the latter does.
Follow-up to I7962f59b.
Bug: 47793
Change-Id: Iddfb8d7c99325b6c7a5d151948b57cfa5f0a6a62
For now this approach is bit of a hack and will hopefully
be replaced with an ability to cursor either side of an
annotation.
Bug: 51463
Change-Id: I701e3d26e06a28fed2d4950b1d418eda80a1fac5
Added GUI-level and Page-level "getDir()" methods to get the direction
of the GUI and Page respectively in the ve.ui.Surface and ve.ce.Surface
respectively.
The correction to the direction-test condition in ve.ui.Context reflects
the new method of getting these directions, and fixes the problem with
the transclusion icon. The icon position depends on the wiki/page-level
directionality, regardless of the GUI-level direction.
Bug: 51819
Change-Id: I36cef115017542c461e6d757f1c8bfda92074607
Opera triggers 'blur' on the document node when clicking on any <a>
link and never trigger 'focus' until after the user blurs the document
node *again* (by clicking outside of it or pressing 'Esc').
This causes the change polling to stop (SurfaceObserver#stop is called
without a subsequent call to SurfaceObserver#start).
To avoid this let's bind a delegated 'focus' event on all <a> links
inside the document and refocus it whenever that happens.
Bug: 47793
Change-Id: I7962f59bd02e075f91e42e6514b390c0d0feb3ab
We need to detect if the endNode we are trying to move is
inside our original delete selection, and not perform the
move if it is.
Bug: 50076
Change-Id: Ib89706c8717d13829bf89e44c4fb39e16a00821e
We already call clear() 4 other times in this code path, including
one right at the end of change(), which is called right before this
clear() call.
Change-Id: I6d5ba5075e1b24a981546243977c6a8501748c5f
This isn't as simple as just dropping applyToAppendedContent = false
on LinkAnnotation, because browsers differ in their continuation
behavior. Firefox continues links, but Chrome doesn't.
To work around this, add a property indicating that the annotation
needs its continuation behavior to be forced.
Rename areAnnotationsCorrect() to needsPawn() accordingly.
Bug: 49931
Change-Id: Id6424af89c92bba2be87736e8a937e0f2067c007
ve.ui.Surface.js
* Make local overlay a child of ve-ui-surface and a sibling to
ve-ce-surface elements.
** This keeps local overlays relative to their surface and eliminates the
need for insane z-indexes.
ve.ui.PopupWidget.js
* PopupWidget boundaries are now relative to ve-ce-surface and no longer
protrude out
ve.ce.Node.css, ve.ui.Window.css
* Removal or replacement of insane z-indexes.
ve.ce.FocusableNode.js, ve.ce.ProtectedNode.js, ve.ce.ResizableNode.js,
ve.ui.Context.js
* Translate offsets from local overlay
ve.init.mw.ViewPageTarget-monobook.css,
ve.init.mw.ViewPageTarget-vector.css
* Skin specific z-indexes for global overlay
ve.init.mw.ViewPageTarget.js
* Applied direction specific mw class to ce.Surface vs ui.Surface to
prevent mw content styles from being applied to ui elements.
ve.ui.Dialog.css
* Adjustments to surface inside of dialog so that relative offsets for
local overlays can be properly calculated.
ve.ui.Surface.css
* Explicitly force .ve-ui-surface to be relative so that it's children can
be relatively positioned.
ve.ui.Widget.css
* Removal of unnecessary font-size properties now that local overlay is
sibling of surface.
ve.js
* Added get relative position helper method to translate position offsets
from target parent
Bug: 50241
Change-Id: Ibadce404a2286bc5dcec48f0d9da89004dbbd867
When the cursor is programmatically moved, as we need to do
from time to time, Firefox's internal reference for the appropriate
cursor location on nearby lines is maintained, creating an
unexpected experience.
The fix is to wiggle the selection. This tricks Firefox into thinking
that it adjusted the selection natively.
Bug: 48289
Change-Id: I75e7e4467ec1c3faf344709886b9be5b1423cd3e
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
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
This ensures that attributes and properties that are supposed to be
stripped on copypaste are actually stripped.
Bug: 49307
Change-Id: I8c90f4a0b33acba6eea3180cc077f8dc440e6e7b
HTML5's drag and drop has a ton of benefits and a couple of
limitations. To achieve a native drag marker, an image tag helper
is used to indicate the size of the relocatable node. Chrome
shades the marker gray natively, Firefox is styled to match.
Change-Id: I755b698a3d968cc7e6ff125109d68ac83fd8a8a2
Was previously doing the text slicing before the cluster split
using substring, instead of after using splice.
Bug: 49233
Change-Id: If9c0860e2fe7b01eb0b27aae67c671062799a0fa