Expand all

abstract ve.init.sa.Target

Extends

Constructor

new ve.init.sa.Target([config])abstract #

Initialization Standalone target.

A platform must be constructed first. See ve.init.sa.Platform for an example.

Example

ve.init.platform.initialize().done( () => {
        var target = new ve.init.sa.DesktopTarget();
        target.addSurface(
            ve.dm.converter.getModelFromDom(
                ve.createDocumentFromHtml( '<p>Hello, World!</p>' )
            )
        );
        $( document.body ).append( target.$element );
    } );

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Properties:
Name Type Attributes Description
toolbarConfig Object optional

Configuration options for the toolbar

Source:
Initialization Standalone target.

Methods

activateSurfaceForToolbar()protected #

Activate the surface. Restore any properties saved in #deactivate.

Inherited from:
Source:
Activate the surface.

addSurface(dmDocOrSurface, [config]) → {ve.ui.Surface} #

Add a surface to the target

Parameters:

Name Type Attributes Description
dmDocOrSurface ve.dm.Document | ve.dm.Surface

Document model or surface model

config Object optional

Configuration options

Overrides:
Source:

Returns:

Type
ve.ui.Surface
Add a surface to the target

attachToolbar() #

Attach the toolbar to the DOM

Inherited from:
Source:
Attach the toolbar to the DOM

bindHandlers() #

Bind event handlers to target and document

Inherited from:
Source:
Bind event handlers to target and document

clearSurfaces() #

Destroy and remove all surfaces from the target

Inherited from:
Source:
Destroy and remove all surfaces from the target

createSurface(dmDocOrSurface, [config]) → {ve.ui.Surface} #

Create a surface.

Parameters:

Name Type Attributes Description
dmDocOrSurface ve.dm.Document | ve.dm.Surface

Document model or surface model

config Object optional

Configuration options

Inherited from:
Source:

Returns:

Type
ve.ui.Surface
Create a surface.

createTargetWidget([config]) → {ve.ui.TargetWidget} #

Create a target widget.

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Inherited from:
Source:

Returns:

Type
ve.ui.TargetWidget
Create a target widget.

deactivateSurfaceForToolbar()protected #

Deactivate the surface. Maybe save some properties that should be restored when it's activated.

Inherited from:
Source:
Deactivate the surface.

destroy() → {jQuery.Promise} #

Destroy the target

Inherited from:
Source:

Returns:

Promise which resolves when the target has been destroyed

Type
jQuery.Promise
Destroy the target

getActions() → {ve.ui.TargetToolbar} #

Get the actions toolbar

Inherited from:
Deprecated:
  • Yes
Source:

Returns:

Actions toolbar (same as the normal toolbar)

Type
ve.ui.TargetToolbar
Get the actions toolbar

getDefaultMode() → {string} #

Get default editing mode for new surfaces

Inherited from:
Source:

Returns:

Editing mode

Type
string
Get default editing mode for new surfaces

getScrollContainer() → {jQuery} #

Get the target's scroll container

Inherited from:
Source:

Returns:

The target's scroll container

Type
jQuery
Get the target's scroll container

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

Get the target's active surface, if it exists

Inherited from:
Source:

Returns:

Type
ve.ui.Surface | null
Get the target's active surface, if it exists

getSurfaceConfig(config) → {Object} #

Get surface configuration options

Parameters:

Name Type Description
config Object

Configuration option overrides

Inherited from:
Source:

Returns:

Surface configuration options

Type
Object
Get surface configuration options

getToolbar() → {ve.ui.TargetToolbar} #

Get the target's toolbar

Inherited from:
Source:

Returns:

Toolbar

Type
ve.ui.TargetToolbar
Get the target's toolbar

isModeAvailable(mode) → {boolean} #

Check if a specific editing mode is available

Parameters:

Name Type Description
mode string

Editing mode

Inherited from:
Source:

Returns:

Editing mode is available

Type
boolean
Check if a specific editing mode is available

onContainerScroll() #

Handle scroll container scroll events

Inherited from:
Source:
Handle scroll container scroll events

onDocumentKeyDown(e) #

Handle key down events on the document

Parameters:

Name Type Description
e jQuery.Event

Key down event

Inherited from:
Source:
Handle key down events on the document

onDocumentKeyUp(e) #

Handle key up events on the document

Parameters:

Name Type Description
e jQuery.Event

Key up event

Inherited from:
Source:
Handle key up events on the document

onDocumentVisibilityChange(e) #

Handle visibility change events on the document

Parameters:

Name Type Description
e jQuery.Event

Visibility change event

Inherited from:
Source:
Handle visibility change events on the document

onSurfaceViewFocus(surface) #

Handle focus events from a surface's view

Parameters:

Name Type Description
surface ve.ui.Surface

Surface firing the event

Inherited from:
Source:
Handle focus events from a surface's view

onTargetKeyDown(e) #

Handle key down events on the target

Parameters:

Name Type Description
e jQuery.Event

Key down event

Inherited from:
Source:
Handle key down events on the target

onToolbarActive(active) #

Handle active events from the toolbar

Parameters:

Name Type Description
active boolean

The toolbar is active

Inherited from:
Source:
Handle active events from the toolbar

onToolbarResize() #

Handle toolbar resize events

Inherited from:
Source:
Handle toolbar resize events

setDefaultMode(defaultMode) #

Set default editing mode for new surfaces

Parameters:

Name Type Description
defaultMode string

Editing mode, see static.modes

Inherited from:
Source:
Set default editing mode for new surfaces

setSurface(surface) #

Set the target's active surface

Parameters:

Name Type Description
surface ve.ui.Surface
Inherited from:
Source:
Set the target's active surface

setupToolbar(surface) #

Set up the toolbar, attaching it to a surface.

Parameters:

Name Type Description
surface ve.ui.Surface
Overrides:
Source:
Set up the toolbar, attaching it to a surface.

setupTriggerListeners() #

Set up trigger listeners

Inherited from:
Source:
Set up trigger listeners

teardown() → {jQuery.Promise} #

Teardown the target, removing all surfaces, toolbars and handlers

Inherited from:
Source:

Returns:

Promise which resolves when the target has been torn down

Type
jQuery.Promise
Teardown the target, removing all surfaces, toolbars and handlers

teardownToolbar() → {jQuery.Promise} #

Teardown the toolbar

Inherited from:
Source:

Returns:

Promise which resolves when the toolbar has been torn down

Type
jQuery.Promise
Teardown the toolbar

unbindHandlers() #

Unbind event handlers on target and document

Inherited from:
Source:
Unbind event handlers on target and document

Events

surfaceReady() #

Must be fired after the surface is initialized

Inherited from:
Source:
Must be fired after the surface is initialized