Expand all

ve.ui.DesktopContext

Extends

Constructor

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

Parameters:

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

Configuration options

Properties:
Name Type Attributes Default Description
$popupContainer jQuery optional

Clipping container for context popup

popupPadding number optional
10

Padding between popup and $popupContainer, can be negative

Source:
Context menu and inspectors.

Properties

createInspectorWindowManager #

Create a inspector window manager.

getRelatedSources #

Get related item sources.

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

Inherited from:
Source:
Get related item sources.

Methods

addPersistentSource(source) #

Add a persistent source that will stay visible until manually removed.

Parameters:

Name Type Description
source Object

Object containing name, model and config properties. See #getRelatedSources.

Inherited from:
Source:
Add a persistent source that will stay visible until manually removed.

afterContextChange() #

Handle debounced context change events.

Overrides:
Source:
Handle debounced context change events.

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

Destroy the context, removing all DOM elements.

Returns:

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

getInspectors() → {ve.ui.WindowManager} #

Get inspector window set.

Returns:

Type
ve.ui.WindowManager
Inherited from:
Source:
Get inspector window set.

getRelatedSourcesFromModels(selectedModels) → {Array.<Object>} #

Get related for selected models

Parameters:

Name Type Description
selectedModels Array.<ve.dm.Model>

Models

Returns:

See #getRelatedSources

Type
Array.<Object>
Inherited from:
Source:
Get related for selected models

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

Get the surface the context is being used with.

Returns:

Type
ve.ui.Surface
Inherited from:
Source:
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.

Returns:

Padding object, or null

Type
ve.ui.Surface.Padding | null
Inherited from:
Source:
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.

Inherited from:
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.

isEmbeddable() → {boolean} #

Check if the context menu for current content is embeddable.

Returns:

Context menu is embeddable

Type
boolean
Source:
Check if the context menu for current content is embeddable.

isInspectable() → {boolean} #

Check if current content is inspectable.

Returns:

Content is inspectable

Type
boolean
Inherited from:
Source:
Check if current content is inspectable.

isMobile() → {boolean} #

Check if context is for mobile devices

Returns:

Context is for mobile devices

Type
boolean
Inherited from:
Source:
Check if context is for mobile devices

isVisible() → {boolean} #

Check if context is visible.

Returns:

Context is visible

Type
boolean
Inherited from:
Source:
Check if context is visible.

onContextChange() #

Handle context change event.

While an inspector is opening or closing, all changes are ignored so as to prevent inspectors that change the selection from within their setup or teardown processes changing context state.

The response to selection changes is deferred to prevent teardown processes handlers that change the selection from causing this function to recurse. These responses are also debounced for efficiency, so that if there are three selection changes in the same tick, #afterContextChange only runs once.

Inherited from:
Source:
See:
Handle context change event.

onContextItemCommand() #

Handle command events from context items

Inherited from:
Source:
Handle command events from context items

onDocumentUpdate() #

Handle document update event.

Inherited from:
Source:
Handle document update event.

onInspectorOpening(win, opening, data) #

Handle an inspector opening event.

Parameters:

Name Type Description
win OO.ui.Window

Window that's being opened

opening jQuery.Promise

Promise resolved when window is opened; when the promise is resolved the first argument will be a promise which will be resolved when the window begins closing, the second argument will be the opening data

data Object

Window opening data

Overrides:
Source:
Handle an inspector opening event.

onInspectorResize() #

Handle inspector resize events

Source:
Handle inspector resize events

onPosition([passive]) #

Handle surface position change event.

Parameters:

Name Type Attributes Default Description
passive boolean optional
false
Source:
Handle surface position change event.

onSuppress() #

Handle context suppression event.

Source:
Handle context suppression event.

onUnsuppress() #

Handle context unsuppression event.

Source:
Handle context unsuppression event.

onWindowScroll(e) #

Handle window scroll events

Parameters:

Name Type Description
e jQuery.Event

Scroll event

Source:
Handle window scroll events

removePersistentSource(name) #

Remove a persistent source by name

Parameters:

Name Type Description
name string

Source name

Inherited from:
Source:
Remove a persistent source by name

setPopupSizeAndPosition([repositionOnly]) #

Apply the popup's size and position, within the bounds of the viewport

Parameters:

Name Type Attributes Description
repositionOnly boolean optional

Reposition the popup only

Source:
Apply the popup's size and position, within the bounds of the viewport

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

Returns:

Type
ve.ui.Context
Inherited from:
Source:
Setup menu items.

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

Teardown menu items.

Returns:

Type
ve.ui.Context
Inherited from:
Source:
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

Returns:

Promise resolved when context is finished showing/hiding

Type
jQuery.Promise

Fires:

Overrides:
Source:
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

Returns:

Type
ve.ui.Context
Inherited from:
Source:
Toggle the menu.

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

Update the size and position of the context.

Returns:

Type
ve.ui.Context

Fires:

Overrides:
Source:
Update the size and position of the context.

Events

resize() #