Set styling on the DOM elements used to display Nodes
.
An instance of this class is passed into the
addRenderNodeElementStyles
extension point callback. Extensions then use this class to set
styling on the DOM element that's being used to display the given Node.
This class differs from the NodeRenderer because it's used right before the DOM element is displayed on screen.
Methods
- setStyle(name, value)
- setAttribute(name, value)
Classes
- textClass() → String
- addTextClass(clss)
- backgroundClass() → String
- addBackgroundClass(clss)
- wrapClass() → String
- addWrapClass(clss)
Geometry
- measureTextRange(location, length) → Rect
Method Details
-
setStyle(name, value)
-
Set DOM Element style property.
Parameters:
Name Type Description name
String style name.
value
String style value.
-
setAttribute(name, value)
-
Set a DOM Element attribute.
Parameters:
Name Type Description name
String property name.
value
String property value.
-
textClass() → {String}
-
Class that will be used to render this "text" element of the node's line DOM.
Returns:
- Type
- String
-
addTextClass(clss)
-
Add a new class to the "text" element of the node's line DOM.
Parameters:
Name Type Description clss
String class name.
-
backgroundClass() → {String}
-
Class that will be used to render this "background" element of the node's line DOM.
Returns:
- Type
- String
-
addBackgroundClass(clss)
-
Add a new class to the "background" element of the node's line DOM.
Parameters:
Name Type Description clss
String class name.
-
wrapClass() → {String}
-
Class that will be used to render this "wrap" element of the node's line DOM.
Returns:
- Type
- String
-
addWrapClass(clss)
-
Add a new class to the "wrap" element of the node's line DOM.
Parameters:
Name Type Description clss
String class name.
-
measureTextRange(location, length) → {Rect}
-
Measure a range of text in the rendered node. This is used most often when setting margins, making sure that everything lines up no matter what styles are applied, etc.
Parameters:
Name Type Description location
Number location in node's text
length
Number length to measure
Returns:
- Type
- Rect