Text Molecule
From oWiki
Preference Dialog
Attributes
type
string ( r )
Type of this molecule, 'text'.
pref.name
string ( r )
The scriptable name for this molecule. This name can be set using rename method dynamically.
pref.enableWhen
string ( r, w )
Specifies the event that activates this molecule. Default is 'load'.
pref.disableWhen
string ( r, w )
Specifies the event that deactivates this molecule. Default is 'none'.
pref.fontFamily
string ( r, w )
Specifies the font name of this molecule. This can be a comma-separated list, of which the molecule will use the first font it recognizes.
pref.fontSize
string ( r, w )
Specifies the font size of this molecule.
| Value | Description |
|---|---|
| xx-small x-small small medium large x-large xx-large |
Sets the size of the font to different sizes, from xx-small
to xx-large. Default value: medium |
| smaller | Sets the font-size to a smaller size than the parent element |
| larger | Sets the font-size to a larger size than the parent element |
| length | Sets the font-size to a fixed size |
| % | Sets the font-size to a % of the parent element |
pref.fontStyle
string ( r, w )
Specifies the font style.
| Value | Description |
|---|---|
| normal | Default. The molecule displays a normal font |
| italic | The molecule displays an italic font |
| oblique | The molecule displays an oblique font |
pref.fontWeight
string ( r, w )
Specifies the font weight.
| Value | Description |
|---|---|
| normal | Default. Defines normal characters |
| bold | Defines thick characters |
| bolder | Defines thicker characters |
| lighter | Defines lighter characters |
| 100 200 300 400 500 600 700 800 900 |
Defines from thin to thick characters. 400 is the same as normal, and 700 is the same as bold |
pref.textDecoration
string ( r, w )
Specifies the style of text decoration.
| Value | Description |
|---|---|
| none | Default. Defines a normal text |
| underline | Defines a line under the text |
| overline | Defines a line over the text |
| line-through | Defines a line through the text |
| blink | Defines a blinking text |
pref.textAlign
string ( r, w )
Specifies text alignment in the droplet.
| Value | Description |
|---|---|
| left | Aligns the text to the left. |
| right | Aligns the text to the right |
| center | Centers the text |
| justify |
pref.textShadow
string ( r, w )
Accepts a comma-separated list of shadow effects to be applied to the text and text-decorations of the element. Each shadow effect is specified as <color> <offset-x> <offset-y> <blur-radius>.
Multiple shadow effects are applied front-to-back: the first shadow is on top.
| Value | Description |
|---|---|
| color | The color of the text-shadow (#6374AB) |
| offset-x | The X-coordinate of the text-shadow (20px), relative to the text |
| offset-y | The Y-coordinate of the text-shadow (-12px), relative to the text |
| blur-radius | The blur radius of the text-shadow (2px) |
pref.flow
string ( r, w )
Specifies the style of the text flow within the droplet.
| Value | Description |
|---|---|
| in-line | Takes up only as much width as the text needs, and does not force new lines. |
| block | Takes up the full width available, with a new line before and after. |
pref.lineHeight
string ( r, w )
Specifies the distance between lines.
| Value | Description |
|---|---|
| normal | Default. Sets a reasonable distance between lines |
| number | Sets a number that will be multiplied with the current font-size to set the distance between the lines |
| length | Sets a fixed distance between the lines |
| % | Sets a distance between the lines in % of the current font size |
pref.r
int ( r, w )
Specifies the RED component of the text color.
Possible values is between 0 to 255.
pref.g
int ( r, w )
Specifies the GREEN component of the text color.
Possible values is between 0 to 255.
pref.b
int ( r, w )
Specifies the BLUE component of the text color.
Possible values is between 0 to 255.
selectable
bool ( r, w )
Specifies whether the text is selectable.
innerHTML
string ( r, w )
Read or Write the HTML text.
editMode
bool ( r, w )
Specifies whether the edit mode is enabled. if enabled, this molecule displays an <input> textbox allowing users to enter text.
editText
string ( r, w )
Specifies the text in the <input> textbox.
editWrap
string ( r, w )
Specifies whether the text should be wrapped when it reaches the right side of the textbox.
| Value | Description |
|---|---|
| off | Default. No wrap. |
| soft | The browser inserts line breaks while displaying the text, but no actual line breaks in the text value. |
| hard | The browser inserts real line breaks in the text value. |
spellcheck
bool ( r, w )
Enable or disable spell checking in the <input> textbox.
Methods
rename(n)
n: string
| Rename this molecule. |
show()
| show the effects of this molecule. |
hide()
| hide the effects of this molecule. |
refresh()
| Force molecule to redraw with the current set of attributes. |
clone()
Return: a molecule
| Create a clone of this molecule. |
attach(droplet)
droplet: a droplet object (e.g. app.box.droplet)
| Attach this molecule to a droplet. |
detach()
| Remove this molecule from its droplet. |
deleteMod()
| Delete this molecule. |
serialize()
Return: string
| Serialize this molecule into its JSON representation. |

