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.

38 lines 1.79 kB
import { NotImplementedException } from "@aurigma/design-atoms-model/Exception"; import { BaseItemsCommand } from "./BaseItemsCommand"; export class AddContentCommand extends BaseItemsCommand { constructor(productHandler, historyArgs, args, _productThemeManager, _eventManager) { super(productHandler, historyArgs, args); this._productThemeManager = _productThemeManager; this._eventManager = _eventManager; } async _executeCommandBody() { const content = this._args.content; const placeholder = this._args.placeholder; const phItemHandler = this._productHandler.getHandler(placeholder); if (content != null) { const contentItemHandler = this._productHandler.getHandler(content); placeholder.content = content; const theme = this._productThemeManager.currentProductTheme; if (!placeholder.contentPermissions.imagePermissions.allowKeepOverlayColor && placeholder.contentOverlayEffect == null) placeholder.imageContent.overlayEffect = null; else if (theme != null) this._productThemeManager.applyToItem(placeholder, theme); phItemHandler.content = contentItemHandler; placeholder.content.getItemChangedEvent().fire(); } else { placeholder.content = null; phItemHandler.content = null; placeholder.itemPermissions.itemToolbarPermissions.showEditButton = true; } this._eventManager.imageContentChangedEvent.fire(placeholder); } redo() { throw new NotImplementedException(); } undo() { throw new NotImplementedException(); } } //# sourceMappingURL=AddContentCommand.js.map