TextTarget

Source: TextActivityDocument.js:359

This class contains the properties and methods of the document elements that are the real
targets of user actions in text activities.


Constructor

new TextTarget( doc: module:activities/text/TextActivityDocument.TextActivityDocument, text: string, ): TextTarget

TextTarget constructor

Parameters


Instance Methods

reset(status?: string)

Resets the TextTarget status

Parameters

  • status (string, optional) — The targetStatus to be established. Default is NOT_EDITED

setProperties( $xml: external:jQuery, mediaBag: module:bags/MediaBag.MediaBag, )

Loads the text target settings from a specific JQuery XML element

Parameters

getAttributes(): object

Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.

Returns

  • object

setAttributes( data: object, ): module:activities/text/TextActivityDocument.TextTarget

Reads the properties of this TextTarget from a data object

Parameters

  • data (object) — The data object to be parsed, or just the text content

Returns

getAnswers(): string

Gets a string with all valid answers of this TextTarget. Useful for reporting users' activity.

Returns

  • string

checkColors()

Sets specific colors to the target jQuery element, based on its targetStatus value. Red
color usually means error.

readCurrentText(): string

Fills the currentText member with the text currently hosted in $span or selected in $comboList

Returns

  • string

Instance Fields

doc: module:activities/text/TextActivityDocument.TextActivityDocument

The TextActivityDocument to which this target belongs

text: string

The current text displayed by this TextTarget

attr: object

A set of optional attributes for text

isList: boolean

true when the target is a drop-down list

numIniChars: number

Number of characters initially displayed on the text field

iniChar: string

Character used to fill-in the text field

maxLenResp: number

Maximum length of the answer

answers: Array.<string>

Array of valid answers

options: object

Set of specific options

iniText: string

Text displayed by the target when the activity begins

infoMode: string

Type of additional information offered to the user. Possible values are: no_info, always,
onError and onDemand.

popupKey: string

Key that triggers the associated popup when infoMode is onDemand

popupContent: module:boxes/ActiveBoxContent.ActiveBoxContent

An optional ActiveBoxContent with information about this TextTarget

popupDelay: number

Time (seconds) to wait before showing the additional information

popupMaxTime: number

Maximum amount of time (seconds) that the additional information will be shown

onlyPlay: boolean

When this flag is true and popupContent contains audio, no visual feedback will be
provided (meaning that audio will be just played)

$comboList: external:jQuery

The drop-down list associated to this target

$span: external:jQuery

The span element associated to this target

$p: external:jQuery

The paragraph element where $span is currently located

The span element containing the popup

currentText: string

Current text in the $span element

num: number

Ordinal number of this target in the collection of targets

pos: number

Current ordinal position of this target in the document
(used in OrderText activities)

targetStatus: string

Current status of the target. Valid values are: NOT_EDITED, EDITED, SOLVED, WITH_ERROR and HIDDEN

flagModified: boolean

Flag to control if the initial content of this TextTarget has been modified

parentPane: module:activities/text/TextActivityBase.TextActivityBasePanel

Pointer to the activity panel containing this TextTarget