UNPKG

@aurigma/design-atoms

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

70 lines 2.98 kB
import { ShapeHandlerData } from "./ShapeHandlerData"; import { HandlerFactoryByName } from "./HandlerFactoryByName"; export class PlaceholderHandlerData extends ShapeHandlerData { constructor(handler) { var editing = handler["_editing"]; if (editing) handler["_editing"] = false; super(handler); handler["_editing"] = editing; this.__type = "PlaceholderHandlerData"; if (handler) { if (!handler.isEmptyContent()) { this.CT = handler.getTypeName(); } else { this.CT = null; } var topFrames = handler.topFrames; if (topFrames != null) { this.TFCT = []; this.TFCD = []; for (var i = 0; i < topFrames.length; i++) { this.TFCD.push(topFrames[i].getData()); this.TFCT.push(topFrames[i].getTypeName()); } } var bottomFrames = handler.bottomFrames; if (bottomFrames != null) { this.BFCT = []; this.BFCD = []; for (var i = 0; i < bottomFrames.length; i++) { this.BFCD.push(bottomFrames[i].getData()); this.BFCT.push(bottomFrames[i].getTypeName()); } } this.SMC = handler.showMaskedContent; } } applyState(placeholderData, handler) { if (handler) { handler.beginUpdate(); //call endUpdate in base class if (placeholderData.TFCD != null && placeholderData.TFCD.length !== 0) { var topFrames = []; for (var i = 0; i < placeholderData.TFCD.length; i++) { if (placeholderData.TFCT[i] != null) { var topFrame = new HandlerFactoryByName().create(placeholderData.TFCT[i]); topFrame.setData(placeholderData.TFCD[i]); topFrames.push(topFrame); } } handler.topFrames = topFrames; } if (placeholderData.BFCD != null && placeholderData.BFCD.length !== 0) { var bottomFrames = []; for (var i = 0; i < placeholderData.BFCD.length; i++) { if (placeholderData.BFCT[i] != null) { var bottomFrame = new HandlerFactoryByName().create(placeholderData.BFCT[i]); bottomFrame.setData(placeholderData.BFCD[i]); bottomFrames.push(bottomFrame); } } handler.bottomFrames = bottomFrames; } handler.showMaskedContent = placeholderData.SMC; super.applyState(placeholderData, handler); } } ; } //# sourceMappingURL=PlaceholderHandlerData.js.map