Commit graph

10 commits

Author SHA1 Message Date
Rob Moen c472b2fe4a Make local overlays local to surface and remove insane z-indexes
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
2013-07-02 19:35:43 +00:00
Christian Williams 5d44800b53 Correct Rendering for Block Images After Resize Undo
If a block image is resized and undone, there are lots of problems.

* The block image gets the wrong size. When rolling back the
transaction, height and width are passed as strings.
MWBlockImage tries to set the width to: width + 2. A 300px image
became 3002px.

* Resize handles didn't reposition and resize

* Relocatable drag marker didn't reposition and resize

* Focusable highlights didn't reposition and resize.

Change-Id: I8792b567b77da90ce5a2ad132e306705c5706606
2013-07-02 12:08:42 -07:00
Trevor Parscal ae6f91677e Unhack detached protected CE node shields
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
2013-06-28 00:42:34 +00:00
Christian Williams 867ec44a9f Reposition phantoms on init
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
2013-06-26 00:59:46 +00:00
Christian Williams babaa4118d FocusedNode Selection
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
2013-06-07 17:49:35 -07:00
Catrope 778a74daf7 Hack around exceptions thrown when closing the reference dialog
ce.ProtectedNode doesn't like to be torn down when it's detached,
and this was happening to CE nodes created in the MWReferenceList.

Hack around this by attaching the CE nodes generated by the
MWReferenceList to the ce.MWReferenceListNode (so they have a
parent and a way of getting to the surface), and by guarding against
multiple successive setups/teardowns in ce.ProtectedNode.

Change-Id: If00e75b939ccbdbaf681bbb6609fec54805bf9a0
2013-06-07 00:08:54 +00:00
Catrope e6c7aa4275 Clear phantoms on teardown in ProtectedNode
When you typed after a ProtectedNode that was previously at the end of
a paragraph, then moved the mouse, you'd get a JS error.

What happened was the typing caused a new TextNode to be created after
the ProtectedNode, which caused the ParagraphNode to be rebuilt,
detaching the original ProtectedNode and creating a new one. The
detached ProtectedNode was still bound to mousemove on the body, and
when that event fired it would try to remove its phantoms from the
surface and fail because detached nodes can't get to the surface.

Change-Id: I9f38776f0267645b14d7b26e2a25007cf3be8ec7
2013-05-26 12:23:55 +02:00
Inez Korczyński 2a53329f0d Make ve.ce.ProtectedNode use setup (for setup) and teardown (for teardown) events so it is going to work well after node is rewrapped (example: MWBlockImageNode).
Change-Id: Ibd539813f4302d8bbf8eaa35af71817a55fb1f4b
2013-05-15 10:28:56 -07:00
Christian Williams 30cfe6998f Fixing shields
Shields were being added twice. Switched the blank png to gif
because the red IE background couldn't be replicated. Changed
some styles from Alien to Protected.

Change-Id: I9c62665e4e0dc54b8511749b9d2a629db7990a16
2013-05-08 12:29:25 -07:00
Trevor Parscal 92f6688162 ve.ce.ProtectedNode
Objective:

Generalize the shield and phantom magic, so we can use it for pretty much
any node we like. Usually this will be used with generated content nodes,
but also with aliens (of course) and possible other stuff in the future.

Bonus:

Also fixes a bug in DM that would crash VE when you selected to the end
and hit backspace.

Changes:

*.php
* Added links to files

aliens.html
* Added attributes to aliens to make them aliens again

ve.ce.AlienNode.js
* Moved shield and phantom functionality to ve.ce.ProtectedNode

ve.ce.AlienNode.js, ve.ce.MWReferenceListNode.js,
ve.ce.MWReferenceNode.js, ve.ce.MWTemplateNode.js
* Mixed in ve.ce.ProtectedNode

ve.ce.Node.css
* Reorganized styles and updated class names
* Added simple light blue hover with outline (using inset box shadow) for
  protected nodes, same style as before for aliens

ve.ce.Surface.css
* Moved phantom styles to ve.ce.Node.css

ve.ce.BranchNode.js
* Moved call to setLive(false) to happen before detach() so that the
  surface object is still available and events can be disconnected

ve.ce.BranchNode.js, ve.ce.Document.js, ve.ce.js, ve.ce.Surface.js, ve.ce.SurfaceObserver.js
* Adjusted CSS class names

ve.ce.Node.js
* Moved shield template to ve.ce.ProtectedNode

ve.ce.ProtectedNode.js
* New class, mix into another class to protect it from editing

ve.ce.RelocatableNode.js
* Renamed temporary surface property to relocatingSurface to avoid
  confusion when debugging

ve.ce.Surface.js
* Moved phantom template to ve.ce.ProtectedNode

ve.dm.Transaction.js
* Fixed bug where most of the internal list was being deleted when the
  end of the document was selected and the user pressed backspace

Change-Id: I2468b16e1ba6785ad298e38190e33493135719c3
2013-05-07 00:08:48 +00:00