UNPKG

core-cde

Version:

41 lines 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Heading = void 0; const Errors_1 = require("../Errors"); const Text_1 = require("./Text"); class Heading extends Text_1.Text { constructor() { super(...arguments); this.levels = null; } /** * Получить объект класса Heading из json * @param json валидная json строка * @returns объект класса Heading */ static fromJSON(json) { try { return Object.assign(new Heading(null, null), JSON.parse(json)); } catch (error) { throw new Errors_1.JsonParseError('Heading widget'); } } /** * Получить объект для сериализации * @returns Объект для сериализации */ toJSON() { return Object.assign({}, null, { id: this.id, type: this.type, styles: this.styles, value: this.value, levels: this.levels, isPageTitle: this.isPageTitle, textAlign: this.textAlign }); } } exports.Heading = Heading; //# sourceMappingURL=Heading.js.map