Text Molecule

Add an HTML editor and renderer.

Summary
Text Molecule
Preference Dialog
Properties
typestring, ( r )
pref.namestring, ( r )
pref.enableWhenstring, ( r, w )
pref.disableWhenstring, ( r, w )
pref.fontFamilystring, ( r, w )
pref.fontSizestring, ( r, w )
pref.fontStylestring, ( r, w )
pref.fontWeightstring, ( r, w )
pref.textDecorationstring, ( r, w )
pref.textAlignstring, ( r, w )
pref.textShadowstring, ( r, w )
pref.flowstring, ( r, w )
pref.lineHeightstring, ( r, w )
pref.rint [0, 255], ( r, w )
pref.gint [0, 255], ( r, w )
pref.bint [0, 255], ( r, w )
selectablebool, ( r, w )
innerHTMLstring, ( r, w )
innerTextstring, ( r, w )
editModebool, ( r, w )
editTextstring, ( r, w )
editWrapstring, ( r, w )
spellcheckbool, ( r, w )
Functions
attach
detach
delete
rename
show
hide
refresh
clone
serialize

Preference Dialog

Properties

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 function 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 font names 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 font size of this molecule.  Default to medium.

xx-small9px (7pt).
x-small10px (7.5pt).
small13px (10pt).
medium16px (12pt).
large18px (13.5pt).
x-large24px (18pt).
xx-large32px (24pt).
smallerSets the font-size to a smaller size than the parent element.
largerSets the font-size to a larger size than the parent element.
lengthSets the font-size to a fixed size.
%Sets the font-size to % of the parent element.

pref.fontStyle

string, ( r, w )

Specifies the font style.

normalDefault.  The molecule displays a normal font.
italicThe molecule displays an italic font.
obliqueThe molecule displays an oblique font.

pref.fontWeight

string, ( r, w )

Specifies font weight.

normalDefault.  Defines normal characters.
boldDefines thick characters.
bolderDefines thicker characters.
lighterDefines lighter characters.
100Defines from thin to thick characters.  400 is the same as normal, and 700 is the same as bold.
200Defines from thin to thick characters.
300Defines from thin to thick characters.
400Defines from thin to thick characters.
500Defines from thin to thick characters.
600Defines from thin to thick characters.
700Defines from thin to thick characters.
800Defines from thin to thick characters.
900Defines from thin to thick characters.

pref.textDecoration

string, ( r, w )

Specifies the style of text decoration.

noneDefault.  Defines a normal text.
underlineDefines a line under the text.
overlineDefines a line over the text.
line-throughDefines a line through the text.
blinkDefines a blinking text.

pref.textAlign

string, ( r, w )

Specifies text alignment in the droplet.

leftDefault.  Aligns text to the left.
rightAligns text to the right.
centerCenters the text.
justifyJustifies text to both edges.

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.

colorThe color of the text-shadow (#6374AB).
offset-xThe x-coordinate of the text-shadow (20px), relative to the text.
offset-yThe y-coordinate of the text-shadow (-12px), relative to the text.
blur-radiusThe blur radius of the text-shadow (2px).

pref.flow

string, ( r, w )

Specifies the style of the text flow within the droplet.

inlineDefault.  Takes up only as much width as the text needs, and does not force new lines.
blockTakes up the full width available, with a new line before and after.

pref.lineHeight

string, ( r, w )

Specifies the distance between lines.

normalDefault.  Sets a reasonable distance between lines.
numberSets a number that will be multiplied with the current font-size to set the distance between the lines.
lengthSets a fixed distance between the lines.
%Sets a distance between the lines in % of the current font size.

pref.r

int [0, 255], ( r, w )

Specifies the RED component of the text color.

pref.g

int [0, 255], ( r, w )

Specifies the GREEN component of the text color.

pref.b

int [0, 255], ( r, w )

Specifies the BLUE component of the text color.

selectable

bool, ( r, w )

Specifies whether the text is selectable.

innerHTML

string, ( r, w )

Reads or Writes the HTML text.

innerText

string, ( r, w )

Reads or Writes the raw text.  Text is displayed as is, without HTML interpretation.

editMode

bool, ( r, w )

Specifies whether the edit mode is enabled. if enabled, this molecule displays an <input> textbox allowing users to enter text.  Similar to contentEditable attribute.

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.

offDefault.  No wrap.
softThe browser inserts line breaks while displaying the text, but no actual line breaks in the text value.
hardThe browser inserts real line breaks in the text value.

spellcheck

bool, ( r, w )

Enable or disable spell checking in the <input> textbox.

Functions

attach

attach(droplet);

Attach this molecule to the given droplet.

Parameters

droplet(object) a droplet.

Returns

N/A

detach

detach();

Remove this molecule from its droplet.

Parameters

N/A

Returns

N/A

delete

delete();

Delete this molecule.

Parameters

N/A

Returns

N/A

rename

rename(name);

Rename this molecule.

Parameters

name(string) a new name.

Returns

N/A

show

show();

Shows the effects of this molecule.

Parameters

N/A

Returns

N/A

hide

hide();

Hides the effects of this molecule.

Parameters

N/A

Returns

N/A

refresh

refresh();

Forces molecule to redraw with the current set of preferences.

Parameters

N/A

Returns

N/A

clone

clone();

Create a clone of this molecule.

Parameters

N/A

Returns

(object) a molecule.

serialize

serialize();

Serialize this molecule into its JSON representation.

Parameters

N/A

Returns

(string) JSON representation of a molecule.

Close