Popover ‹ Chocolat API

Popover(parent, range)

Creates a new Popover. Popover is a subclass of Window and inherits most methods.

  • parent Object – the editor containing the text, or a window, etc.
  • range Range – the range of text over which the popover should appear. Can also be a rect object {x, y, width, height}.

.size

Get or set the window's size. Setter is equivalent to .setSize(size, false).

Returns Size – the window's size.

.setSize(newSize, shouldAnimate)

Set the window's size. The size should be an object with width and height properties. e.g. {width: 250, height: 300}

  • newSize Size – the new window's frame.
  • shouldAnimate Bool – optional, whether to animate the resizing or not (default: false)

.behaviour

Get or set the popover's behaviour.

Returns String – the popover's behaviour.

Note

Behaviour must be one of

  1. strict: the popover will only be closed if it's closed explicitly, or if the containing window closes.
  2. transient: the popover will be closed if the user interacts with something outside the popover.
  3. semitransient: the popover will be closed if the user interacts with something outside the popover or its containing window.

.edge

Get or set which edge the popover is attached to: its "direction".

Returns String – the popover's edge/direction. One of "top", "bottom", "left" or "right".