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 Array.<string> optional

Available editing modes.

defaultMode string optional

Default mode for new surfaces.

toolbarGroups Array.<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

allowTabFocusChange Object optional
true

Allow changing focus form the surface with tab/shift+tab. Unlike in a normal Target, this defaults to true in a TargetWidget.

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

Returns:

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

focus() #

Focus the surface.

Source:
Focus the surface.

getContent() → {Array} #

Get content data.

Returns:

Content data

Type
Array
Source:
Get content data.

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

Get surface.

Returns:

Type
ve.ui.Surface | null
Source:
Get surface.

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

Get toolbar.

Returns:

Type
OO.ui.Toolbar
Source:
Get toolbar.

hasBeenModified() → {boolean} #

Check if the surface has been modified.

Returns:

The surface has been modified

Type
boolean
Source:
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

Returns:

Type
boolean
Source:
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

Fires:

Source:

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.