Extends
Constructor
new ve.init.Target([config], [register])abstract
#
Generic Initialization target.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object |
optional |
Configuration options Properties:
|
|||||||||||||||||||||||||||||||
register |
boolean |
optional |
true | Register the target at ve.init.target |
- Mixes in:
- Source:
Properties
actionGroupsstatic
#
Toolbar definition for the actions side of the toolbar
Properties:
Type | Description |
---|---|
Array |
- Deprecated:
- Use align:'after' in the regular toolbarGroups instead.
- Source:
annotateImportedData :booleanstatic
#
Apply the meta/importedData annotation to pasted/dropped data
Type:
- boolean
- Source:
documentCommands :Array.<string>static
#
List of commands which can be triggered anywhere from within the document
Type:
- Array.<string>
- Source:
excludeCommands :Array.<string>static
#
importRules :Objectstatic
#
Surface import rules
One set for external (non-VE) paste sources and one for all paste sources.
Most rules are handled in ve.dm
.ElementLinearData#sanitize, but htmlBlacklist
is handled in ve.ce.Surface#afterPaste.
Type:
- Source:
Surface import rules
One set for external (non-VE) paste sources and one for all paste sources.
includeCommands :Array.<string>|null
static
#
null
static
#
List of commands to include in the target
Null means all commands in the registry are used (excluding excludeCommands)
Type:
-
Array.<string>
|
null
- Source:
List of commands to include in the target
Null means all commands in the registry are used (excluding excludeCommands)
modesstatic
#
Editing modes available in the target.
Must contain at least one mode. Overridden if the #modes config option is used.
Properties:
Type | Description |
---|---|
Array.<string> |
- Source:
targetCommands :Array.<string>static
#
toolbarGroupsstatic
#
Methods
activateSurfaceForToolbar()protected
#
Activate the surface. Restore any properties saved in #deactivate.
- 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 |
- Source:
Returns:
- Type
- ve.ui.Surface
attachToolbar()
#
Attach the toolbar to the DOM
- Source:
bindHandlers()
#
Bind event handlers to target and document
- Source:
clearSurfaces()
#
Destroy and remove all surfaces from the target
- 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 |
- 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 |
- Source:
Returns:
- Type
- ve.ui.TargetWidget
deactivateSurfaceForToolbar()protected
#
Deactivate the surface. Maybe save some properties that should be restored when it's activated.
- Source:
destroy() → {jQuery.Promise}
#
Destroy the target
- Source:
Returns:
Promise which resolves when the target has been destroyed
- Type
- jQuery.Promise
getActions() → {ve.ui.TargetToolbar}
#
Get the actions toolbar
- Deprecated:
- Yes
- Source:
Returns:
Actions toolbar (same as the normal toolbar)
- Type
- ve.ui.TargetToolbar
getDefaultMode() → {string}
#
Get default editing mode for new surfaces
- Source:
Returns:
Editing mode
- Type
- string
getScrollContainer() → {jQuery}
#
getSurface() → {ve.ui.Surface|null
}
#
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 |
- Source:
Returns:
Editing mode is available
- Type
- boolean
onContainerScroll()
#
Handle scroll container scroll events
- Source:
onDocumentKeyDown(e)
#
Handle key down events on the document
Parameters:
Name | Type | Description |
---|---|---|
e |
jQuery.Event | Key down event |
- Source:
onDocumentKeyUp(e)
#
Handle key up events on the document
Parameters:
Name | Type | Description |
---|---|---|
e |
jQuery.Event | Key up event |
- Source:
onDocumentVisibilityChange(e)
#
Handle visibility change events on the document
Parameters:
Name | Type | Description |
---|---|---|
e |
jQuery.Event | Visibility change event |
- Source:
onSurfaceViewFocus(surface)
#
Handle focus events from a surface's view
Parameters:
Name | Type | Description |
---|---|---|
surface |
ve.ui.Surface | Surface firing the event |
- Source:
onTargetKeyDown(e)
#
Handle key down events on the target
Parameters:
Name | Type | Description |
---|---|---|
e |
jQuery.Event | Key down event |
- Source:
onToolbarActive(active)
#
Handle active events from the toolbar
Parameters:
Name | Type | Description |
---|---|---|
active |
boolean | The toolbar is active |
- Source:
onToolbarResize()
#
Handle toolbar resize events
- Source:
setDefaultMode(defaultMode)
#
Set default editing mode for new surfaces
Parameters:
Name | Type | Description |
---|---|---|
defaultMode |
string | Editing mode, see static.modes |
- Source:
setSurface(surface)
#
setupToolbar(surface)
#
Set up the toolbar, attaching it to a surface.
Parameters:
Name | Type | Description |
---|---|---|
surface |
ve.ui.Surface |
- Source:
setupTriggerListeners()
#
Set up trigger listeners
- Source:
teardown() → {jQuery.Promise}
#
Teardown the target, removing all surfaces, toolbars and handlers
- Source:
Returns:
Promise which resolves when the target has been torn down
- Type
- jQuery.Promise
teardownToolbar() → {jQuery.Promise}
#
Teardown the toolbar
- Source:
Returns:
Promise which resolves when the toolbar has been torn down
- Type
- jQuery.Promise
unbindHandlers()
#
Unbind event handlers on target and document
- Source:
createModelFromDom(doc, mode, options) → {ve.dm.Document}static
#
Create a document model from an HTML document.
Parameters:
Name | Type | Description |
---|---|---|
doc |
HTMLDocument | string | HTML document or source text |
mode |
string | Editing mode |
options |
Object | Conversion options |
- Source:
Returns:
Document model
- Type
- ve.dm.Document
parseDocument(documentString, mode) → {HTMLDocument|string}static
#
Parse document string into an HTML document
Parameters:
Name | Type | Description |
---|---|---|
documentString |
string | Document. Note that this must really be a whole document with a single root tag. |
mode |
string | Editing mode |
- Source:
Returns:
HTML document, or document string (source mode)
- Type
- HTMLDocument | string
Events
surfaceReady()
#
Must be fired after the surface is initialized
- Source: