Expand all

abstract ve.ui.TargetWidget

Extends

Constructor

new ve.ui.TargetWidget([config])abstract #

Creates an ve.ui.TargetWidget object.

User must call #initialize after the widget has been attached to the DOM, and also after the document is changed with #setDocument.

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Properties:
Name Type Attributes Default Description
doc ve.dm.Document optional

Initial document model

modes Object optional

Available editing modes.

defaultMode Object optional

Default mode for new surfaces.

toolbarGroups Object optional

Target's toolbar groups config.

includeCommands Array.<string> | null optional

List of commands to include, null for all registered commands

excludeCommands Array.<string> optional

List of commands to exclude

importRules Object optional

Import rules

multiline boolean optional
true

Multi-line surface

placeholder string optional

Placeholder text to display when the surface is empty

readOnly boolean optional

Surface is read-only

inDialog string optional

The name of the dialog this surface widget is in

Mixes in:
Source:
Creates an ve.ui.TargetWidget object.

Methods

clear() #

Destroy surface and toolbar.

Source:
Destroy surface and toolbar.

createTarget() → {ve.init.Target} #

Create the target for this widget to use

Source:

Returns:

Type
ve.init.Target
Create the target for this widget to use

focus() #

Focus the surface.

Source:
Focus the surface.

getContent() → {Array} #

Get content data.

Source:

Returns:

Content data

Type
Array
Get content data.

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

Get surface.

Source:

Returns:

Type
ve.ui.Surface | null
Get surface.

getToolbar() → {OO.ui.Toolbar} #

Get toolbar.

Source:

Returns:

Type
OO.ui.Toolbar
Get toolbar.

hasBeenModified() → {boolean} #

Check if the surface has been modified.

Source:

Returns:

The surface has been modified

Type
boolean
Check if the surface has been modified.

initialize() #

Initialize surface and toolbar.

Widget must be attached to DOM before initializing.

Deprecated:
  • Yes
Source:
Initialize surface and toolbar.

isReadOnly() → {boolean} #

Check if the widget is read-only

Source:

Returns:

Type
boolean
Check if the widget is read-only

onFocusChange() #

Handle focus and blur events

Source:
Handle focus and blur events

onSurfaceCancel() #

Handle surface cancel events

onSurfaceSubmit() #

Handle surface submit events

setDocument(doc) #

Set the document to edit

This replaces the entire surface in the target.

Parameters:

Name Type Description
doc ve.dm.Document
Source:

Fires:

Set the document to edit

This replaces the entire surface in the target.

setReadOnly(readOnly) #

Set the read-only state of the widget

Parameters:

Name Type Description
readOnly boolean

Make widget read-only

Source:
Set the read-only state of the widget

Events

cancel() #

The target's surface has been cancelled, e.g. Escape

Source:
The target's surface has been cancelled, e.g.

change() #

The target's surface has been changed.

Source:
The target's surface has been changed.

setup() #

A document has been attached to the target, and a toolbar and surface created.

Source:
A document has been attached to the target, and a toolbar and surface created.

submit() #

The target's surface has been submitted, e.g. Ctrl+Enter

Source:
The target's surface has been submitted, e.g.