UNPKG

@mirrormedia/lilith-draft-editor

Version:
72 lines (57 loc) 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _immutable = require("immutable"); var _shortid = _interopRequireDefault(require("shortid")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * @typedef Property * @property {string} [id] * @property {string} [type] * @property {string} [alignment] * @property {any[]} [content] * @property {Record<string, any>} [styles] * @property {string} [textAlign] */ const ApiDataInstanceRecord = (0, _immutable.Record)( /** @type {Property} */ { id: _shortid.default.generate(), type: 'paragraph', alignment: 'center', content: [], styles: {}, textAlign: undefined }); class ApiDataInstance extends ApiDataInstanceRecord { /** * @param {Property} props */ constructor(props) { const id = props && props.id || _shortid.default.generate(); props.id = id; super(props); } getId() { return this.get('id'); } getType() { return this.get('type'); } getAlignment() { return this.get('alignment'); } getContent() { return this.get('content'); } getStyles() { return this.get('styles'); } getTextAlign() { return this.get('textAlign'); } } var _default = ApiDataInstance; exports.default = _default;