Commit graph

828 commits

Author SHA1 Message Date
jenkins-bot ad8a95ead5 Merge "Remove ve.Factory and ve.Registry and use oojs instead" 2013-10-22 20:51:09 +00:00
jenkins-bot 6c6fcf1dbd Merge "Cache multiple requests for $resizable's offset" 2013-10-22 20:30:18 +00:00
jenkins-bot a2587ce927 Merge "Recalculate $resizable offset when positioning resize label" 2013-10-22 20:28:27 +00:00
Ed Sanders c543fef85f Cache multiple requests for $resizable's offset
Both the resize handles and the size label position themselves
using $resizable's relative offset, so we can optimise by
caching that result.

Change-Id: Ic225b15cfcece8d5c2e782e1e667d854f805c6fb
2013-10-22 20:27:36 +00:00
Ed Sanders 1efa327121 Recalculate $resizable offset when positioning resize label
Because it can change. Currently the resize label is not
positioned correctly if you use three of four resize handles.

Change-Id: I1a28bc57fda1097c94047fd7690ad8d403cdd478
2013-10-22 20:23:42 +00:00
Trevor Parscal 26a1d8986b Remove ve.Factory and ve.Registry and use oojs instead
Change-Id: I2717300e6cc6102296a2b8d063d344fa5897c825
2013-10-22 19:15:18 +00:00
Trevor Parscal b635541de2 Remove ve.getHash and use getHash from oojs instead
Change-Id: Ib688a3ba0ab07e0d0dc328a3878440756d1103fe
2013-10-22 19:14:23 +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
Trevor Parscal 6018e77d70 Use OO.EventEmitter instead of ve.EventEmitter
Change-Id: Ie35e5f51a8d3c0d7f4fa46230b7b37112df610b9
2013-10-22 16:57:33 +00:00
Trevor Parscal efafed3231 Remove ve.{inheritClass,mixinClass} and use OO instead
Change-Id: I8df9226a358a76b661eab6e967ff0d63d361f691
2013-10-18 18:58:08 +02:00
Ed Sanders f9a2c75b21 Show a label with the current dimensions while resizing
* Add config option to disable if required
* Centre label within resize handles
* Only show when resizing
* Sexy opacity transitions, rounded corners and multiplication
  character

Bug: 54297
Change-Id: Ic49430ce3302f780ae4b05d1fa29e14db1192c84
2013-10-16 16:42:12 +01:00
jenkins-bot cb5c1fca93 Merge "Match text selection background colour to node highlight" 2013-10-16 13:00:53 +00:00
jenkins-bot 5d772e1dae Merge "Misc UI fixes" 2013-10-16 12:42:19 +00:00
jenkins-bot 9500801848 Merge "Rename storeDomElements to storeGeneratedContents" 2013-10-16 12:36:27 +00: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
Trevor Parscal bb03e8f17e Misc UI fixes
* Followup 75270e24: use this.surface directly in MWMetaDialog
* Document that MWDialogTools need a SurfaceToolbar
* Namespace CE events and CSS classes with ve-ce- rather than ve-ui-
* Namespace SurfaceToolbar CSS classes correctly and put them in their
  own CSS file

Change-Id: I9e70917d9c220b39e68833f67ed49fae7f7cbe6a
2013-10-16 12:40:40 +02:00
Ed Sanders a1a448b6de Rename storeDomElements to storeGeneratedContents
The default is to store the entire generated DOM node, but in
general classes can store anything that can be held by the store.

Change-Id: Ia761079fadfb5a6cfa2f00e5b5e23d6c6d3468ac
2013-10-16 11:17:01 +01:00
Ed Sanders d539fa1ea0 Use dimensions cached in resizeInfo for resize calculations
The logic requires the size of $resizable when the resizing started.
This is already stored in this.resizeInfo, but for some reason the
code recalculates every time, which is both inefficient and wrong
(but not a problem at the moment as $resizable doesn't change size
until resizeEnd).

Change-Id: I37a3c98e24b9e7d5e1970212975cef5ce9ef8a99
2013-10-14 12:21:59 +01:00
Ed Sanders 600110b9c5 Split out setResizableHandlesPosition in ResizableNode
Change-Id: I254fc1851abdc7477e2067d1a6b5406f286e8668
2013-10-14 12:19:17 +01:00
Ed Sanders e73c97154d Add more resize events
'resize' is actually 'resizeEnd'. Added 'resizeStart' and 'resizing'
which is triggered on mouse move.

Change-Id: I13c6e426cbcc965b3db50082c5294ca76979fe57
2013-10-14 12:18:57 +01:00
jenkins-bot d826bc702e Merge changes I160e55ad,Idd0592d6,I4d403f1b
* changes:
  Remove ve.ce.Node.prototype.onAttributeChange
  Remove ve.ce.ImageNode.prototype.onUpdate
  Remove .tagName from ce.MWInlineImageNode
2013-10-11 17:30:18 +00: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
jenkins-bot 66615efc1f Merge "ve.ce.Surface.getSelectionRect() can return null" 2013-10-11 14:24:10 +00:00
jenkins-bot 873b190804 Merge "Add .isFocusable() to ve.ce.Node as a shortcut" 2013-10-11 14:22:46 +00:00
jenkins-bot 19c1e00446 Merge "Stop using ve.isMixedIn() to check if a node is focusable" 2013-10-11 14:21:55 +00:00
Roan Kattouw 7959ce9ca4 Add .isFocusable() to ve.ce.Node as a shortcut
Change-Id: Ia2d3023100859e94f25bf50ed7298370b8d57c42
2013-10-11 16:09:00 +02:00
Trevor Parscal d602724e83 Stop using ve.isMixedIn() to check if a node is focusable
* Moved isNodeFocusable to ve.ce.NodeFactory
* Added isFocusable static property to ve.ce.Node
* Set isFocusable to true on ve.ce.FocusableNode

Change-Id: I3cf666280abdfce55bf9b0710827bb25c40bfd51
2013-10-11 16:00:34 +02:00
Ed Sanders 64a9449513 Match text selection background colour to node highlight
This was probably correct by default on OSX but Ubuntu's
default theme uses an orange highlight, and Windows uses
dark blue.

Change-Id: I601c2d27f6d928b38799f3a6502de5be1dccc199
2013-10-11 14:35:52 +01:00
Roan Kattouw 1999ece918 Remove ve.ce.ImageNode.prototype.onUpdate
Was empty.

Bonus: consistently use object style for .attr(), was already
used for .css()

Change-Id: Idd0592d6f30388c9952e110ff6fff008bb465877
2013-10-11 15:09:21 +02:00
Ed Sanders 98230889ab Resizeable node updates context after mouse up
Was previously calling show(), which showed the context regardless
of whether one was required or not. Changed this to update().

Change-Id: I2c6c37b6b988cca60f3f3f2429476ab4b429184b
2013-10-10 13:34:54 +01:00
jenkins-bot e3a0ee5b6a Merge "Snap resizables to a grid when the shift key is held" 2013-10-09 23:24:06 +00:00
Ed Sanders 6445a77cec Snap resizables to a grid when the shift key is held
Defaults to 10px.

Change-Id: Idf760c446778b437edbc3cb209b04cbee1d96fb7
2013-10-10 01:10:28 +02:00
Ed Sanders bffa0df53f Prevent deletion of FocusableNodes from a collapsed selection
Instead select the node and require the user to press delete
again if they really meant to delete the node.

Also test cases!

Bug: 55336
Change-Id: I66520e18740e78ce6313f9b31bb575d06b91bea8
2013-10-09 17:41:31 +02:00
Roan Kattouw 5d7673ebc2 ve.ce.Surface.getSelectionRect() can return null
Document this fact and update callers to check for a null return value

Change-Id: I095041157cc0e24e48662f40690b4928bb8d829a
2013-10-08 11:35:17 +02:00
jenkins-bot 846414f215 Merge "Destroy test surfaces" 2013-10-08 09:19:03 +00:00
Ed Sanders c752215896 Destroy test surfaces
Also make sure surface observers are detached so they don't try to
poll the CE when it has been destroyed. This was causing exceptions
to be thrown in test runners.

Change-Id: Ic8864a73f3ee04da6018f552b1aa68748d7ffba7
2013-10-08 11:16:10 +02:00
jenkins-bot ac0f2ba092 Merge "Refactor out data processing from ve.dm.Document constructor" 2013-10-07 16:36:02 +00:00
Ed Sanders a8d84db0e8 Refactor out data processing from ve.dm.Document constructor
Also make collection of metadata and construction of nodes optional.

Change-Id: I02ba6d2199caccaf9fe9dcfba58eefa7b52c52b1
2013-10-07 17:26:21 +01:00
jenkins-bot b4f415ecc4 Merge "Prevent context menu from flickering after FocusableNode redraw" 2013-10-05 00:26:00 +00:00
Roan Kattouw 10bf7b34ca Followup 571d6cac: when the selection changes, undo highlights
Ignoring all bounced change events led to the logic for unhighlighting
the previously selected FocusableNode being skipped. This caused a bug
where if you clicked a FocusableNode, it would stay highlighted even
if you then selected some text, until you highlighted another node
(which would then be highlighted forever, etc.)

Change-Id: Ia8d74ef85eaa47326d49ef6c0f395b44b90da4dc
2013-10-03 15:50:51 -07:00
jenkins-bot c21c8556fc Merge "Make ve.Factory require static name property" 2013-10-03 22:03:26 +00:00
Trevor Parscal 61ddfb76e4 Make ve.Factory require static name property
Objective:
* Make ve.Factory behave like ve.NamedClassFactory
* Remove the only remaining use of ve.Factory (actions)
* Remove ve.NamedClassFactory

Change-Id: Ie302ef5ea31081de7ab0db6091058a59946aef4c
2013-10-03 14:52:19 -07:00
jenkins-bot dd9511f249 Merge "Change ve.dm.DocumentSlice to a mixin to ve.dm.LinearData" 2013-10-03 18:45:55 +00:00
Ed Sanders 5c31d3215b Change ve.dm.DocumentSlice to a mixin to ve.dm.LinearData
Document slice only ever contained linear data, with extra functionality
to preserve the range. It pre-dated LinearData, but now we should
refactor it to reflect its purpose.

Change-Id: Ifc908f7526c83a43a51372c8d2494d7260e7facd
2013-10-03 19:38:59 +01:00
Roan Kattouw 087fd6c348 Followup 5592ea26: bind native focus/blur events instead of jQuery events
In jQuery 1.8, if you focus something using jQuery, the jQuery focus
event fires before the jQuery blur event, which is wrong. If you focus
something natively, the events do fire in the correct order.
See http://jsfiddle.net/WGy9h/4/ .

Fortunately, the native events always fire in the correct order, so
listen to those instead. Normally, we're not concerned with the order,
but in ce.Surface we bind the same focus/blur handlers to a pair of two
nodes, and then if the focus moves from one to the other, we'll get
confused by the events being emitted in the wrong order.

Change-Id: Ia585b42b6deb74ba55a2d55ce1922b1e04d85e81
2013-10-02 17:59:51 -07:00
Roan Kattouw 5592ea2602 Make cursoring over a FocusableNode work again
When you cursor onto a FocusableNode, it's selected, and we focus the
paste target as part of our hack to make copying FocusableNodes work
in Firefox. But then when you press the arrow key again, that event
isn't picked up by anything, and you can't move the cursor off the
FocusableNode using the keyboard.

Fixed by attaching the EventSequencer to this.$ (which is the parent
of $documentNode and $pasteTarget) and listening for focus/blur on
both $documentNode and $pasteTarget.

Bug: 54443
Change-Id: I7bddcfa9fa6f38908e315c97623bd27133daa98d
2013-09-30 18:16:41 -07:00
jenkins-bot 7052472c2b Merge "Don't bounce selection changes DM->CE" 2013-09-30 23:56:25 +00:00
David Chan 571d6cac59 Don't bounce selection changes DM->CE
ve.ce.Surface.js
* changeModelSelection: store selection temporarily for bounce detection
* onChange: do nothing if bounce is detected

Change-Id: I758e7a72a5690463f12f456419c6e471dd29a9db
2013-10-01 00:49:27 +01:00
jenkins-bot a3854ad50a Merge "Typing into an annotation next to a word break keeps annotation" 2013-09-30 23:21:29 +00:00
Roan Kattouw cf19aff8b1 Follow-up to 9b999622: don't slug paragraphs that contain just a text node
Bug: 54791
Change-Id: Ide8b5320fae2622085f183c771173ef7190406ed
2013-09-30 09:33:59 -07:00