UNPKG

1.78 kBTypeScriptView Raw
1/**
2 * Contains the FormattedString and Span classes, which are used to create a formatted (rich text) strings.
3 */
4
5import { Span } from './span';
6import { ObservableArray } from '../../data/observable-array';
7import { ViewBase } from '../core/view-base';
8import { Color } from '../../color';
9import { FontStyle, FontWeight } from '../styling/font';
10import { CoreTypes } from '../../core-types';
11
12/**
13 * A class used to create a formatted (rich text) string.
14 */
15export class FormattedString extends ViewBase {
16 /**
17 * An observable collection of Span objects used to define common text properties.
18 */
19 public spans: ObservableArray<Span>;
20
21 /**
22 * A human readable representation of the formatted string.
23 */
24 public toString(): string;
25
26 /**
27 * Gets or sets the font family which will be used for all spans that doesn't have a specific value.
28 */
29 public fontFamily: string;
30
31 /**
32 * Gets or sets the font size which will be used for all spans that doesn't have a specific value.
33 */
34 public fontSize: number;
35
36 /**
37 * Gets or sets the font style which will be used for all spans that doesn't have a specific value.
38 */
39 public fontStyle: FontStyle;
40
41 /**
42 * Gets or sets the font weight which will be used for all spans that doesn't have a specific value.
43 */
44 public fontWeight: FontWeight;
45
46 /**
47 * Gets or sets text decorations which will be used for all spans that doesn't have a specific value.
48 */
49 public textDecoration: CoreTypes.TextDecorationType;
50
51 /**
52 * Gets or sets the font foreground color which will be used for all spans that doesn't have a specific value.
53 */
54 public color: Color;
55
56 /**
57 * Gets or sets the font background color which will be used for all spans that doesn't have a specific value.
58 */
59 public backgroundColor: Color;
60}