File

src/lib/myScript/output/text/textTagItem.ts

Constructor

constructor(obj: TextTagItemParameter)

Methods

getTagType
getTagType()

Get tag type

Returns: string
getInkRanges
getInkRanges()

Get ink ranges

Properties

inkRanges
inkRanges: TextInkRange[]
tagType
tagType: string
import { TextInkRange } from './textInkRange';

export interface TextTagItemParameter {
	inkRanges?: Array<TextInkRange | string> | string;
	tagType?: string;
}

export class TextTagItem {
	inkRanges: Array<TextInkRange> = [];
	tagType: string;

	constructor(obj?: TextTagItemParameter) {
		this.tagType = obj && obj.tagType;
		if (obj && obj.inkRanges) {
			let ranges = obj.inkRanges;
			if (!Array.isArray(ranges)) {
				ranges = ranges.split(/[\s]+/);
			}
			this.inkRanges = ranges.map(range => new TextInkRange(range));
		}
	}

	/**
	 * Get tag type
	 *
	 * @method getTagType
	 * @returns {String}
	 */
	getTagType(): string {
		return this.tagType;
	};

	/**
	 * Get ink ranges
	 *
	 * @method getInkRanges
	 * @returns {TextInkRange[]}
	 */
	getInkRanges(): Array<TextInkRange | string> | string {
		return this.inkRanges;
	};
}

results matching ""

    No results matching ""