Extends
Constructor
new ve.init.sa.Target([config])abstract
#
Hierarchy
Children
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:
|
- Source:
Methods
activateSurfaceForToolbar()protected
#
Activate the surface. Restore any properties saved in #deactivate.
- Inherited from:
- Source:
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
attachToolbar()
#
Attach the toolbar to the DOM
- Inherited from:
- Source:
bindHandlers()
#
Bind event handlers to target and document
- Inherited from:
- Source:
clearSurfaces()
#
Destroy and remove all surfaces from the target
- Inherited from:
- Source:
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
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
deactivateSurfaceForToolbar()protected
#
Deactivate the surface. Maybe save some properties that should be restored when it's activated.
- Inherited from:
- Source:
destroy() → {jQuery.Promise}
#
Destroy the target
- Inherited from:
- Source:
Returns:
Promise which resolves when the target has been destroyed
- Type
- jQuery.Promise
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
getDefaultMode() → {string}
#
Get default editing mode for new surfaces
- Inherited from:
- Source:
Returns:
Editing mode
- Type
- string
getScrollContainer() → {jQuery}
#
Get the target's scroll container
- Inherited from:
- Source:
Returns:
The target's scroll container
- Type
- jQuery
getSurface() → {ve.ui.Surface|null
}
#
null
}
#
Get the target's active surface, if it exists
- Inherited from:
- Source:
Returns:
- Type
-
ve.ui.Surface
|
null
getSurfaceConfig(config) → {Object}
#
getToolbar() → {ve.ui.TargetToolbar}
#
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
onContainerScroll()
#
Handle scroll container scroll events
- Inherited from:
- Source:
onDocumentKeyDown(e)
#
Handle key down events on the document
Parameters:
Name | Type | Description |
---|---|---|
e |
jQuery.Event | Key down event |
- Inherited from:
- Source:
onDocumentKeyUp(e)
#
Handle key up events on the document
Parameters:
Name | Type | Description |
---|---|---|
e |
jQuery.Event | Key up event |
- Inherited from:
- Source:
onDocumentVisibilityChange(e)
#
Handle visibility change events on the document
Parameters:
Name | Type | Description |
---|---|---|
e |
jQuery.Event | Visibility change event |
- Inherited from:
- Source:
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:
onTargetKeyDown(e)
#
Handle key down events on the target
Parameters:
Name | Type | Description |
---|---|---|
e |
jQuery.Event | Key down event |
- Inherited from:
- Source:
onToolbarActive(active)
#
Handle active events from the toolbar
Parameters:
Name | Type | Description |
---|---|---|
active |
boolean | The toolbar is active |
- Inherited from:
- Source:
onToolbarResize()
#
Handle toolbar resize events
- Inherited from:
- Source:
setDefaultMode(defaultMode)
#
Set default editing mode for new surfaces
Parameters:
Name | Type | Description |
---|---|---|
defaultMode |
string | Editing mode, see static.modes |
- Inherited from:
- Source:
setSurface(surface)
#
Set the target's active surface
Parameters:
Name | Type | Description |
---|---|---|
surface |
ve.ui.Surface |
- Inherited from:
- Source:
setupToolbar(surface)
#
Set up the toolbar, attaching it to a surface.
Parameters:
Name | Type | Description |
---|---|---|
surface |
ve.ui.Surface |
- Overrides:
- Source:
setupTriggerListeners()
#
Set up trigger listeners
- Inherited from:
- Source:
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
teardownToolbar() → {jQuery.Promise}
#
Teardown the toolbar
- Inherited from:
- Source:
Returns:
Promise which resolves when the toolbar has been torn down
- Type
- jQuery.Promise
unbindHandlers()
#
Unbind event handlers on target and document
- Inherited from:
- Source:
Events
surfaceReady()
#
Must be fired after the surface is initialized
- Inherited from:
- Source: