Expand all

abstract ve.ui.Context

Extends

Constructor

new ve.ui.Context(surface, [config])abstract #

Parameters:

Name Type Attributes Description
surface ve.ui.Surface
config Object optional

Configuration options

Mixes in:
Source:
UserInterface context.

Properties

getRelatedSourcesabstract #

Get related item sources.

Result is cached, and cleared when the model or selection changes.

Source:
Get related item sources.

isMobilestatic #

Context is for mobile devices.

Properties:

Type Description
boolean
Source:
Context is for mobile devices.

Methods

destroy() → {ve.ui.Context}chainable #

Destroy the context, removing all DOM elements.

Source:

Returns:

Type
ve.ui.Context
Destroy the context, removing all DOM elements.

getSurface() → {ve.ui.Surface} #

Get the surface the context is being used with.

Source:

Returns:

Type
ve.ui.Surface
Get the surface the context is being used with.

getSurfacePadding() → {ve.ui.Surface.Padding|null} #

Get an object describing the amount of padding the context adds to the surface.

For example the mobile context, which is fixed to the bottom of the viewport, will add bottom padding, whereas the floating desktop context will add none.

Source:

Returns:

Padding object, or null

Type
ve.ui.Surface.Padding | null
Get an object describing the amount of padding the context adds to the surface.

hide() #

Hide the context while it has valid items in the menu

This could be triggered by clicking the close button on mobile or by pressing escape.

Source:

Hide the context while it has valid items in the menu

This could be triggered by clicking the close button on mobile or by pressing escape.

isMobile() → {boolean} #

Check if context is for mobile devices

Source:

Returns:

Context is for mobile devices

Type
boolean
Check if context is for mobile devices

isVisible() → {boolean} #

Check if context is visible.

Source:

Returns:

Context is visible

Type
boolean
Check if context is visible.

onContextItemCommand() #

Handle command events from context items

Source:
Handle command events from context items

setupMenuItems([previousItems]) → {ve.ui.Context}protectedchainable #

Setup menu items.

Parameters:

Name Type Attributes Description
previousItems Array.<ve.ui.ContextItem> optional

if a context is being refreshed, this will be the previously-open items for comparison

Source:

Returns:

Type
ve.ui.Context
Setup menu items.

teardownMenuItems() → {ve.ui.Context}protectedchainable #

Teardown menu items.

Source:

Returns:

Type
ve.ui.Context
Teardown menu items.

toggle([show]) → {jQuery.Promise} #

Toggle the visibility of the context.

Parameters:

Name Type Attributes Description
show boolean optional

Show the context, omit to toggle

Source:

Returns:

Promise resolved when context is finished showing/hiding

Type
jQuery.Promise

Fires:

Toggle the visibility of the context.

toggleMenu([show]) → {ve.ui.Context}chainable #

Toggle the menu.

Parameters:

Name Type Attributes Description
show boolean optional

Show the menu, omit to toggle

Source:

Returns:

Type
ve.ui.Context
Toggle the menu.

updateDimensions() → {ve.ui.Context}chainable #

Update the size and position of the context.

Source:

Returns:

Type
ve.ui.Context

Fires:

Update the size and position of the context.

Events

resize() #