TextActivityDocument
Source: TextActivityDocument.js:43
This is the HTML DOM element used in text activities like FillInBlanks,
IdentifyText, OrderText and Complete. It contains the main document of
the activity, usually with some elements marked as "targets". In FillInBlanks, this
targets are encapsulated in TextTarget objects.
Constructor
new TextActivityDocument(): TextActivityDocumentTextActivityDocument constructor
Instance Methods
setProperties(
$xml: external:jQuery,
mediaBag: module:bags/MediaBag.MediaBag,
)
Loads the document settings from a specific JQuery XML element
Parameters
$xml(external:jQuery) — The XML element to parsemediaBag(module:bags/MediaBag.MediaBag) — The media bag used to load images and media content
readDocAttributes($xml: external:jQuery): object
Reads sets of text attributes, sometimes in form of named styles
Parameters
$xml(external:jQuery) — The XML element to parse
Returns
object
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.TextActivityDocument
Reads the properties of this TextActivityDocument from a data object
Parameters
data(object) — The data object to be parsed, or just the text content
Returns
getRawText(): string
Gets the full text of this document in raw format
Returns
string
getFullStyle(name: string): object
Gets a style object filled with default attributes plus attributes present in the
requested style name.
Parameters
name(string) — The requested style name
Returns
object
Instance Fields
tabSpc: number
Number of blank spaces between tabulators.
lastBoxId: number
Index of the last ActiveBox activated.
tmb: object
A bag of TargetMarker objects
numTargets: number
Number of targets
targetType: string
Type of targets used in this activity. Possible values are: TT_FREE, TT_CHAR, TT_WORD
and TT_PARAGRAPH.
style: object
Collection of named styles of the document
p: object
The main document, represented as a collection of DOM objects
Static Fields
DEFAULT_DOC_STYLE
Default style